Class: NOMIS::API::ParsedResponse
- Inherits:
-
Object
- Object
- NOMIS::API::ParsedResponse
- Defined in:
- lib/nomis/api/parsed_response.rb
Overview
decorates a Net::HTTP response with a data method, which parses the JSON in the response body
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#data ⇒ Object
Returns the value of attribute data.
-
#raw_response ⇒ Object
Returns the value of attribute raw_response.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ ParsedResponse
constructor
A new instance of ParsedResponse.
Constructor Details
#initialize(raw_response) ⇒ ParsedResponse
Returns a new instance of ParsedResponse.
10 11 12 13 |
# File 'lib/nomis/api/parsed_response.rb', line 10 def initialize(raw_response) self.raw_response = raw_response self.data = JSON.parse(raw_response.body) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
8 9 10 |
# File 'lib/nomis/api/parsed_response.rb', line 8 def body @body end |
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/nomis/api/parsed_response.rb', line 8 def data @data end |
#raw_response ⇒ Object
Returns the value of attribute raw_response.
8 9 10 |
# File 'lib/nomis/api/parsed_response.rb', line 8 def raw_response @raw_response end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/nomis/api/parsed_response.rb', line 8 def status @status end |