Class: JsonClient::BaseResponses::Response
- Inherits:
-
Object
- Object
- JsonClient::BaseResponses::Response
- Defined in:
- lib/json_client/base_responses/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(body, code) ⇒ Response
constructor
A new instance of Response.
- #json ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(body, code) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/json_client/base_responses/response.rb', line 6 def initialize(body, code) @body = body @code = code end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/json_client/base_responses/response.rb', line 4 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/json_client/base_responses/response.rb', line 4 def code @code end |
Instance Method Details
#json ⇒ Object
11 12 13 |
# File 'lib/json_client/base_responses/response.rb', line 11 def json parse_json end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/json_client/base_responses/response.rb', line 15 def success? code >= 200 && code < 300 end |