Class: Hyperclient::Discoverer::URLExtractor Private
- Inherits:
-
Object
- Object
- Hyperclient::Discoverer::URLExtractor
- Defined in:
- lib/hyperclient/discoverer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Extract the url from a HAL representation.
Instance Method Summary collapse
-
#initialize(representation) ⇒ URLExtractor
constructor
Initializes a URLExtractor.
-
#url ⇒ Object
Returns a String with the resource URL.
Constructor Details
#initialize(representation) ⇒ URLExtractor
Initializes a URLExtractor.
67 68 69 |
# File 'lib/hyperclient/discoverer.rb', line 67 def initialize(representation) @representation = representation end |
Instance Method Details
#url ⇒ Object
Returns a String with the resource URL
72 73 74 75 76 77 78 79 |
# File 'lib/hyperclient/discoverer.rb', line 72 def url return @representation.delete('href') if @representation.include?('href') if @representation && @representation['_links'] && @representation['_links']['self'] && (url = @representation['_links']['self']['href']) return url end end |