mailgun_ex v0.2.7 MailgunEx.Opts View Source
Generate API options based on overwritten values, as well as any configured defaults.
Please refer to MailgunEx
for more details on configuring this library,
the know what can be configured.
Link to this section Summary
Functions
Lookup all application env values for :mailgun_ex
Lookup the key
within the :mailgun_ex
application
Merge the provided_opts
with the configured options from the
:mailgun_ex
application env, available from MailgunEx.Opts.env/0
Merge the provided_opts
with an env configured_key
. Or, merge those
provided_opts
with the default application envs in MailgunEx.Opts.env/0
,
but only provide values for the expected_keys
Merge the provided_opts
with the configured_opts
. Only provide
values for the expected_keys
(if nil
then merge all keys from
configured_opts
)
Link to this section Functions
Lookup all application env values for :mailgun_ex
Example
# Return all environment variables for :mailgun_ex
MailgunEx.Opts.env()
Lookup the key
within the :mailgun_ex
application.
Example
# Return the `:mailgun_ex` value for the `:domain` key
MailgunEx.Opts.env(:domain)
Merge the provided_opts
with the configured options from the
:mailgun_ex
application env, available from MailgunEx.Opts.env/0
Example
MailgunEx.Opts.merge([resource: "messages"])
Merge the provided_opts
with an env configured_key
. Or, merge those
provided_opts
with the default application envs in MailgunEx.Opts.env/0
,
but only provide values for the expected_keys
.
Example
# Merge the provided keyword list with the Application env for `:mailgun_ex`
# but only take the `expected_keys` of `[:base, :domain, :resource]`
MailgunEx.Opts.merge([resource: "messages"], [:base, :domain, :resource])
# Merge the provided keyword list with the `:http_opts` from the
# Application env for `:mailgun_ex`
MailgunEx.Opts.merge([resource: "messages"], :http_opts)
Merge the provided_opts
with the configured_opts
. Only provide
values for the expected_keys
(if nil
then merge all keys from
configured_opts
).
Example
iex> MailgunEx.Opts.merge(
...> [resource: "messages"],
...> [base: "https://api.mailgun.net/v4", resource: "log", timeout: 5000],
...> [:resource, :base])
[base: "https://api.mailgun.net/v4", resource: "messages"]
iex> MailgunEx.Opts.merge(
...> [resource: "messages"],
...> [base: "https://api.mailgun.net/v4", resource: "log", timeout: 5000],
...> nil)
[base: "https://api.mailgun.net/v4", timeout: 5000, resource: "messages"]