Class: Collection
- Defined in:
- app/models/collection.rb
Constant Summary
Constants inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #ancestors ⇒ Object
- #children ⇒ Object
- #image ⇒ Object
- #parent ⇒ Object
- #products ⇒ Object
- #root? ⇒ Boolean
- #siblings ⇒ Object
Class Method Details
.roots ⇒ Object
2 3 4 |
# File 'app/models/collection.rb', line 2 def self.roots self.find(:all, :from => "/v1/collections/roots.xml") end |
Instance Method Details
#ancestors ⇒ Object
14 15 16 |
# File 'app/models/collection.rb', line 14 def ancestors Collection.find(:all, :from => "/v1/collections/#{self.handle}/ancestors.xml") end |
#children ⇒ Object
18 19 20 |
# File 'app/models/collection.rb', line 18 def children Collection.find(:all, :from => "/v1/collections/#{self.handle}/children.xml") end |
#image ⇒ Object
30 31 32 33 34 35 |
# File 'app/models/collection.rb', line 30 def image dragonfly = Dragonfly[:images] dragonfly.url_host = 'http://cdn.storesapp.com' dragonfly.url_path_prefix = '/images' dragonfly.fetch(self.image_uid) end |
#parent ⇒ Object
10 11 12 |
# File 'app/models/collection.rb', line 10 def parent Collection.find(:one, :from => "/v1/collections/#{self.parent_id}.xml") end |
#products ⇒ Object
26 27 28 |
# File 'app/models/collection.rb', line 26 def products Product.find(:all, :from => "/v1/collections/#{self.handle}/products.xml") end |
#root? ⇒ Boolean
6 7 8 |
# File 'app/models/collection.rb', line 6 def root? self.parent_id.blank? end |
#siblings ⇒ Object
22 23 24 |
# File 'app/models/collection.rb', line 22 def siblings Collection.find(:all, :from => "/v1/collections/#{self.handle}/siblings.xml") end |