Module: CDEKApiClient::Entities::CurrencyMapper
- Defined in:
- lib/cdek_api_client/entities/currency_mapper.rb
Overview
CurrencyMapper is a utility module that maps currency codes to their respective integer representations.
Constant Summary collapse
- CURRENCY_CODES =
{ 'RUB' => 1, 'KZT' => 2, 'USD' => 3, 'EUR' => 4, 'GBP' => 5, 'CNY' => 6, 'BYR' => 7, 'UAH' => 8, 'KGS' => 9, 'AMD' => 10, 'TRY' => 11, 'THB' => 12, 'KRW' => 13, 'AED' => 14, 'UZS' => 15, 'MNT' => 16, 'PLN' => 17, 'AZN' => 18, 'GEL' => 19, 'JPY' => 55 }.freeze
Class Method Summary collapse
-
.to_code(currency) ⇒ Integer
Converts a currency code to its corresponding integer representation.
Class Method Details
.to_code(currency) ⇒ Integer
Converts a currency code to its corresponding integer representation.
35 36 37 |
# File 'lib/cdek_api_client/entities/currency_mapper.rb', line 35 def self.to_code(currency) CURRENCY_CODES[currency] || (raise ArgumentError, "Invalid currency code: #{currency}") end |