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.10.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.9.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.9.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.8.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.7.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.7.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.6.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.5.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.4.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.9 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.8 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.7 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.6 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.5 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.4 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.3 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.2 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.1 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.3.0 lib/shopify_api/resources/custom_collection.rb
shopify_api-4.2.2 lib/shopify_api/resources/custom_collection.rb