Ibanity.PontoConnect.Synchronization (ibanity v1.0.0)
Synchronization API wrapper
Link to this section Summary
Functions
Same as create/2, but :attributes
and :token
must be set in request.
Link to this section Functions
Link to this function
create(request)
Same as create/2, but :attributes
and :token
must be set in request.
examples
Examples
Attributes
iex> attributes = [
...> resource_id: "88099509-ce43-4a49-ba98-115af962d96d",
...> subtype: "accountDetails",
...> customer_ip_address: "123.123.123.123"
...> ]
Set attributes and token to create a synchronization
iex> attributes
...> |> Ibanity.Request.attributes()
...> |> Ibanity.Request.token(token)
...> |> Ibanity.PontoConnect.Synchronization.create()
{:ok, %Ibanity.PontoConnect.Synchronization{id: "f92fc927-7c39-48c1-aa4b-2820efbfed00"}}
Link to this function
create(request_or_token, attrs)
Creates a new synchronization resource.
Note that at this moment it only supports account
as resource type.
Returns {:ok, synchronization}
if successful, {:error, reason}
otherwise.
example
Example
Attributes
iex> attributes = [
...> resource_id: "88099509-ce43-4a49-ba98-115af962d96d",
...> subtype: "accountDetails",
...> customer_ip_address: "123.123.123.123"
...> ]
With request
iex> attributes
...> |> Ibanity.Request.attributes()
...> |> Ibanity.Request.token(token)
...> |> Ibanity.PontoConnect.Synchronization.create()
{:ok, %Ibanity.PontoConnect.Synchronization{id: "f92fc927-7c39-48c1-aa4b-2820efbfed00"}}
With token
iex> Ibanity.PontoConnect.Synchronization.create(token, attributes)
{:ok, %Ibanity.PontoConnect.Synchronization{id: "f92fc927-7c39-48c1-aa4b-2820efbfed00"}}
Link to this function
find(request_or_token, id)
Takes a Ibanity.PontoConnect.Token
, or a Ibanity.Request
with set :token
as first argument, and a Synchronization
ID as second argument.
examples
Examples
iex> token
...> |> Ibanity.PontoConnect.Synchronization.find("953934eb-229a-4fd2-8675-07794078cc7d")
{:ok, %Ibanity.PontoConnect.Synchronization{id: "953934eb-229a-4fd2-8675-07794078cc7d"}}
iex> token
...> |> Ibanity.Request.token()
...> |> Ibanity.Request.application(:my_application)
...> |> Ibanity.PontoConnect.Synchronization.find("953934eb-229a-4fd2-8675-07794078cc7d")
{:ok, %Ibanity.PontoConnect.Synchronization{id: "953934eb-229a-4fd2-8675-07794078cc7d"}}
iex> Ibanity.PontoConnect.Synchronization.find(token, "does-not-exist")
{:error,
[
%{
"code" => "resourceNotFound",
"detail" => "The requested resource was not found.",
"meta" => %{
"requestId" => "00077F00000184847F0000011F4066E44223327005A",
"resource" => "synchronization"
}
}
]}