Class: Cetacean::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject (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.

Returns:

  • (Boolean)


18
19
20
# File 'lib/cetacean/response.rb', line 18

def hal?
  response.headers['content-type'] =~ %r{\Aapplication/hal\+json}
end