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, #not_paginatable?, #paginatable?, #success?

Constructor Details

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

Instance Method Details

#bodyObject



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

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

#dataObject



27
28
29
# File 'lib/bank_exchange_api/response/json.rb', line 27

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

#inspectObject



31
32
33
# File 'lib/bank_exchange_api/response/json.rb', line 31

def inspect
  body
end

#next_page_urlObject



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

def next_page_url
  pagination['next_page_url']
end

#paginationObject



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

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

#paramsObject



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

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