Moneybirx.Contact (Moneybirx v0.1.8) View Source
Moneybird Contacts
See Moneybird's API Documentation for more info.
Link to this section Summary
Functions
Lists all Contacts in the Administration.
Parameters
page
,Integer
– The page number.per_page
,Integer
– Amount of contacts per page (max 100).query
,String
– Search terms. See below for a list of fields being searched.
Examples
iex> Moneybirx.Contact.all()
{:ok, [
%Moneybirx.Contact{
id: "264861044949649118",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "",
lastname: "",
address1: "Hoofdstraat 12",
address2: "",
zipcode: "1234AB",
city: "Amsterdam",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "3",
tax_number: "",
chamber_of_commerce: "",
bank_account: "",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: false,
sepa_iban: "",
sepa_iban_account_name: "",
sepa_bic: "",
sepa_mandate_id: "",
sepa_mandate_date: nil,
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.675Z",
updated_at: "2019-08-26T09:19:57.675Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/682edb346851c5a612c6292e8415174369af854274bae742cdfcc649da2b6914/all",
},
%Moneybirx.Contact{
id: "264861044858423000",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "John",
lastname: "Appleseed",
address1: "Hoofdstraat 12",
address2: "",
zipcode: "1234 AB",
city: "Amsterdam",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "1",
tax_number: "",
chamber_of_commerce: "",
bank_account: "",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: false,
sepa_iban: "",
sepa_iban_account_name: "",
sepa_bic: "",
sepa_mandate_id: "",
sepa_mandate_date: nil,
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.588Z",
updated_at: "2019-08-26T09:19:57.588Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/e0a3d1d96784a6fe490e29b24b3fc9f40f0a57bb3786912ac67d3b9983f3043b/all",
},
%Moneybirx.Contact{
id: "264861044912948955",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "John",
lastname: "Doe",
address1: "1 Infinite Loop",
address2: "",
zipcode: "123456",
city: "Redmond",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "2",
tax_number: "",
chamber_of_commerce: "",
bank_account: "NL50TEST0166567191",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: true,
sepa_iban: "NL50TEST0166567191",
sepa_iban_account_name: "Foobar Holding B.V.",
sepa_bic: "RABONL2U",
sepa_mandate_id: "MAN12313",
sepa_mandate_date: "2014-01-01",
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.639Z",
updated_at: "2019-08-26T09:19:57.639Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/d4f20db01b1aafe2f1f1fcb5b56adb1592958feb3e2dce4e1d98d2ecd3df7e3b/all",
}
]}
Search Query
Searching for contacts can be done by providing the query parameter with search terms. The API searches for matches in the following contact fields
Create a Contact.
Issues a DELETE request to the given url.
Issues a DELETE request to the given url, raising an exception in case of failure.
Find a Contact by it's id
.
Issues a GET request to the given url.
Issues a GET request to the given url, raising an exception in case of failure.
Issues a HEAD request to the given url.
Issues a HEAD request to the given url, raising an exception in case of failure.
Issues an OPTIONS request to the given url.
Issues a OPTIONS request to the given url, raising an exception in case of failure.
Issues a PATCH request to the given url.
Issues a PATCH request to the given url, raising an exception in case of failure.
Issues a POST request to the given url.
Issues a POST request to the given url, raising an exception in case of failure.
Callback implementation for HTTPoison.Base.process_headers/1
.
Callback implementation for HTTPoison.Base.process_request_body/1
.
Callback implementation for HTTPoison.Base.process_request_headers/1
.
Callback implementation for HTTPoison.Base.process_request_options/1
.
Callback implementation for HTTPoison.Base.process_request_params/1
.
Callback implementation for HTTPoison.Base.process_request_url/1
.
Callback implementation for HTTPoison.Base.process_response/1
.
Callback implementation for HTTPoison.Base.process_response_body/1
.
Callback implementation for HTTPoison.Base.process_response_chunk/1
.
Callback implementation for HTTPoison.Base.process_response_headers/1
.
Callback implementation for HTTPoison.Base.process_response_status_code/1
.
Callback implementation for HTTPoison.Base.process_status_code/1
.
Callback implementation for HTTPoison.Base.process_url/1
.
Issues a PUT request to the given url.
Issues a PUT request to the given url, raising an exception in case of failure.
Issues an HTTP request using a Request
struct.
Issues an HTTP request with the given method to the given url.
Issues an HTTP request with the given method to the given url, raising an exception in case of failure.
Starts HTTPoison and its dependencies.
Requests the next message to be streamed for a given HTTPoison.AsyncResponse
.
Link to this section Types
Specs
body() :: HTTPoison.Base.body()
Specs
headers() :: HTTPoison.Base.headers()
Specs
method() :: HTTPoison.Base.method()
Specs
options() :: HTTPoison.Base.options()
Specs
params() :: HTTPoison.Base.params()
Specs
request() :: HTTPoison.Base.request()
Specs
url() :: HTTPoison.Base.url()
Link to this section Functions
Lists all Contacts in the Administration.
Parameters
page
,Integer
– The page number.per_page
,Integer
– Amount of contacts per page (max 100).query
,String
– Search terms. See below for a list of fields being searched.
Examples
iex> Moneybirx.Contact.all()
{:ok, [
%Moneybirx.Contact{
id: "264861044949649118",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "",
lastname: "",
address1: "Hoofdstraat 12",
address2: "",
zipcode: "1234AB",
city: "Amsterdam",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "3",
tax_number: "",
chamber_of_commerce: "",
bank_account: "",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: false,
sepa_iban: "",
sepa_iban_account_name: "",
sepa_bic: "",
sepa_mandate_id: "",
sepa_mandate_date: nil,
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.675Z",
updated_at: "2019-08-26T09:19:57.675Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/682edb346851c5a612c6292e8415174369af854274bae742cdfcc649da2b6914/all",
},
%Moneybirx.Contact{
id: "264861044858423000",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "John",
lastname: "Appleseed",
address1: "Hoofdstraat 12",
address2: "",
zipcode: "1234 AB",
city: "Amsterdam",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "1",
tax_number: "",
chamber_of_commerce: "",
bank_account: "",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: false,
sepa_iban: "",
sepa_iban_account_name: "",
sepa_bic: "",
sepa_mandate_id: "",
sepa_mandate_date: nil,
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.588Z",
updated_at: "2019-08-26T09:19:57.588Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/e0a3d1d96784a6fe490e29b24b3fc9f40f0a57bb3786912ac67d3b9983f3043b/all",
},
%Moneybirx.Contact{
id: "264861044912948955",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "John",
lastname: "Doe",
address1: "1 Infinite Loop",
address2: "",
zipcode: "123456",
city: "Redmond",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "2",
tax_number: "",
chamber_of_commerce: "",
bank_account: "NL50TEST0166567191",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: true,
sepa_iban: "NL50TEST0166567191",
sepa_iban_account_name: "Foobar Holding B.V.",
sepa_bic: "RABONL2U",
sepa_mandate_id: "MAN12313",
sepa_mandate_date: "2014-01-01",
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.639Z",
updated_at: "2019-08-26T09:19:57.639Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/d4f20db01b1aafe2f1f1fcb5b56adb1592958feb3e2dce4e1d98d2ecd3df7e3b/all",
}
]}
Search Query
Searching for contacts can be done by providing the query parameter with search terms. The API searches for matches in the following contact fields:
company_name
attention
firstname
lastname
address1
address2
zipcode
city
country
email
phone
customer_id
tax_number
chamber_of_commerce
bank_account
iex> Moneybirx.Contact.all(%{query: "appleseed"}) {:ok, [
%Moneybirx.Contact{ si_identifier: "", email_ubl: true, version: 1_566_811_197, sepa_iban_account_name: "", estimate_workflow_id: nil, city: "Amsterdam", chamber_of_commerce: "", credit_card_reference: "", credit_card_number: "", tax_number_valid: nil, send_invoices_to_attention: "", sepa_active: false, administration_id: 123, company_name: "Foobar Holding B.V.", tax_number: "", send_estimates_to_email: "info@example.com", attention: "", send_invoices_to_email: "info@example.com", email: "info@example.com", sepa_mandate_date: nil, delivery_method: "Email", bank_account: "", invoice_workflow_id: nil, phone: "", tax_number_validated_at: nil, sepa_mandate_id: "", sepa_bic: "", sepa_sequence_type: "RCUR", credit_card_type: nil, send_estimates_to_attention: "", address2: "", si_identifier_type: nil, country: "NL", sepa_iban: "", address1: "Hoofdstraat 12", customer_id: "1", zipcode: "1234 AB", created_at: "2019-08-26T09:19:57.588Z", sales_invoices_url: "http://moneybird.dev/123/sales_invoices/e0a3d1d96784a6fe490e29b24b3fc9f40f0a57bb3786912ac67d3b9983f3043b/all", updated_at: "2019-08-26T09:19:57.588Z", firstname: "John", id: "264861044858423000", lastname: "Appleseed" }
]}
Create a Contact.
Examples
iex> Moneybirx.Contact.create(%{"company_name" => "Test B.V."})
{:ok, %Moneybirx.Contact{
attention: "",
sepa_iban_account_name: "",
sales_invoices_url:
"http://moneybird.dev/123/sales_invoices/236de183d032318bb60f9f8b05181ea80fd695ea67aeb0f8792f39651bcd4574/all",
customer_id: "3",
city: "",
si_identifier_type: nil,
id: "264861050065651551",
estimate_workflow_id: nil,
firstname: "",
zipcode: "",
send_estimates_to_attention: "",
address2: "",
sepa_sequence_type: "RCUR",
chamber_of_commerce: "",
administration_id: 123,
sepa_bic: "",
created_at: "2019-08-26T09:20:02.581Z",
phone: "",
tax_number: "",
email_ubl: true,
company_name: "Test B.V.",
tax_number_valid: nil,
credit_card_type: nil,
sepa_iban: "",
si_identifier: "",
invoice_workflow_id: nil,
sepa_mandate_date: nil,
credit_card_number: "",
tax_number_validated_at: nil,
address1: "",
send_invoices_to_attention: "",
email: "",
lastname: "",
country: "NL",
updated_at: "2019-08-26T09:20:02.581Z",
credit_card_reference: "",
bank_account: "",
delivery_method: "Email",
send_invoices_to_email: "",
sepa_active: false,
version: 1_566_811_202,
send_estimates_to_email: "",
sepa_mandate_id: ""
}}
Specs
delete(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a DELETE request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
delete!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a DELETE request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Find a Contact by it's id
.
Examples
iex> Moneybirx.Contact.find("264861044858423000")
{:ok, %Moneybirx.Contact{
id: "264861044858423000",
administration_id: 123,
company_name: "Foobar Holding B.V.",
firstname: "John",
lastname: "Appleseed",
address1: "Hoofdstraat 12",
address2: "",
zipcode: "1234 AB",
city: "Amsterdam",
country: "NL",
phone: "",
delivery_method: "Email",
customer_id: "1",
tax_number: "",
chamber_of_commerce: "",
bank_account: "",
attention: "",
email: "info@example.com",
email_ubl: true,
send_invoices_to_attention: "",
send_invoices_to_email: "info@example.com",
send_estimates_to_attention: "",
send_estimates_to_email: "info@example.com",
sepa_active: false,
sepa_iban: "",
sepa_iban_account_name: "",
sepa_bic: "",
sepa_mandate_id: "",
sepa_mandate_date: nil,
sepa_sequence_type: "RCUR",
credit_card_number: "",
credit_card_reference: "",
credit_card_type: nil,
tax_number_validated_at: nil,
tax_number_valid: nil,
invoice_workflow_id: nil,
estimate_workflow_id: nil,
si_identifier: "",
si_identifier_type: nil,
created_at: "2019-08-26T09:19:57.588Z",
updated_at: "2019-08-26T09:19:57.588Z",
version: 1566811197,
sales_invoices_url: "http://moneybird.dev/123/sales_invoices/e0a3d1d96784a6fe490e29b24b3fc9f40f0a57bb3786912ac67d3b9983f3043b/all",
}}
Specs
get(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a GET request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
get!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a GET request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
head(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a HEAD request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
head!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a HEAD request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
options(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues an OPTIONS request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
options!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a OPTIONS request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
patch(binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a PATCH request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
patch!(binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a PATCH request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
post(binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a POST request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
post!(binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a POST request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
Callback implementation for HTTPoison.Base.process_headers/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_body/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_headers/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_options/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_params/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_url/1
.
Specs
process_response(HTTPoison.Base.response()) :: any()
Callback implementation for HTTPoison.Base.process_response/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_body/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_chunk/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_headers/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_status_code/1
.
Specs
Callback implementation for HTTPoison.Base.process_status_code/1
.
Specs
Callback implementation for HTTPoison.Base.process_url/1
.
Specs
put(binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a PUT request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
put!(binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a PUT request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
request(HTTPoison.Request.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues an HTTP request using a Request
struct.
This function returns {:ok, response}
or {:ok, async_response}
if the
request is successful, {:error, reason}
otherwise.
Examples
request = %HTTPoison.Request{
method: :post,
url: "https://my.website.com",
body: "{\"foo\": 3}",
headers: [{"Accept", "application/json"}]
}
request(request)
Specs
request(method(), binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues an HTTP request with the given method to the given url.
This function is usually used indirectly by get/3
, post/4
, put/4
, etc
Args:
method
- HTTP method as an atom (:get
,:head
,:post
,:put
,:delete
, etc.)url
- target url as a binary string or char listbody
- request body. See more belowheaders
- HTTP headers as an orddict (e.g.,[{"Accept", "application/json"}]
)options
- Keyword list of options
Body: see type HTTPoison.Request
Options: see type HTTPoison.Request
This function returns {:ok, response}
or {:ok, async_response}
if the
request is successful, {:error, reason}
otherwise.
Examples
request(:post, "https://my.website.com", "{\"foo\": 3}", [{"Accept", "application/json"}])
Specs
request!(method(), binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues an HTTP request with the given method to the given url, raising an exception in case of failure.
request!/5
works exactly like request/5
but it returns just the
response in case of a successful request, raising an exception in case the
request fails.
Starts HTTPoison and its dependencies.
Specs
stream_next(HTTPoison.AsyncResponse.t()) :: {:ok, HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Requests the next message to be streamed for a given HTTPoison.AsyncResponse
.
See request!/5
for more detailed information.