Class: ShopifyAPI::Product
- Defined in:
- lib/shopify_api.rb
Class Method Summary collapse
-
.share ⇒ Object
Share all items of this store with the shopify marketplace.
- .unshare ⇒ Object
Instance Method Summary collapse
- #add_to_collection(collection) ⇒ Object
- #collections ⇒ Object
-
#price_range ⇒ Object
compute the price range.
- #remove_from_collection(collection) ⇒ Object
- #smart_collections ⇒ Object
Methods included from Countable
Class Method Details
.share ⇒ Object
Share all items of this store with the shopify marketplace
272 |
# File 'lib/shopify_api.rb', line 272 def self.share; post :share; end |
.unshare ⇒ Object
273 |
# File 'lib/shopify_api.rb', line 273 def self.unshare; delete :share; end |
Instance Method Details
#add_to_collection(collection) ⇒ Object
294 295 296 |
# File 'lib/shopify_api.rb', line 294 def add_to_collection(collection) collection.add_product(self) end |
#collections ⇒ Object
286 287 288 |
# File 'lib/shopify_api.rb', line 286 def collections CustomCollection.find(:all, :params => {:product_id => self.id}) end |
#price_range ⇒ Object
compute the price range
276 277 278 279 280 281 282 283 284 |
# File 'lib/shopify_api.rb', line 276 def price_range prices = variants.collect(&:price) format = "%0.2f" if prices.min != prices.max "#{format % prices.min} - #{format % prices.max}" else format % prices.min end end |
#remove_from_collection(collection) ⇒ Object
298 299 300 |
# File 'lib/shopify_api.rb', line 298 def remove_from_collection(collection) collection.remove_product(self) end |
#smart_collections ⇒ Object
290 291 292 |
# File 'lib/shopify_api.rb', line 290 def smart_collections SmartCollection.find(:all, :params => {:product_id => self.id}) end |