Shopifex.Shops (Shopifex v2.2.2) 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
Link to this section Functions
Returns an %Ecto.Changeset{}
for tracking grant changes.
Examples
iex> change_grant(grant)
%Ecto.Changeset{data: %Grant{}}
Returns an %Ecto.Changeset{}
for tracking plan changes.
Examples
iex> change_plan(plan)
%Ecto.Changeset{data: %Plan{}}
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.
Creates a grant.
Examples
iex> create_grant(%{field: value})
{:ok, %Grant{}}
iex> create_grant(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Creates a plan.
Examples
iex> create_plan(%{field: value})
{:ok, %Plan{}}
iex> create_plan(%{field: bad_value})
{:error, %Ecto.Changeset{}}
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{}}
Specs
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{}, ...]
Returns the list of plans.
Examples
iex> list_plans()
[%Plan{}, ...]
Updates a grant.
Examples
iex> update_grant(grant, %{field: new_value})
{:ok, %Grant{}}
iex> update_grant(grant, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Updates a plan.
Examples
iex> update_plan(plan, %{field: new_value})
{:ok, %Plan{}}
iex> update_plan(plan, %{field: bad_value})
{:error, %Ecto.Changeset{}}