Class: Conduit::ApiResponse
- Inherits:
-
Object
- Object
- Conduit::ApiResponse
- Defined in:
- lib/conduit/api_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ApiResponse
constructor
A new instance of ApiResponse.
Constructor Details
#initialize(options = {}) ⇒ ApiResponse
Returns a new instance of ApiResponse.
5 6 7 8 9 10 11 12 |
# File 'lib/conduit/api_response.rb', line 5 def initialize( = {}) @raw_response = [:raw_response] @body = [:body] ||= @raw_response.body @parser = [:parser] @http_status = [:http_status] ||= begin @raw_response.try(:http_status) || @raw_response.try(:status) end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/conduit/api_response.rb', line 3 def body @body end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
3 4 5 |
# File 'lib/conduit/api_response.rb', line 3 def http_status @http_status end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
3 4 5 |
# File 'lib/conduit/api_response.rb', line 3 def parser @parser end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
3 4 5 |
# File 'lib/conduit/api_response.rb', line 3 def raw_response @raw_response end |