Class: Leadlight::Link
- Inherits:
-
Object
- Object
- Leadlight::Link
- Defined in:
- lib/leadlight/link.rb
Direct Known Subclasses
Constant Summary collapse
- HTTP_METHODS =
[ :options, :head, :get, :get_representation!, :post, :put, :delete, :patch ]
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#rel ⇒ Object
readonly
Returns the value of attribute rel.
-
#rev ⇒ Object
readonly
Returns the value of attribute rev.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #follow(*args) ⇒ Object
-
#initialize(service, href, rel = nil, title = rel, options = {}) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(service, href, rel = nil, title = rel, options = {}) ⇒ Link
Returns a new instance of Link.
14 15 16 17 18 19 20 21 |
# File 'lib/leadlight/link.rb', line 14 def initialize(service, href, rel=nil, title=rel, ={}) @service = service @href = Addressable::URI.parse(href) @rel = rel.to_s @title = title.to_s @rev = [:rev] @aliases = Array([:aliases]) end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
12 13 14 |
# File 'lib/leadlight/link.rb', line 12 def aliases @aliases end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
11 12 13 |
# File 'lib/leadlight/link.rb', line 11 def href @href end |
#rel ⇒ Object (readonly)
Returns the value of attribute rel.
8 9 10 |
# File 'lib/leadlight/link.rb', line 8 def rel @rel end |
#rev ⇒ Object (readonly)
Returns the value of attribute rev.
9 10 11 |
# File 'lib/leadlight/link.rb', line 9 def rev @rev end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
7 8 9 |
# File 'lib/leadlight/link.rb', line 7 def service @service end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/leadlight/link.rb', line 10 def title @title end |
Instance Method Details
#follow(*args) ⇒ Object
29 30 31 32 33 |
# File 'lib/leadlight/link.rb', line 29 def follow(*args) get_representation!(*args) do |representation| return representation end end |