Class: IOTServices::Adapters::JsonResponse
- Inherits:
-
Object
- Object
- IOTServices::Adapters::JsonResponse
- Defined in:
- lib/iot_services/adapters/json_response.rb
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(status, body) ⇒ JsonResponse
constructor
A new instance of JsonResponse.
- #ok? ⇒ Boolean
Constructor Details
#initialize(status, body) ⇒ JsonResponse
Returns a new instance of JsonResponse.
8 9 10 11 |
# File 'lib/iot_services/adapters/json_response.rb', line 8 def initialize status, body @status = status @body = JSON.parse(body) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/iot_services/adapters/json_response.rb', line 6 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/iot_services/adapters/json_response.rb', line 6 def status @status end |
Instance Method Details
#ok? ⇒ Boolean
13 14 15 |
# File 'lib/iot_services/adapters/json_response.rb', line 13 def ok? @status == 200 end |