class ShopifyAPI::SmartCollection

Attributes

body_html[R]
disjunctive[R]
handle[R]
id[R]
image[R]
published_at[R]
published_scope[R]
rules[R]
sort_order[R]
template_suffix[R]
title[R]
updated_at[R]

Public Class Methods

all( limit: nil, ids: nil, since_id: nil, title: nil, product_id: nil, handle: nil, updated_at_min: nil, updated_at_max: nil, published_at_min: nil, published_at_max: nil, published_status: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs ) click to toggle source
# File lib/shopify_api/rest/resources/2022_04/smart_collection.rb, line 132
def all(
  limit: nil,
  ids: nil,
  since_id: nil,
  title: nil,
  product_id: nil,
  handle: nil,
  updated_at_min: nil,
  updated_at_max: nil,
  published_at_min: nil,
  published_at_max: nil,
  published_status: nil,
  fields: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {},
    params: {limit: limit, ids: ids, since_id: since_id, title: title, product_id: product_id, handle: handle, updated_at_min: updated_at_min, updated_at_max: updated_at_max, published_at_min: published_at_min, published_at_max: published_at_max, published_status: published_status, fields: fields}.merge(kwargs).compact,
  )

  T.cast(response, T::Array[SmartCollection])
end
count( title: nil, product_id: nil, updated_at_min: nil, updated_at_max: nil, published_at_min: nil, published_at_max: nil, published_status: nil, session: ShopifyAPI::Context.active_session, **kwargs ) click to toggle source
# File lib/shopify_api/rest/resources/2022_04/smart_collection.rb, line 170
def count(
  title: nil,
  product_id: nil,
  updated_at_min: nil,
  updated_at_max: nil,
  published_at_min: nil,
  published_at_max: nil,
  published_status: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :count,
    session: session,
    ids: {},
    params: {title: title, product_id: product_id, updated_at_min: updated_at_min, updated_at_max: updated_at_max, published_at_min: published_at_min, published_at_max: published_at_max, published_status: published_status}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end
delete( id:, session: ShopifyAPI::Context.active_session ) click to toggle source
# File lib/shopify_api/rest/resources/2022_04/smart_collection.rb, line 101
def delete(
  id:,
  session: ShopifyAPI::Context.active_session
)
  request(
    http_method: :delete,
    operation: :delete,
    session: session,
    ids: {id: id},
    params: {},
  )
end
find( id:, fields: nil, session: ShopifyAPI::Context.active_session ) click to toggle source
# File lib/shopify_api/rest/resources/2022_04/smart_collection.rb, line 82
def find(
  id:,
  fields: nil,
  session: ShopifyAPI::Context.active_session
)
  result = base_find(
    session: session,
    ids: {id: id},
    params: {fields: fields},
  )
  T.cast(result[0], T.nilable(SmartCollection))
end
new(session: ShopifyAPI::Context.active_session, from_hash: nil) click to toggle source
Calls superclass method ShopifyAPI::Rest::Base::new
# File lib/shopify_api/rest/resources/2022_04/smart_collection.rb, line 19
def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)

  @rules = T.let(nil, T.nilable(T.any(T::Hash[T.untyped, T.untyped], T::Array[T.untyped])))
  @title = T.let(nil, T.nilable(String))
  @body_html = T.let(nil, T.nilable(String))
  @disjunctive = T.let(nil, T.nilable(T::Boolean))
  @handle = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @image = T.let(nil, T.nilable(T.any(String, T::Hash[T.untyped, T.untyped])))
  @published_at = T.let(nil, T.nilable(String))
  @published_scope = T.let(nil, T.nilable(String))
  @sort_order = T.let(nil, T.nilable(String))
  @template_suffix = T.let(nil, T.nilable(String))
  @updated_at = T.let(nil, T.nilable(String))

  super(session: session, from_hash: from_hash)
end

Public Instance Methods

order( products: nil, sort_order: nil, body: nil, **kwargs ) click to toggle source
# File lib/shopify_api/rest/resources/2022_04/smart_collection.rb, line 202
def order(
  products: nil,
  sort_order: nil,
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :put,
    operation: :order,
    session: @session,
    ids: {id: @id},
    params: {products: products, sort_order: sort_order}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end