Class: Excon::HyperMedia::LinkObject
- Inherits:
-
Object
- Object
- Excon::HyperMedia::LinkObject
- Includes:
- Collection
- Defined in:
- lib/excon/hypermedia/link_object.rb
Overview
Link
Encapsulates a link pointing to a resource.
Instance Method Summary collapse
-
#deprecation ⇒ Object
deprecation.
-
#href ⇒ Object
href.
-
#hreflang ⇒ Object
hreflang.
-
#name ⇒ Object
name.
-
#profile ⇒ Object
profile.
-
#rel(params = {}) ⇒ Excon::Connection
rel.
-
#templated ⇒ Object
The “templated” property is OPTIONAL.
-
#title ⇒ Object
title.
-
#type ⇒ Object
type.
-
#uri ⇒ URI
uri.
Methods included from Collection
#[], #each, #initialize, #key?, #keys
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Excon::HyperMedia::Collection
Instance Method Details
#deprecation ⇒ Object
deprecation
The “deprecation” property is OPTIONAL.
Its presence indicates that the link is to be deprecated (i.e. removed) at a future date. Its value is a URL that SHOULD provide further information about the deprecation.
A client SHOULD provide some notification (for example, by logging a warning message) whenever it traverses over a link that has this property. The notification SHOULD include the deprecation property’s value so that a client manitainer can easily find information about the deprecation.
72 73 74 |
# File 'lib/excon/hypermedia/link_object.rb', line 72 def deprecation to_property!(__method__) end |
#href ⇒ Object
href
The “href” property is REQUIRED.
Its value is either a URI [RFC3986] or a URI Template [RFC6570].
If the value is a URI Template then the Link Object SHOULD have a “templated” attribute whose value is true.
25 26 27 |
# File 'lib/excon/hypermedia/link_object.rb', line 25 def href to_property!(:href) end |
#hreflang ⇒ Object
hreflang
The “hreflang” property is OPTIONAL.
Its value is a string and is intended for indicating the language of the target resource (as defined by [RFC5988]).
124 125 126 |
# File 'lib/excon/hypermedia/link_object.rb', line 124 def hreflang to_property!(__method__) end |
#name ⇒ Object
name
The “name” property is OPTIONAL.
Its value MAY be used as a secondary key for selecting Link Objects which share the same relation type.
85 86 87 |
# File 'lib/excon/hypermedia/link_object.rb', line 85 def name to_property!(__method__) end |
#profile ⇒ Object
profile
The “profile” property is OPTIONAL.
Its value is a string which is a URI that hints about the profile (as defined by [I-D.wilde-profile-link]) of the target resource.
98 99 100 |
# File 'lib/excon/hypermedia/link_object.rb', line 98 def profile to_property!(__method__) end |
#rel(params = {}) ⇒ Excon::Connection
rel
Returns an ‘Excon::Connection` instance, based on the current link.
144 145 146 |
# File 'lib/excon/hypermedia/link_object.rb', line 144 def rel(params = {}) Excon.new(href, params) end |
#templated ⇒ Object
The “templated” property is OPTIONAL.
Its value is boolean and SHOULD be true when the Link Object’s “href” property is a URI Template.
Its value SHOULD be considered false if it is undefined or any other value than true.
@see: tools.ietf.org/html/draft-kelly-json-hal-08#section-5.2
39 40 41 |
# File 'lib/excon/hypermedia/link_object.rb', line 39 def templated to_property(__method__) || false end |
#title ⇒ Object
title
The “title” property is OPTIONAL.
Its value is a string and is intended for labelling the link with a human-readable identifier (as defined by [RFC5988]).
111 112 113 |
# File 'lib/excon/hypermedia/link_object.rb', line 111 def title to_property!(__method__) end |
#type ⇒ Object
type
The “type” property is OPTIONAL.
Its value is a string used as a hint to indicate the media type expected when dereferencing the target resource.
@see: tools.ietf.org/html/draft-kelly-json-hal-08#section-5.3
52 53 54 |
# File 'lib/excon/hypermedia/link_object.rb', line 52 def type to_property!(__method__) end |
#uri ⇒ URI
uri
Returns a URI representation of the provided “href” property.
134 135 136 |
# File 'lib/excon/hypermedia/link_object.rb', line 134 def uri ::Addressable::URI.parse(href) end |