Class: Inttegro::Money::Currency

Inherits:
T::Enum
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/money/currency.rb,
lib/inttegro/money/currency_deserialization.rb

Overview

A currency code recognized by the Inttegro API. Individual operations can support a subset of these currencies.

Use the constants below when constructing a request. #serialize returns the documented string wire value received from or sent to the API.

Class Method Summary collapse

Class Method Details

.deserialize(value) ⇒ Inttegro::Money::Currency

Decode an ISO currency code without requiring callers to normalize case or whitespace.

The returned enum still serializes to the lowercase value required by the API.

Parameters:

  • value (String) —

    currency code such as "GHS", "ghs", or " ghs "

Returns:

Raises:

  • (KeyError) —

    if the normalized code is not supported by the generated enum



18
19
20
# File 'lib/inttegro/money/currency_deserialization.rb', line 18

def deserialize(value)
  super(value.strip.downcase)
end