Class: ExmoApi::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_method, params = {}) ⇒ Request

Returns a new instance of Request.



11
12
13
14
# File 'lib/exmo_api/request.rb', line 11

def initialize(api_method, params = {})
  @api_method = api_method
  @params = params
end

Instance Attribute Details

#api_methodObject (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

Instance Method Details

#performObject



16
17
18
# File 'lib/exmo_api/request.rb', line 16

def perform
  JSON.parse response.body.to_s
end

#responseObject



20
21
22
# File 'lib/exmo_api/request.rb', line 20

def response
  @response ||= http.request(build_request)
end