class Excon::HyperMedia::ResourceObject
Represents a resource.
Constants
- RESERVED_PROPERTIES
Public Class Methods
# File lib/excon/hypermedia/resource_object.rb, line 16 def initialize(data) @data = data end
Public Instance Methods
# File lib/excon/hypermedia/resource_object.rb, line 56 def [](key) _properties[key] end
_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
_links
The reserved “_links” property is OPTIONAL.
It is an object whose property names are link relation types (as defined by [RFC5988]) and values are either a Link Object or an array of Link Objects. The subject resource of these links is the Resource Object of which the containing “_links” object is a property.
@see tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.1
# File lib/excon/hypermedia/resource_object.rb, line 35 def _links @_links ||= Links.new(@data['_links']) end
# File lib/excon/hypermedia/resource_object.rb, line 20 def _properties @_properties ||= Properties.new(@data.reject { |k, _| RESERVED_PROPERTIES.include?(k) }) end
# 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
# File lib/excon/hypermedia/resource_object.rb, line 64 def respond_to_missing?(method_name, _ = false) _properties.respond_to?(method_name) || super end