Class: Cetacean::Response
- Inherits:
-
Object
- Object
- Cetacean::Response
- Extended by:
- Forwardable
- Includes:
- Resource
- Defined in:
- lib/cetacean/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#hal? ⇒ Boolean
Tells you whether the response thinks it’s a HAL document or not.
-
#initialize(response) ⇒ Response
constructor
Feed me Faraday::Response objects or things that quack like them.
Methods included from Resource
#attributes, #embedded, #get_uri, #links
Constructor Details
#initialize(response) ⇒ Response
Feed me Faraday::Response objects or things that quack like them.
12 13 14 |
# File 'lib/cetacean/response.rb', line 12 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/cetacean/response.rb', line 9 def response @response end |
Instance Method Details
#hal? ⇒ Boolean
Tells you whether the response thinks it’s a HAL document or not. Does no validation.
18 19 20 |
# File 'lib/cetacean/response.rb', line 18 def hal? response.headers['content-type'] =~ %r{\Aapplication/hal\+json} end |