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
271 |
# File 'lib/shopify_api.rb', line 271 def self.share; post :share; end |
.unshare ⇒ Object
272 |
# File 'lib/shopify_api.rb', line 272 def self.unshare; delete :share; end |
Instance Method Details
#add_to_collection(collection) ⇒ Object
293 294 295 |
# File 'lib/shopify_api.rb', line 293 def add_to_collection(collection) collection.add_product(self) end |
#collections ⇒ Object
285 286 287 |
# File 'lib/shopify_api.rb', line 285 def collections CustomCollection.find(:all, :params => {:product_id => self.id}) end |
#price_range ⇒ Object
compute the price range
275 276 277 278 279 280 281 282 283 |
# File 'lib/shopify_api.rb', line 275 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
297 298 299 |
# File 'lib/shopify_api.rb', line 297 def remove_from_collection(collection) collection.remove_product(self) end |
#smart_collections ⇒ Object
289 290 291 |
# File 'lib/shopify_api.rb', line 289 def smart_collections SmartCollection.find(:all, :params => {:product_id => self.id}) end |