Sha256: 6ef943625580ceb20f095ad2f6c736eafa9fd40dc1354b9d91ef538300f6d7b7

Contents?: true

Size: 557 Bytes

Versions: 55

Compression:

Stored size: 557 Bytes

Contents

module ShopifyAPI
  class CustomCollection < Base
    include Events
    include Metafields

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

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
shopify_api-4.2.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.2.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.1.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.1.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.7 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.6 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.5 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.4 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.3 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.2 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.0.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.7 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.6 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.5 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.4 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.3 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.2 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-3.2.0 lib/shopify_api/resources/custom_collection.rb