Sha256: da4e3e59785a8a7020915bea9efad588b4acfe88642e8041bd2ca33528dc3490
Contents?: true
Size: 497 Bytes
Versions: 9
Compression:
Stored size: 497 Bytes
Contents
# frozen_string_literal: true 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
9 entries across 9 versions & 2 rubygems