Method: Hyperclient::Resource#initialize

Defined in:
lib/hyperclient/resource.rb

#initialize(representation, entry_point, response = nil) ⇒ Resource

Initializes a Resource.

Parameters:

  • representation

    The hash with the HAL representation of the Resource.

  • entry_point

    The EntryPoint object to inject the configutation.



42
43
44
45
46
47
48
49
50
51
# File 'lib/hyperclient/resource.rb', line 42

def initialize(representation, entry_point, response = nil)
  representation = validate(representation)
  links = representation['_links'] || {}

  @_links       = LinkCollection.new(links, links['curies'], entry_point)
  @_embedded    = ResourceCollection.new(representation['_embedded'], entry_point)
  @_attributes  = Attributes.new(representation)
  @_entry_point = entry_point
  @_response    = response
end