ExShopify v0.2.0 ExShopify.SmartCollection

Reader’s response to an article in a blog.

Summary

Functions

Receive a count of all smart collections

Create a new smart collection

Remove smart collection from the database

Receive a single smart collection

Receive a list of all smart collections

Set the ordering type and/or the manual order of products in a smart collection

Modify an existing smart collection

Types

smart_collection_plural()
smart_collection_plural() :: {:ok, [%ExShopify.SmartCollection{body_html: term, disjunctive: term, handle: term, id: term, image: term, published: term, published_at: term, published_scope: term, rules: term, sort_order: term, template_suffix: term, title: term, updated_at: term}], %ExShopify.Meta{api_call_limit: term}}
smart_collection_singular()
smart_collection_singular() :: {:ok, %ExShopify.SmartCollection{body_html: term, disjunctive: term, handle: term, id: term, image: term, published: term, published_at: term, published_scope: term, rules: term, sort_order: term, template_suffix: term, title: term, updated_at: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

count(session)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error
count(session, params)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error

Receive a count of all smart collections.

Examples

Count all collections

iex> ExShopify.SmartCollection.count(session)
{:ok, count, meta}
create(session, params)
create(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  smart_collection_singular |
  ExShopify.Resource.error

Create a new smart collection.

Examples

Create a new, but unpublished collection

iex> params = %{
...>   title: "Macbooks",
...>   published: false
...> }

iex> ExShopify.SmartCollection.create(session, params)
{:ok, smart_collection, meta}

Create a new collection with a base64 encoded image

iex> params = %{
...>   title: "Macbooks",
...>   image: %{ attachment: Base.encode64(File.read("path/to/image.png")) }
...> }

iex> ExShopify.SmartCollection.create(session, params)
{:ok, smart_collection, meta}

Create a new collection with an image which will be downloaded by Shopify

iex> params = %{
...>   title: "Macbooks",
...>   image: %{ src: "http://example.com/elixir_logo.gif" }
...> }

iex> ExShopify.SmartCollection.create(session, params)
{:ok, smart_collection, meta}

Create a collection of all products starting with the term IPod

iex> params = %{
...>   title: "IPods",
...>   rules: [
...>     %{
...>       column: "title",
...>       relation: "starts_with",
...>       condition: "iPod"
...>     }
...>   ]
...> }
delete(session, id)
delete(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  ExShopify.Resource.only_meta |
  ExShopify.Resource.error

Remove smart collection from the database.

Examples

iex> ExShopify.SmartCollection.delete(session, 841564295)
{:ok, meta}
find(session, id)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  smart_collection_singular |
  ExShopify.Resource.error
find(session, id, params)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  smart_collection_singular |
  ExShopify.Resource.error

Receive a single smart collection.

Examples

iex> ExShopify.SmartCollection.find(session, 482865238)
{:ok, smart_collection, meta}
list(session)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}) ::
  smart_collection_plural |
  ExShopify.Resource.error
list(session, params)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  smart_collection_plural |
  ExShopify.Resource.error

Receive a list of all smart collections.

Examples

iex> ExShopify.SmartCollection.list(session)
{:ok, smart_collections, meta}
order(session, id, params)
order(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  ExShopify.Resource.meta_only |
  ExShopify.Resource.error

Set the ordering type and/or the manual order of products in a smart collection.

Examples

iex> params = %{
...>   sort_order: "alpha-desc"
...> }

iex> ExShopify.SmartCollection.order(session, 482865238, params)
{:ok, meta}
update(session, id, params)
update(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  smart_collection_singular |
  ExShopify.Resource.error

Modify an existing smart collection.

Examples

Update a collection, clearing the collection image

iex> params = %{
...>   image: ""
...> }

iex> ExShopify.SmartCollection.update(session, 482865238, params)
{:ok, smart_collection, meta}

Change the description of the Smart iPods collection

iex> params = %{
...>   body_html: "<p>5000 songs in your pocket</p>"
...> }

iex> ExShopify.SmartCollection.update(session, 482865238, params)
{:ok, smart_collection, meta}