Class: ShopifyAPI::CustomCollection

Inherits:
Base
  • Object
show all
Defined in:
lib/shopify_api.rb

Overview

Custom collection

Instance Method Summary collapse

Methods included from Countable

#count

Instance Method Details

#add_product(product) ⇒ Object



219
220
221
# File 'lib/shopify_api.rb', line 219

def add_product(product)
  Collect.create(:collection_id => self.id, :product_id => product.id)
end

#productsObject



215
216
217
# File 'lib/shopify_api.rb', line 215

def products
  Product.find(:all, :params => {:collection_id => self.id})
end

#remove_product(product) ⇒ Object



223
224
225
226
# File 'lib/shopify_api.rb', line 223

def remove_product(product)
  collect = Collect.find(:first, :params => {:collection_id => self.id, :product_id => product.id})
  collect.destroy if collect
end