Class: BankExchangeApi::Response::Json

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bank_exchange_api/response/json.rb

Instance Attribute Summary

Attributes inherited from Base

#http, #root

Instance Method Summary collapse

Methods inherited from Base

#initialize, #success?

Constructor Details

This class inherits a constructor from BankExchangeApi::Response::Base

Instance Method Details

#bodyObject



10
11
12
# File 'lib/bank_exchange_api/response/json.rb', line 10

def body
  @body ||= JSON.parse(http.body)
end

#dataObject



18
19
20
# File 'lib/bank_exchange_api/response/json.rb', line 18

def data
  root ? body[root.to_s] : body
end

#inspectObject



22
23
24
# File 'lib/bank_exchange_api/response/json.rb', line 22

def inspect
  data
end

#paramsObject



14
15
16
# File 'lib/bank_exchange_api/response/json.rb', line 14

def params
  body.fetch('params', {})
end