currency_conversion v1.0.0-alpha.1 CurrencyConversion behaviour View Source
Module to Convert Currencies.
CurrencyConversion is a wrapper around the currency conversion. We can define an
implementation as follows:
defmodule MyApp.CurrencyConversion do
use CurrencyConversion, otp_app: :my_app
end
Where the configuration for the Converter must be in your application environment,
usually defined in your config/config.exs:
config :my_app, MyApp.CurrencyConversion,
source: MyApp.CurrencyConversion.Source.CustomSource
If your application was generated with a supervisor (by passing --sup to mix new)
you will have a lib/my_app/application.ex file containing the application start
callback that defines and starts your supervisor. You just need to edit the start/2
function to start the converter as a supervisor on your application's supervisor:
def start(_type, _args) do
children = [
{MyApp.CurrencyConversion, []}
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end