Class: SirenClient::Link
- Inherits:
-
Object
- Object
- SirenClient::Link
- Includes:
- Modules::WithRawResponse
- Defined in:
- lib/siren_client/link.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#href ⇒ Object
Returns the value of attribute href.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#rels ⇒ Object
readonly
Returns the value of attribute rels.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize(data, config = {}) ⇒ Link
constructor
A new instance of Link.
Methods included from Modules::WithRawResponse
#disable_raw_response, #next_response_is_raw?, #with_raw_response
Constructor Details
#initialize(data, config = {}) ⇒ Link
Returns a new instance of Link.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/siren_client/link.rb', line 8 def initialize(data, config={}) super() if data.class != Hash raise ArgumentError, "You must pass in a Hash to SirenClient::Link.new" end @payload = data @config = { format: :json }.merge config @rels = @payload['rel'] || [] @href = @payload['href'] || '' @title = @payload['title'] || '' @type = @payload['type'] || '' end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/siren_client/link.rb', line 6 def config @config end |
#href ⇒ Object
Returns the value of attribute href.
5 6 7 |
# File 'lib/siren_client/link.rb', line 5 def href @href end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
6 7 8 |
# File 'lib/siren_client/link.rb', line 6 def payload @payload end |
#rels ⇒ Object (readonly)
Returns the value of attribute rels.
6 7 8 |
# File 'lib/siren_client/link.rb', line 6 def rels @rels end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/siren_client/link.rb', line 6 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/siren_client/link.rb', line 6 def type @type end |