Class: Datacentred::Response
- Inherits:
-
Object
- Object
- Datacentred::Response
- Defined in:
- lib/datacentred/response.rb
Overview
A response from the API server.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(server_response) ⇒ Response
constructor
A response from the API server, initialized with A Faraday HTTP Response.
Constructor Details
#initialize(server_response) ⇒ Response
A response from the API server, initialized with A Faraday HTTP Response.
10 11 12 13 14 |
# File 'lib/datacentred/response.rb', line 10 def initialize(server_response) @body = JSON.parse server_response.body rescue nil @status = server_response.status Errors.raise_unless_successful(status, @body) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
4 5 6 |
# File 'lib/datacentred/response.rb', line 4 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status
4 5 6 |
# File 'lib/datacentred/response.rb', line 4 def status @status end |