Class: Makeleaps::Response::Wrapper
- Inherits:
-
Object
- Object
- Makeleaps::Response::Wrapper
- Extended by:
- Forwardable
- Defined in:
- lib/makeleaps/response/wrapper.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#meta_information ⇒ Object
readonly
Returns the value of attribute meta_information.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ Wrapper
constructor
A new instance of Wrapper.
Constructor Details
#initialize(raw_response) ⇒ Wrapper
Returns a new instance of Wrapper.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/makeleaps/response/wrapper.rb', line 14 def initialize(raw_response) @status = raw_response.status begin @body = JSON.parse(raw_response.body) rescue JSON::JSONError # TODO: to raise an original error? @body = {} end @meta_information = MetaInformation.new @body['meta'] @resource = Resource.new @body['response'] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/makeleaps/response/wrapper.rb', line 10 def body @body end |
#meta_information ⇒ Object (readonly)
Returns the value of attribute meta_information.
10 11 12 |
# File 'lib/makeleaps/response/wrapper.rb', line 10 def @meta_information end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
10 11 12 |
# File 'lib/makeleaps/response/wrapper.rb', line 10 def resource @resource end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/makeleaps/response/wrapper.rb', line 10 def status @status end |