Class: ChimeraHttpClient::Response
- Inherits:
-
Object
- Object
- ChimeraHttpClient::Response
- Defined in:
- lib/chimera_http_client/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#deserializer ⇒ Object
readonly
Returns the value of attribute deserializer.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(response, options = {}) ⇒ Response
constructor
A new instance of Response.
- #parsed_body ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response, options = {}) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 |
# File 'lib/chimera_http_client/response.rb', line 5 def initialize(response, = {}) @body = response.body @code = response.code @time = response.total_time @response = response # contains the request @deserializer = [:deserializer][:response] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/chimera_http_client/response.rb', line 3 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/chimera_http_client/response.rb', line 3 def code @code end |
#deserializer ⇒ Object (readonly)
Returns the value of attribute deserializer.
3 4 5 |
# File 'lib/chimera_http_client/response.rb', line 3 def deserializer @deserializer end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/chimera_http_client/response.rb', line 3 def response @response end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/chimera_http_client/response.rb', line 3 def time @time end |
Instance Method Details
#error? ⇒ Boolean
22 23 24 |
# File 'lib/chimera_http_client/response.rb', line 22 def error? false end |
#parsed_body ⇒ Object
14 15 16 |
# File 'lib/chimera_http_client/response.rb', line 14 def parsed_body deserializer.call(body) end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/chimera_http_client/response.rb', line 18 def success? response.success? end |