Class: HelpScout::Response
- Inherits:
-
Object
- Object
- HelpScout::Response
- Defined in:
- lib/help_scout/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
- #embedded ⇒ Object
- #embedded_list ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #item ⇒ Object
- #items ⇒ Object
- #location ⇒ Object
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
#response ⇒ Object (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
#body ⇒ Object
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 |
#embedded ⇒ Object
16 17 18 |
# File 'lib/help_scout/response.rb', line 16 def body[:_embedded] end |
#embedded_list ⇒ Object
20 21 22 |
# File 'lib/help_scout/response.rb', line 20 def .values.first end |
#item ⇒ Object
24 25 26 |
# File 'lib/help_scout/response.rb', line 24 def item body[:item] end |
#items ⇒ Object
28 29 30 |
# File 'lib/help_scout/response.rb', line 28 def items body[:items] end |
#location ⇒ Object
32 33 34 |
# File 'lib/help_scout/response.rb', line 32 def location headers['location'] end |