class
MonobankApi::CurrencyConverter
- MonobankApi::CurrencyConverter
- Reference
- Object
Overview
Converts amounts between currencies using Monobank exchange rates
Defined in:
monobank_api/currency_converter.crConstant Summary
-
UAH_ISO =
980
Constructors
-
.new(rates : Array(Currency))
Initialize converter with pre-fetched rates array
-
.new(rates_json : String)
Initialize converter with cached JSON string containing rates
- .new
Instance Method Summary
-
#convert(amount : Number, from_code : String, to_code : String) : Float64
Convert amount from one currency to another using ISO 4217 alpha codes
Constructor Detail
Initialize converter with pre-fetched rates array
Instance Method Detail
def convert(amount : Number, from_code : String, to_code : String) : Float64
#
Convert amount from one currency to another using ISO 4217 alpha codes
converter = MonobankApi::CurrencyConverter.new
converter.convert(100, "USD", "EUR")