Class: Cornerstore::Collection
- Inherits:
-
Model::Base
- Object
- Model::Base
- Cornerstore::Collection
- Defined in:
- lib/cornerstore/api/collection.rb
Defined Under Namespace
Classes: Resource
Instance Attribute Summary collapse
-
#childs ⇒ Object
Returns the value of attribute childs.
-
#members ⇒ Object
Returns the value of attribute members.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#products ⇒ Object
Returns the value of attribute products.
-
#properties ⇒ Object
Returns the value of attribute properties.
Attributes inherited from Model::Base
#_id, #_slugs, #created_at, #updated_at
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(attributes = {}, parent = nil) ⇒ Collection
constructor
A new instance of Collection.
Methods inherited from Model::Base
#==, #attributes=, #inspect, method_missing, #method_missing, #to_param, #url
Constructor Details
#initialize(attributes = {}, parent = nil) ⇒ Collection
Returns a new instance of Collection.
9 10 11 12 13 14 |
# File 'lib/cornerstore/api/collection.rb', line 9 def initialize(attributes = {}, parent = nil) self.products = Cornerstore::Product::Resource.new(self) self.childs = Cornerstore::Collection::Resource.new(self, attributes.delete('child_collections') || [], 'childs') self.properties = Cornerstore::Property::Resource.new(self, attributes.delete('properties') || []) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cornerstore::Model::Base
Instance Attribute Details
#childs ⇒ Object
Returns the value of attribute childs.
2 3 4 |
# File 'lib/cornerstore/api/collection.rb', line 2 def childs @childs end |
#members ⇒ Object
Returns the value of attribute members.
2 3 4 |
# File 'lib/cornerstore/api/collection.rb', line 2 def members @members end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/cornerstore/api/collection.rb', line 2 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
2 3 4 |
# File 'lib/cornerstore/api/collection.rb', line 2 def parent @parent end |
#products ⇒ Object
Returns the value of attribute products.
2 3 4 |
# File 'lib/cornerstore/api/collection.rb', line 2 def products @products end |
#properties ⇒ Object
Returns the value of attribute properties.
2 3 4 |
# File 'lib/cornerstore/api/collection.rb', line 2 def properties @properties end |
Instance Method Details
#attributes ⇒ Object
16 17 18 19 20 |
# File 'lib/cornerstore/api/collection.rb', line 16 def attributes { name: name } end |