Class: JSON_ROA::Client::Relation
- Inherits:
-
Object
- Object
- JSON_ROA::Client::Relation
- Defined in:
- lib/json_roa/client/relation.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #get(query_parameters = {}) ⇒ Object
-
#initialize(conn, key, data) ⇒ Relation
constructor
A new instance of Relation.
- #methods ⇒ Object
Constructor Details
#initialize(conn, key, data) ⇒ Relation
Returns a new instance of Relation.
12 13 14 15 16 |
# File 'lib/json_roa/client/relation.rb', line 12 def initialize conn, key, data @conn= conn @key= key @data= data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/json_roa/client/relation.rb', line 9 def data @data end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/json_roa/client/relation.rb', line 10 def key @key end |
Instance Method Details
#get(query_parameters = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/json_roa/client/relation.rb', line 18 def get query_parameters= {} href= @data['href'] template= ::Addressable::Template.new(href) = template.(query_parameters) response=@conn.get() ::JSON_ROA::Client::Resource.new(@conn,response) end |
#methods ⇒ Object
26 27 28 |
# File 'lib/json_roa/client/relation.rb', line 26 def methods @data['methods'] end |