FortnoxEx.Models.Contract (FortnoxEx v0.1.0) View Source

Link to this section Summary

Functions

Creates an invoice for a contract

Increases the invoice count for a contract, without creating an invoice

Gets a list of partial contract objects with pagination information.

Streams a partial contract objects. Will go through each page of results with a delay between page. The stream will produce a single contract data object for each hit.

Link to this section Functions

Link to this function

create_contract(client, contract_data)

View Source

Creates a contract

Examples

iex> create_contract(client, %{"Name" => "ACME") {:ok, %{"DocumentNumber" => "1", "Name" => "ACME"}}

iex> create_contract(client, contract_attrs)

Link to this function

create_invoice_for_contract(client, contract_number)

View Source

Creates an invoice for a contract

Examples

iex> create_invoice_for_contract(client, "1")

iex> create_invoice_for_contract(client, "missing")

Link to this function

delete_contract(client, contract_number)

View Source

Deletes a contract

Examples

iex> delete_contract(client, "1") :ok

iex> delete_contract(client, "missing")

Link to this function

finish_contract(client, contract_number)

View Source

Finishes a contract

Examples

iex> finish_contract(client, "1")

iex> finish_contract(client, "missing")

Link to this function

get_contract(client, contract_number)

View Source

Gets a contract

Examples

iex> get_contract(client, "1")

iex> get_contract(clientm "1")

Link to this function

increase_invoice_count_for_contract(client, contract_number)

View Source

Increases the invoice count for a contract, without creating an invoice

Examples

iex> increase_invoice_count_for_contract(client, "1")

iex> increase_invoice_count_for_contract(client, "missing")

Link to this function

list_contracts(client, query)

View Source

Gets a list of partial contract objects with pagination information.

Examples

iex> list_contracts(client, []) {:ok, %{"@CurrentPage" => 1, "@TotalPages" => 1, "@TotalResources" => 1}, [%{"DocumentNumber" => "1", "Name" => "ACME"}]}

iex> list_contracts(client, [])

Link to this function

stream_contracts(client, query)

View Source

Streams a partial contract objects. Will go through each page of results with a delay between page. The stream will produce a single contract data object for each hit.

Examples

iex> stream_contracts(client, []) stream_of_contracts

iex> stream_contracts(client, [])

Link to this function

update_contract(client, contract_number, contract_data)

View Source

Updates a contract

Examples

iex> update_contract(client, "1", %{"Name" => "Johnny"})

iex> update_contract(clientm "1", contract_attrs)