View Source Money.ExchangeRates.Retriever (Money v5.15.2)
Implements a GenServer
to retrieve exchange rates from
a configured retrieveal module on a periodic or on demand basis.
By default exchange rates are retrieved from Open Exchange Rates.
The default period of execution is 5 minutes (300_000 milliseconds). The
period of retrieval is configured in config.exs
or the appropriate
environment configuration. For example:
config :ex_money,
retrieve_every: 300_000
Summary
Functions
Returns a specification to start this module under a supervisor.
Return the current configuration of the Exchange Rates Retrieval service
Delete the exchange rates retrieval service
Forces retrieval of historic exchange rates for a single date
Forces retrieval of historic exchange rates for a range of dates
Forces retrieval of the latest exchange rates
Updated the configuration for the Exchange Rate Service
Restart the exchange rates retrieval service
Retrieve exchange rates from an external HTTP service.
Starts the exchange rates retrieval service
Stop the exchange rates retrieval service.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Return the current configuration of the Exchange Rates Retrieval service
Delete the exchange rates retrieval service
The service can be started again with start/1
Forces retrieval of historic exchange rates for a single date
date
is a date returned byDate.new/3
or any struct with the elements:year
,:month
and:day
ora
Date.Range.t
created byDate.range/2
that specifies a range of dates to retrieve
Returns:
{:ok, rates}
if exchange rates request is successfully sent.{:error, reason}
if the request cannot be send.
Sends a message ot the exchange rate retrieval worker to request historic rates for a specified date or range be retrieved and stored.
This function does not return exchange rates, for that see
Money.ExchangeRates.latest_rates/0
or
Money.ExchangeRates.historic_rates/1
.
Forces retrieval of historic exchange rates for a range of dates
from
is a date returned byDate.new/3
or any struct with the elements:year
,:month
and:day
.to
is a date returned byDate.new/3
or any struct with the elements:year
,:month
and:day
.
Returns:
{:ok, rates}
if exchange rates request is successfully sent.{:error, reason}
if the request cannot be send.
Sends a message to the exchange rate retrieval process for each
date in the range from
..to
to request historic rates be
retrieved.
Forces retrieval of the latest exchange rates
Sends a message ot the exchange rate retrieval worker to request current rates be retrieved and stored.
Returns:
{:ok, rates}
if exchange rates request is successfully sent.{:error, reason}
if the request cannot be send.
This function does not return exchange rates, for that see
Money.ExchangeRates.latest_rates/0
or
Money.ExchangeRates.historic_rates/1
.
Updated the configuration for the Exchange Rate Service
Restart the exchange rates retrieval service
Retrieve exchange rates from an external HTTP service.
This function is primarily intended for use by an exchange rates api module.
Starts the exchange rates retrieval service
Stop the exchange rates retrieval service.
The service can be restarted with restart/0
.