Class: Mondo::Response
- Inherits:
-
Object
- Object
- Mondo::Response
- Defined in:
- lib/api/mondo/response.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#options ⇒ Object
Returns the value of attribute options.
-
#parsed ⇒ Object
readonly
Returns the value of attribute parsed.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#body ⇒ Object
The HTTP response body.
-
#headers ⇒ Object
The HTTP response headers.
-
#initialize(resp) ⇒ Response
constructor
Initializes a Response instance.
-
#status ⇒ Object
The HTTP response status code.
Constructor Details
#initialize(resp) ⇒ Response
Initializes a Response instance
9 10 11 12 |
# File 'lib/api/mondo/response.rb', line 9 def initialize(resp) @response = resp @parsed = -> { MultiJson.load(body) rescue body }.call end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/api/mondo/response.rb', line 4 def error @error end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/api/mondo/response.rb', line 4 def @options end |
#parsed ⇒ Object (readonly)
Returns the value of attribute parsed.
3 4 5 |
# File 'lib/api/mondo/response.rb', line 3 def parsed @parsed end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/api/mondo/response.rb', line 3 def response @response end |
Instance Method Details
#body ⇒ Object
The HTTP response body
25 26 27 |
# File 'lib/api/mondo/response.rb', line 25 def body response.body || '' end |
#headers ⇒ Object
The HTTP response headers
15 16 17 |
# File 'lib/api/mondo/response.rb', line 15 def headers response.headers end |
#status ⇒ Object
The HTTP response status code
20 21 22 |
# File 'lib/api/mondo/response.rb', line 20 def status response.status end |