Akd v0.2.4 FreshbooksApiClient.Api View Source
This is an Example API (that can also be used to get started). If you have a need for multiple API credentials, you can create one API module per domain.
See the FreshbooksApiClient.ApiBase for available methods.
Configuration:
config :freshbooks_api_client, FreshbooksApiClient.Api,
caller: FreshbooksApiClient.Caller.HttpXml,
token: System.get_env("FRESHBOOKS_API_TOKEN"),
subdomain: System.get_env("FRESHBOOKS_API_SUBDOMAIN")
(prod.exs) config :freshbooks_api_client, FreshbooksApiClient.Api,
caller: FreshbooksApiClient.Caller.HttpXml,
load_from_system_env: true
NOTE: In Production (with runtime configuration) you must call FreshbooksApiClient.Api.init() before using the client. A Supervisor is a great place to do that! For example:
defmodule YourApplication.Supervisor do
use Supervisor
def start_link(opts) do
Supervisor.start_link(__MODULE__, ..., opts)
end
def init(...) do
FreshbooksApiClient.Api.init()
children = [
...
]
Supervisor.init(children, strategy: :one_for_one)
end
end
Usage:
FreshbooksApiClient.Api.list(FreshbooksApiClient.Interface.Clients)