Optional convenience for building a TreasuryPrime.Client from
application configuration / environment variables, instead of constructing
one by hand at every call site.
This is entirely optional — TreasuryPrime.Client.new/1 works completely
independently of this module. Use whichever fits your application better.
Application config
# config/runtime.exs
config :treasury_prime,
api_key_id: System.fetch_env!("TREASURY_PRIME_KEY_ID"),
api_key_value: System.fetch_env!("TREASURY_PRIME_KEY_VALUE"),
environment: :sandboxThen, anywhere in your application:
client = TreasuryPrime.Config.client()
TreasuryPrime.Account.get(client, "acct_123")Any option accepted by TreasuryPrime.Client.new/1 can be set this way.
You can also override individual options at call time:
TreasuryPrime.Config.client(environment: :production)
Summary
Functions
Builds a TreasuryPrime.Client from the :treasury_prime application
environment, merged with (and overridden by) any overrides passed in.
Functions
@spec client(keyword()) :: TreasuryPrime.Client.t()
Builds a TreasuryPrime.Client from the :treasury_prime application
environment, merged with (and overridden by) any overrides passed in.