Class: ConveyClient::Item
- Inherits:
-
Object
- Object
- ConveyClient::Item
- Defined in:
- lib/convey_client/item.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(raw_item) ⇒ Item
constructor
A new instance of Item.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(raw_item) ⇒ Item
Returns a new instance of Item.
5 6 7 8 9 10 11 |
# File 'lib/convey_client/item.rb', line 5 def initialize(raw_item) self.id = raw_item["id"] self.name = raw_item["name"] self.bucket = raw_item["bucket"] self.template = raw_item["template"] self.attributes = raw_item["attributes"] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
13 14 15 16 17 |
# File 'lib/convey_client/item.rb', line 13 def method_missing(method, *args, &block) super unless attributes.keys.include?(method.to_s) attributes[method.to_s]["value"] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/convey_client/item.rb', line 3 def attributes @attributes end |
#bucket ⇒ Object
Returns the value of attribute bucket.
3 4 5 |
# File 'lib/convey_client/item.rb', line 3 def bucket @bucket end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/convey_client/item.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/convey_client/item.rb', line 3 def name @name end |
#template ⇒ Object
Returns the value of attribute template.
3 4 5 |
# File 'lib/convey_client/item.rb', line 3 def template @template end |