class Excon::HyperMedia::LinkObject

Link

Encapsulates a link pointing to a resource.

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

Public Instance Methods

deprecation() click to toggle source

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.

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

# File lib/excon/hypermedia/link_object.rb, line 72
def deprecation
  to_property!(__method__)
end
href() click to toggle source

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.

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

# File lib/excon/hypermedia/link_object.rb, line 25
def href
  to_property!(:href)
end
hreflang() click to toggle source

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]).

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

# File lib/excon/hypermedia/link_object.rb, line 124
def hreflang
  to_property!(__method__)
end
name() click to toggle source

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.

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

# File lib/excon/hypermedia/link_object.rb, line 85
def name
  to_property!(__method__)
end
profile() click to toggle source

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.

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

# File lib/excon/hypermedia/link_object.rb, line 98
def profile
  to_property!(__method__)
end
rel(params = {}) click to toggle source

rel

Returns an `Excon::Connection` instance, based on the current link.

@return [Excon::Connection] Connection object based on current link

# File lib/excon/hypermedia/link_object.rb, line 144
def rel(params = {})
  Excon.new(href, params)
end
templated() click to toggle source

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

# File lib/excon/hypermedia/link_object.rb, line 39
def templated
  to_property(__method__) || false
end
title() click to toggle source

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]).

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

# File lib/excon/hypermedia/link_object.rb, line 111
def title
  to_property!(__method__)
end
type() click to toggle source

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

# File lib/excon/hypermedia/link_object.rb, line 52
def type
  to_property!(__method__)
end
uri() click to toggle source

uri

Returns a URI representation of the provided “href” property.

@return [URI] URI object of the “href” property

# File lib/excon/hypermedia/link_object.rb, line 134
def uri
  ::Addressable::URI.parse(href)
end

Private Instance Methods

property(value) click to toggle source
# File lib/excon/hypermedia/link_object.rb, line 150
def property(value)
  value
end