class

MonobankApi::CurrencyConverter

Inherits Reference < Object

Converts amounts between currencies using Monobank exchange rates

Constants

UAH_ISO = 980

Constructors

new(rates : Array(Currency))

Initialize converter with pre-fetched rates array

Source
new(rates_json : String)

Initialize converter with cached JSON string containing rates

Source

Instance methods

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")
Source