Class: SnapAPIClient::Response
- Inherits:
-
Object
- Object
- SnapAPIClient::Response
- Defined in:
- lib/snap_api_client/response.rb
Overview
Response
Wrapper for an HTTP response.
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body_json ⇒ Object
- #code ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
12 13 14 |
# File 'lib/snap_api_client/response.rb', line 12 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/snap_api_client/response.rb', line 10 def response @response end |
Instance Method Details
#body_json ⇒ Object
20 21 22 |
# File 'lib/snap_api_client/response.rb', line 20 def body_json JSON.parse(response.body) end |
#code ⇒ Object
16 17 18 |
# File 'lib/snap_api_client/response.rb', line 16 def code response.status.code end |