Class: Twitter::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter/request.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Twitter::Request) initialize(client, request_method, path, options = {})



13
14
15
16
17
18
# File 'lib/twitter/request.rb', line 13

def initialize(client, request_method, path, options = {})
  @client = client
  @request_method = request_method.to_sym
  @path = path
  @options = options
end

Instance Attribute Details

- (Object) client

Returns the value of attribute client



5
6
7
# File 'lib/twitter/request.rb', line 5

def client
  @client
end

- (Object) options

Returns the value of attribute options



5
6
7
# File 'lib/twitter/request.rb', line 5

def options
  @options
end

- (Object) path

Returns the value of attribute path



5
6
7
# File 'lib/twitter/request.rb', line 5

def path
  @path
end

- (Object) request_method Also known as: verb

Returns the value of attribute request_method



5
6
7
# File 'lib/twitter/request.rb', line 5

def request_method
  @request_method
end

Instance Method Details

- (Hash) perform



21
22
23
# File 'lib/twitter/request.rb', line 21

def perform
  @client.send(@request_method, @path, @options).body
end

- (Twitter::Cursor) perform_with_cursor(collection_name, klass = nil)



35
36
37
# File 'lib/twitter/request.rb', line 35

def perform_with_cursor(collection_name, klass = nil)
  Twitter::Cursor.new(perform, collection_name.to_sym, klass, self)
end

- (Object) perform_with_object(klass)



28
29
30
# File 'lib/twitter/request.rb', line 28

def perform_with_object(klass)
  klass.new(perform)
end

- (Array) perform_with_objects(klass)



41
42
43
44
45
# File 'lib/twitter/request.rb', line 41

def perform_with_objects(klass)
  perform.collect do |element|
    klass.new(element)
  end
end