class MonobankApi::CurrencyConverter

Overview

Converts amounts between currencies using Monobank exchange rates

Defined in:

monobank_api/currency_converter.cr

Constant Summary

UAH_ISO = 980

Constructors

Instance Method Summary

Constructor Detail

def self.new(rates : Array(Currency)) #

Initialize converter with pre-fetched rates array


[View source]
def self.new(rates_json : String) #

Initialize converter with cached JSON string containing rates


[View source]
def self.new #

[View source]

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

[View source]