class SpiffyStoresAPI::Product
Public Instance Methods
add_to_collection(collection)
click to toggle source
# File lib/spiffy_stores_api/resources/product.rb, line 24 def add_to_collection(collection) collection.add_product(self) end
collections()
click to toggle source
# File lib/spiffy_stores_api/resources/product.rb, line 16 def collections StandardCollection.find(:all, :params => {:product_id => self.id}) end
price_range()
click to toggle source
compute the price range
# File lib/spiffy_stores_api/resources/product.rb, line 6 def price_range prices = variants.collect(&:price).collect(&:to_f) format = "%0.2f" if prices.min != prices.max "#{format % prices.min} - #{format % prices.max}" else format % prices.min end end
remove_from_collection(collection)
click to toggle source
# File lib/spiffy_stores_api/resources/product.rb, line 28 def remove_from_collection(collection) collection.remove_product(self) end
super_collections()
click to toggle source
# File lib/spiffy_stores_api/resources/product.rb, line 20 def super_collections SmartCollection.find(:all, :params => {:product_id => self.id}) end