abstract class Money::Currency::RateProvider

Included Modules

Direct Known Subclasses

Defined in:

money/currency/rate_provider.cr
money/currency/rate_provider/error.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]

Class Method Detail

def self.find(name : String | Symbol) : RateProvider.class #

Returns the rate provider class for the given name if found, raises UnknownRateProviderError otherwise.


[View source]
def self.find?(name : String | Symbol) : RateProvider.class | Nil #

Returns the rate provider class for the given name if found, nil otherwise.


[View source]
def self.registry #

All registered rate providers.


[View source]

Instance Method Detail

abstract def base_currency_codes : Array(String) #

Returns an array of supported base currency codes.


[View source]
abstract def exchange_rate?(base : Currency, target : Currency) : Rate | Nil #

Returns the exchange rate between base and target currency, or nil if not found.


[View source]
def supports_currency_pair?(base : Currency, target : Currency) : Bool #

Returns true if the provider supports the given currency pair.


[View source]
def target_currency_codes : Array(String) #

Returns an array of supported target currency codes.


[View source]