Documentation ¶
Overview ¶
Package emirates implements emirates provider related code
Index ¶
- Constants
- type ApiResponse
- type Provider
- func (p Provider) BuildEntity(endpoint string, baseCurrency string, quotedCurrency string, rate float64, ...) *entity.CurrencyRate
- func (p Provider) GetCode() string
- func (p Provider) GetConfig() model.ProviderConfig
- func (p Provider) GetHistoricalRates(serviceRequest model.RatesRequest) (model.RatesResponse, error)
- func (p Provider) GetLatestRates(serviceRequest model.RatesRequest) (model.RatesResponse, error)
- func (p Provider) GetLocation() *time.Location
- func (p Provider) GetRateGenerationTime() time.Time
- func (p Provider) GetSupportedCurrencies() []string
- func (p Provider) IsRequestValid(ratesRequest model.RatesRequest) (bool, error)
- func (p Provider) PreloadRates(dateObject time.Time, save bool) (map[string]float64, map[string]float64, time.Time, error)
Constants ¶
const Code = "emirates"
Code emirates provider code
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiResponse ¶
type Provider ¶
type Provider struct { provider.BaseProvider // contains filtered or unexported fields }
Provider implements emirates provider structure
func (Provider) BuildEntity ¶
func (p Provider) BuildEntity(endpoint string, baseCurrency string, quotedCurrency string, rate float64, rateDate time.Time, providerDate time.Time) *entity.CurrencyRate
BuildEntity builds entity with given rates
func (Provider) GetConfig ¶
func (p Provider) GetConfig() model.ProviderConfig
GetConfig returns provider config
func (Provider) GetHistoricalRates ¶
func (p Provider) GetHistoricalRates(serviceRequest model.RatesRequest) (model.RatesResponse, error)
GetHistoricalRates searches for rates in internal DB, fetch from provider API if needed and saves to internal DB
func (Provider) GetLatestRates ¶
func (p Provider) GetLatestRates(serviceRequest model.RatesRequest) (model.RatesResponse, error)
GetLatestRates provides yesterday-defined rate for today latest rate if time < 23:00
func (Provider) GetLocation ¶
GetLocation returns location for current provider
func (Provider) GetRateGenerationTime ¶
GetRateGenerationTime returns historical rates generated time on provider side
func (Provider) GetSupportedCurrencies ¶
GetSupportedCurrencies returns list of currencies, supported by provider
func (Provider) IsRequestValid ¶
func (p Provider) IsRequestValid(ratesRequest model.RatesRequest) (bool, error)
IsRequestValid validates API call to provider.