# `Money.ExchangeRates.Supervisor`
[🔗](https://github.com/kipcole9/money/blob/v6.0.0-rc.0/lib/money/exchange_rates/exchange_rates_supervisor.ex#L1)

Functions to manage the starting, stopping,
deleting and restarting of the Exchange
Rates Retriever.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `default_supervisor`

Returns the name of the default supervisor
which is `Money.Supervisor`

# `delete_retriever`

Deleted the retriever child specification from
the exchange rates supervisor.

This is primarily of use if you want to change
the configuration of the retriever after it is
stopped and before it is restarted.

In this situation the sequence of calls would be:

```
iex> Money.ExchangeRates.Retriever.stop
iex> Money.ExchangeRates.Retriever.delete
iex> Money.ExchangeRates.Retriever.start(config)
```

# `restart_retriever`

Restarts a stopped retriever.

See also `Money.ExchangeRates.Retriever.stop/0`

# `retriever_running?`

Returns a boolean indicating of the
retriever process is configured and
running

# `retriever_status`

Returns the status of the exchange rates
retriever.  The returned value is one of:

* `:running` if the service is running. In this
  state the valid action is `Money.ExchangeRates.Service.stop/0`.

* `:stopped` if it is stopped. In this state
  the valid actions are `Money.ExchangeRates.Supervisor.restart_retriever/0`
  or `Money.ExchangeRates.Supervisor.delete_retriever/0`.

* `:not_started` if it is not configured
  in the supervisor and is not running.  In
  this state the only valid action is
  `Money.ExchangeRates.Supervisor.start_retriever/1`.

# `start_link`

Starts the Exchange Rates supervisor and
optionally starts the exchange rates
retrieval service as well.

## Options

* `:restart` is a boolean value indicating
  if the supervisor is to be restarted.  This is
  typically used to move the supervisor from its
  default position under the `ex_money` supervision
  tree to a different supervision tree.  The default
  is `false`

* `:start_retriever` is a boolean indicating
  if the exchange rates retriever is to be started
  when the supervisor is started.  The default is
  defined by the configuration key
  `:auto_start_exchange_rate_service`

# `start_link`

# `start_retriever`

Starts the exchange rates retriever.

## Arguments

* `config` is a `t:Money.ExchangeRates.Config.t/0`
  struct returned by `Money.ExchangeRates.config/0`
  and adjusted as required.  The default is
  `Money.ExchangeRates.config/0`.

# `stop`

Stop the Money.ExchangeRates.Supervisor.

Unless `ex_money` is configured in `mix.exs` as
`rumtime: false`, the Money.ExchangeRates.Supervisor
is always started when `ex_money` starts even if the
config key `:auto_start_exchange_rates_service` is
set to `false`.

In some instances an application may require the
`Money.ExchangeRates.Supervisor` to be started under
a different supervision tree.  In this case it is
required to call this function first before a new
configuration is started.

One use case is when the Exchange Rates service is
configured with either an API module, a Callback module
or a Cache module which uses Ecto and therefore its
a requirement that Ecto is started first.

See the README section on "Using Ecto or other applications
from within the callback module" for an eanple of how
to configure the supervisor in this case.

# `stop_retriever`

Stop the exchange rates retriever.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
