Class: Workarea::Orderbot::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/orderbot/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



4
5
6
# File 'lib/workarea/orderbot/response.rb', line 4

def initialize(response)
  @response = response
end

Instance Method Details

#bodyObject



12
13
14
# File 'lib/workarea/orderbot/response.rb', line 12

def body
  @body ||= JSON.parse(@response.body)
end

#error_detailsObject



24
25
26
# File 'lib/workarea/orderbot/response.rb', line 24

def error_details
  body["errors"].to_s
end

#headersObject



16
17
18
# File 'lib/workarea/orderbot/response.rb', line 16

def headers
  @headers ||= @response.headers
end

#success?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/workarea/orderbot/response.rb', line 8

def success?
  @response.success?
end

#total_pagesObject



20
21
22
# File 'lib/workarea/orderbot/response.rb', line 20

def total_pages
  headers["x-total-pages"]
end