Class: Incentivale::Response
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Incentivale::Response
- Defined in:
- lib/incentivale/response.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #json ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
3 4 5 6 7 8 9 10 11 |
# File 'lib/incentivale/response.rb', line 3 def initialize(response) @response = response if json.is_a?(Hash) super(RecursiveOpenStruct.new(json, recurse_over_arrays: true)) else super(@response.body) end @response end |
Instance Method Details
#json ⇒ Object
13 14 15 |
# File 'lib/incentivale/response.rb', line 13 def json @json ||= JSON.parse(@response.body).to_snake_keys end |