Module: LHC::Response::Data::Base
- Included in:
- LHC::Response::Data, Collection, Item
- Defined in:
- lib/lhc/response/data/base.rb
Overview
Response data is data provided through the response body but made accssible in the ruby world
Instance Method Summary collapse
Instance Method Details
#as_json ⇒ Object
4 5 6 |
# File 'lib/lhc/response/data/base.rb', line 4 def as_json @json ||= (@data || response.format.as_json(response.body)) end |
#as_open_struct ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/lhc/response/data/base.rb', line 8 def as_open_struct @open_struct ||= if @data JSON.parse(@data.to_json, object_class: OpenStruct) else response.format.as_open_struct(response.body) end end |