Class: Optimum::Response
- Inherits:
-
Object
- Object
- Optimum::Response
- Extended by:
- Forwardable
- Defined in:
- lib/optimum/response.rb
Instance Method Summary collapse
- #data ⇒ Object
- #error ⇒ Object
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
11 12 13 |
# File 'lib/optimum/response.rb', line 11 def initialize(http_response) @http_response = http_response end |
Instance Method Details
#data ⇒ Object
21 22 23 |
# File 'lib/optimum/response.rb', line 21 def data body || {} end |
#error ⇒ Object
15 16 17 18 19 |
# File 'lib/optimum/response.rb', line 15 def error return body.dig(:message) if body.respond_to?(:dig) body.empty? ? '' : body end |