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



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

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

#productsObject



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

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

#remove_product(product) ⇒ Object



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

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