Class: ExmoApi::Request
- Inherits:
-
Object
- Object
- ExmoApi::Request
- Defined in:
- lib/exmo_api/request.rb
Instance Attribute Summary collapse
-
#api_method ⇒ Object
readonly
Returns the value of attribute api_method.
-
#config ⇒ Object
writeonly
Sets the attribute config.
Instance Method Summary collapse
-
#initialize(api_method, params = {}) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(api_method, params = {}) ⇒ Request
Returns a new instance of Request.
12 13 14 15 |
# File 'lib/exmo_api/request.rb', line 12 def initialize(api_method, params = {}) @api_method = api_method @params = params end |
Instance Attribute Details
#api_method ⇒ Object (readonly)
Returns the value of attribute api_method.
9 10 11 |
# File 'lib/exmo_api/request.rb', line 9 def api_method @api_method end |
#config=(value) ⇒ Object
Sets the attribute config
10 11 12 |
# File 'lib/exmo_api/request.rb', line 10 def config=(value) @config = value end |
Instance Method Details
#perform ⇒ Object
17 18 19 |
# File 'lib/exmo_api/request.rb', line 17 def perform JSON.parse response.body.to_s end |
#response ⇒ Object
21 22 23 |
# File 'lib/exmo_api/request.rb', line 21 def response @response ||= http.request(build_request) end |