Class: Excon::HyperMedia::Response

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

Overview

Response

This HyperMedia::Response object helps determine valid subsequent requests and attribute values.

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



13
14
15
# File 'lib/excon/hypermedia/response.rb', line 13

def initialize(response)
  @response = response
end

Instance Method Details

#handle(method_name, *params) ⇒ Object

handle

Correctly handle the hypermedia request.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/excon/hypermedia/response.rb', line 21

def handle(method_name, *params) # rubocop:disable Metrics/CyclomaticComplexity
  return false unless enabled?

  case method_name
  when :resource                 then resource
  when :_links, :links           then resource._links
  when :_embedded, :embedded     then resource._embedded
  when :_properties, :properties then resource._properties
  when :rel                      then rel(params.shift, params)
  else false
  end
end