Class: Optimum::Response

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/optimum/response.rb

Instance Method Summary collapse

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

#dataObject



21
22
23
# File 'lib/optimum/response.rb', line 21

def data
  body || {}
end

#errorObject



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