class Excon::HyperMedia::ResourceObject

ResourceObject

Represents a resource.

Constants

RESERVED_PROPERTIES

Public Class Methods

new(data) click to toggle source
# File lib/excon/hypermedia/resource_object.rb, line 16
def initialize(data)
  @data = data
end

Public Instance Methods

[](key) click to toggle source
# File lib/excon/hypermedia/resource_object.rb, line 56
def [](key)
  _properties[key]
end
_embedded() click to toggle source

_embedded

The reserved “_embedded” property is OPTIONAL

It is an object whose property names are link relation types (as defined by [RFC5988]) and values are either a Resource Object or an array of Resource Objects.

Embedded Resources MAY be a full, partial, or inconsistent version of the representation served from the target URI.

@see tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2

# File lib/excon/hypermedia/resource_object.rb, line 52
def _embedded
  @_embedded ||= Embedded.new(@data['_embedded'])
end
_properties() click to toggle source
# File lib/excon/hypermedia/resource_object.rb, line 20
def _properties
  @_properties ||= Properties.new(@data.reject { |k, _| RESERVED_PROPERTIES.include?(k) })
end
method_missing(method_name, *_) click to toggle source
Calls superclass method
# File lib/excon/hypermedia/resource_object.rb, line 60
def method_missing(method_name, *_)
  _properties.respond_to?(method_name) ? _properties.send(method_name) : super
end
respond_to_missing?(method_name, _ = false) click to toggle source
Calls superclass method
# File lib/excon/hypermedia/resource_object.rb, line 64
def respond_to_missing?(method_name, _ = false)
  _properties.respond_to?(method_name) || super
end