Class: Twitty::Request
- Inherits:
-
Object
- Object
- Twitty::Request
- Defined in:
- lib/twitty/request.rb
Constant Summary collapse
- HEADERS =
{ 'Content-Type' => 'application/json; charset=utf-8' }
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params) ⇒ Request
constructor
A new instance of Request.
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
2 3 4 |
# File 'lib/twitty/request.rb', line 2 def config @config end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
2 3 4 |
# File 'lib/twitty/request.rb', line 2 def payload @payload end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/twitty/request.rb', line 2 def type @type end |
#url ⇒ Object (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
#execute ⇒ Object
17 18 19 |
# File 'lib/twitty/request.rb', line 17 def execute send("api_#{type}") end |