Parent

EventMachine::Twitter::Client

Constants

CALLBACKS

Attributes

connection[RW]
host[RW]
options[RW]
port[RW]

Public Class Methods

connect(options = {}) click to toggle source

A convenience method for creating and connecting.

# File lib/em-twitter/client.rb, line 28
def self.connect(options = {})
  new(options).tap do |client|
    client.connect
  end
end
new(options = {}) click to toggle source
# File lib/em-twitter/client.rb, line 34
def initialize(options = {})
  @options = DEFAULT_CONNECTION_OPTIONS.merge(options)

  validate_client

  @host = @options[:host]
  @port = @options[:port]

  if @options[:proxy] && @options[:proxy][:uri]
    proxy_uri = URI.parse(@options[:proxy][:uri])
    @host = proxy_uri.host
    @port = proxy_uri.port
  end
  @connection = nil
end

Public Instance Methods

connect() click to toggle source
# File lib/em-twitter/client.rb, line 50
def connect
  @connection = EM.connect(@host, @port, Connection, self, @host, @port)
end
each(&block) click to toggle source
# File lib/em-twitter/client.rb, line 54
def each(&block)
  @each_item_callback = block
end
method_missing(method, *args, &block) click to toggle source

Delegate to EM::Twitter::Connection

# File lib/em-twitter/client.rb, line 112
def method_missing(method, *args, &block)
  return super unless @connection.respond_to?(method)
  @connection.send(method, *args, &block)
end
on_close(&block) click to toggle source
# File lib/em-twitter/client.rb, line 103
def on_close(&block)
  @close_callback = block
end
on_enhance_your_calm(&block) click to toggle source
# File lib/em-twitter/client.rb, line 86
def on_enhance_your_calm(&block)
  @enhance_your_calm_callback = block
end
Also aliased as: on_rate_limited
on_error(&block) click to toggle source
# File lib/em-twitter/client.rb, line 58
def on_error(&block)
  @error_callback = block
end
on_forbidden(&block) click to toggle source
# File lib/em-twitter/client.rb, line 66
def on_forbidden(&block)
  @forbidden_callback = block
end
on_max_reconnects(&block) click to toggle source
# File lib/em-twitter/client.rb, line 99
def on_max_reconnects(&block)
  @max_reconnects_callback = block
end
on_no_data_received(&block) click to toggle source
# File lib/em-twitter/client.rb, line 107
def on_no_data_received(&block)
  @no_data_callback = block
end
on_not_acceptable(&block) click to toggle source
# File lib/em-twitter/client.rb, line 74
def on_not_acceptable(&block)
  @not_acceptable_callback = block
end
on_not_found(&block) click to toggle source
# File lib/em-twitter/client.rb, line 70
def on_not_found(&block)
  @not_found_callback = block
end
on_range_unacceptable(&block) click to toggle source
# File lib/em-twitter/client.rb, line 82
def on_range_unacceptable(&block)
  @range_unacceptable_callback = block
end
on_rate_limited(&block) click to toggle source
on_reconnect(&block) click to toggle source
# File lib/em-twitter/client.rb, line 95
def on_reconnect(&block)
  @reconnect_callback = block
end
on_service_unavailable(&block) click to toggle source
# File lib/em-twitter/client.rb, line 91
def on_service_unavailable(&block)
  @service_unavailable_callback = block
end
on_too_long(&block) click to toggle source
# File lib/em-twitter/client.rb, line 78
def on_too_long(&block)
  @too_long_callback = block
end
on_unauthorized(&block) click to toggle source
# File lib/em-twitter/client.rb, line 62
def on_unauthorized(&block)
  @unauthorized_callback = block
end
respond_to?(method, include_private=false) click to toggle source
# File lib/em-twitter/client.rb, line 117
def respond_to?(method, include_private=false)
  @connection.respond_to?(method, include_private) || super(method, include_private)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.