Integrate.Specification (IntegrateDB v0.1.0) View Source

The Specification context.

Link to this section Summary

Functions

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

Deletes a spec.

Gets either the claims or the notifications spec for a given stakeholder.

Gets a single spec.

Initialises a spec.

Returns the list of specs.

Sets the claims or notifications spec for a given stakeholder.

Re-sync the spec claims for all stakeholders.

Updates a spec.

Link to this section Functions

Link to this function

change_spec(spec, attrs \\ %{})

View Source

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

Examples

iex> change_spec(spec)
%Ecto.Changeset{data: %Spec{}}
Link to this function

create_spec(stakeholder, attrs)

View Source

Creates a spec.

Examples

iex> create_spec(stakeholder, %{field: value})
{:ok, %Spec{}}

iex> create_spec(stakeholder, %{field: bad_value})
{:error, %Ecto.Changeset{}}

Deletes a spec.

Examples

iex> delete_spec(spec)
{:ok, %Spec{}}

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

get_spec(stakeholder, type)

View Source

Gets either the claims or the notifications spec for a given stakeholder.

Examples

iex> get_spec(%Stakeholder{}, :claims)
%Spec{type: "CLAIMS"}

iex> get_spec(%Stakeholder{}, :notifications)
nil

Gets a single spec.

Raises Ecto.NoResultsError if the Spec does not exist.

Examples

iex> get_spec!(123)
%Spec{}

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

Initialises a spec.

Examples

iex> init_spec(%{field: value})
%Ecto.Changeset{}

Returns the list of specs.

Examples

iex> list_specs()
[%Spec{}, ...]
Link to this function

set_spec(stakeholder, type, attrs)

View Source

Sets the claims or notifications spec for a given stakeholder.

Examples

iex> set_spec(%Stakeholder{}, :claims, attrs)
{:ok, %{spec: %Spec{} = spec}}

iex> set_spec(%Stakeholder{}, :claims, %{field: bad_value})
{:error, :spec, %Ecto.Changeset{}}

Re-sync the spec claims for all stakeholders.

Examples

iex> sync_specs()
:ok

iex> sync_specs()
{:error, error}
Link to this function

update_spec(spec, attrs)

View Source

Updates a spec.

Examples

iex> update_spec(spec, %{field: new_value})
{:ok, %Spec{}}

iex> update_spec(spec, %{field: bad_value})
{:error, %Ecto.Changeset{}}