Class: Twitty::Request

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

Constant Summary collapse

HEADERS =
{ 'Content-Type' => 'application/json; charset=utf-8' }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Request

Returns a new instance of Request.



10
11
12
13
14
15
# File 'lib/twitty/request.rb', line 10

def initialize(params)
  @url = params[:url]
  @type = params[:type]
  @payload = params[:payload]
  @config = params[:config]
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



2
3
4
# File 'lib/twitty/request.rb', line 2

def config
  @config
end

#payloadObject (readonly)

Returns the value of attribute payload.



2
3
4
# File 'lib/twitty/request.rb', line 2

def payload
  @payload
end

#typeObject (readonly)

Returns the value of attribute type.



2
3
4
# File 'lib/twitty/request.rb', line 2

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



2
3
4
# File 'lib/twitty/request.rb', line 2

def url
  @url
end

Class Method Details

.execute(params) ⇒ Object



6
7
8
# File 'lib/twitty/request.rb', line 6

def self.execute(params)
  new(params)
end

Instance Method Details

#executeObject



17
18
19
# File 'lib/twitty/request.rb', line 17

def execute
  send("api_#{type}")
end