Class: ShopifyAPI::SmartCollection

Inherits:
Base
  • Object
show all
Includes:
Events, Metafields
Defined in:
lib/shopify_api/resources/smart_collection.rb

Instance Method Summary collapse

Methods included from Metafields

#add_metafield, #metafields

Methods included from Events

#events

Methods inherited from Base

activate_session, api_version, api_version=, #as_json, clear_session, #encode, #headers, init_prefix, init_prefix_explicit, #persisted?, prefix, prefix=, prefix_source, resource_prefix, resource_prefix=

Methods included from Countable

#count

Instance Method Details

#order(options = {}) ⇒ Object



14
15
16
# File 'lib/shopify_api/resources/smart_collection.rb', line 14

def order(options={})
  load_attributes_from_response(put(:order, options, only_id))
end

#products(options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/shopify_api/resources/smart_collection.rb', line 6

def products(options = {})
  if options.present?
    Product.find(:all, from: "#{self.class.prefix}smart_collections/#{id}/products.json", params: options)
  else
    Product.find(:all, params: { collection_id: id })
  end
end