Shopifex.Shops (Shopifex v2.2.1) View Source

This module acts as the context for any database interaction from within the Shopifex package.

Link to this section Summary

Functions

Returns an %Ecto.Changeset{} for tracking grant changes.

Returns an %Ecto.Changeset{} for tracking plan changes.

Check the webhooks set on the shop, then compare that to the required webhooks based on the current status of the shop.

Creates a grant.

Creates a plan.

Deletes a grant.

Deletes a plan.

Returns the current webhooks for a Shop from the Shopify API.

Gets a single grant.

Gets a single plan.

Returns the list of grants.

Returns the list of plans.

Returns the list of plans.

Updates a grant.

Updates a plan.

Link to this section Types

Specs

shop() :: %{access_token: String.t(), scope: String.t(), url: String.t()}

Link to this section Functions

Link to this function

change_grant(grant, attrs \\ %{})

View Source

Returns an %Ecto.Changeset{} for tracking grant changes.

Examples

iex> change_grant(grant)
%Ecto.Changeset{data: %Grant{}}
Link to this function

change_plan(plan, attrs \\ %{})

View Source

Returns an %Ecto.Changeset{} for tracking plan changes.

Examples

iex> change_plan(plan)
%Ecto.Changeset{data: %Plan{}}
Link to this function

configure_webhooks(shop)

View Source

Check the webhooks set on the shop, then compare that to the required webhooks based on the current status of the shop.

Returns a list of webhooks which were created.

Link to this function

create_grant(attrs \\ %{})

View Source

Creates a grant.

Examples

iex> create_grant(%{field: value})
{:ok, %Grant{}}

iex> create_grant(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

create_plan(attrs \\ %{})

View Source

Creates a plan.

Examples

iex> create_plan(%{field: value})
{:ok, %Plan{}}

iex> create_plan(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

create_shop_grant(shop, grants)

View Source

Deletes a grant.

Examples

iex> delete_grant(grant)
{:ok, %Grant{}}

iex> delete_grant(grant)
{:error, %Ecto.Changeset{}}

Deletes a plan.

Examples

iex> delete_plan(plan)
{:ok, %Plan{}}

iex> delete_plan(plan)
{:error, %Ecto.Changeset{}}
Link to this function

delete_webhook(shop, id)

View Source
Link to this function

get_current_webhooks(shop)

View Source

Specs

get_current_webhooks(shop :: shop()) :: {:ok, list()} | any()

Returns the current webhooks for a Shop from the Shopify API.

Returns with {:ok, webhooks} on success. Can also return any non-200 level HTTPoison response, or a Jason decode error.

Gets a single grant.

Raises Ecto.NoResultsError if the Grant does not exist.

Examples

iex> get_grant!(123)
%Grant{}

iex> get_grant!(456)
** (Ecto.NoResultsError)

Gets a single plan.

Raises Ecto.NoResultsError if the Plan does not exist.

Examples

iex> get_plan!(123)
%Plan{}

iex> get_plan!(456)
** (Ecto.NoResultsError)

Returns the list of grants.

Examples

iex> list_grants()
[%Grant{}, ...]

Returns the list of plans.

Examples

iex> list_plans()
[%Plan{}, ...]
Link to this function

list_plans_granting_guard(guard)

View Source

Returns the list of plans.

Examples

iex> list_plans()
[%Plan{}, ...]
Link to this function

update_grant(grant, attrs)

View Source

Updates a grant.

Examples

iex> update_grant(grant, %{field: new_value})
{:ok, %Grant{}}

iex> update_grant(grant, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

update_plan(plan, attrs)

View Source

Updates a plan.

Examples

iex> update_plan(plan, %{field: new_value})
{:ok, %Plan{}}

iex> update_plan(plan, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

update_shop(shop, params)

View Source