Class: DeviceCloud::Response
- Inherits:
-
Object
- Object
- DeviceCloud::Response
- Defined in:
- lib/device_cloud/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#original_response ⇒ Object
readonly
Returns the value of attribute original_response.
Instance Method Summary collapse
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
- #to_hash_from_json ⇒ Object
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 |
# File 'lib/device_cloud/response.rb', line 5 def initialize(http_response) @original_response = http_response @code = original_response.code @message = original_response. @headers = original_response.header.to_hash @body = original_response.body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/device_cloud/response.rb', line 3 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/device_cloud/response.rb', line 3 def code @code end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/device_cloud/response.rb', line 3 def headers @headers end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/device_cloud/response.rb', line 3 def @message end |
#original_response ⇒ Object (readonly)
Returns the value of attribute original_response.
3 4 5 |
# File 'lib/device_cloud/response.rb', line 3 def original_response @original_response end |
Instance Method Details
#to_hash_from_json ⇒ Object
13 14 15 |
# File 'lib/device_cloud/response.rb', line 13 def to_hash_from_json JSON.parse(body) end |