Class: HelpScout::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



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

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/help_scout/response.rb', line 7

def response
  @response
end

Instance Method Details

#bodyObject



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

def body
  @_body ||= response.body.deep_transform_keys { |key| key.to_s.underscore.to_sym }
end

#embeddedObject



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

def embedded
  body[:_embedded]
end

#embedded_listObject



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

def embedded_list
  embedded.values.first
end

#itemObject



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

def item
  body[:item]
end

#itemsObject



28
29
30
# File 'lib/help_scout/response.rb', line 28

def items
  body[:items]
end

#locationObject



32
33
34
# File 'lib/help_scout/response.rb', line 32

def location
  headers['location']
end