Class: LockstepSdk::CurrencyModel

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/models/currency_model.rb

Overview

Represents an ISO-4217 currency code definition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CurrencyModel

Initialize the CurrencyModel using the provided prototype



26
27
28
29
30
31
32
# File 'lib/lockstep_sdk/models/currency_model.rb', line 26

def initialize(params = {})
    @alpha_code = params.dig(:alpha_code)
    @numeric_code = params.dig(:numeric_code)
    @currency_name = params.dig(:currency_name)
    @minor_unit = params.dig(:minor_unit)
    @symbol = params.dig(:symbol)
end

Instance Attribute Details

#alpha_codeString

Returns Alphabetic code for the given currency.

Returns:

  • (String)

    Alphabetic code for the given currency



35
36
37
# File 'lib/lockstep_sdk/models/currency_model.rb', line 35

def alpha_code
  @alpha_code
end

#currency_nameString

Returns Name of currency.

Returns:

  • (String)

    Name of currency



39
40
41
# File 'lib/lockstep_sdk/models/currency_model.rb', line 39

def currency_name
  @currency_name
end

#minor_unitInt32

Returns Number of places after the decimal for this currency.

Returns:

  • (Int32)

    Number of places after the decimal for this currency



41
42
43
# File 'lib/lockstep_sdk/models/currency_model.rb', line 41

def minor_unit
  @minor_unit
end

#numeric_codeString

Returns Numeric code for the given currency.

Returns:

  • (String)

    Numeric code for the given currency



37
38
39
# File 'lib/lockstep_sdk/models/currency_model.rb', line 37

def numeric_code
  @numeric_code
end

#symbolString

Returns Symbol for the given currency.

Returns:

  • (String)

    Symbol for the given currency



43
44
45
# File 'lib/lockstep_sdk/models/currency_model.rb', line 43

def symbol
  @symbol
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



46
47
48
49
50
51
52
53
54
# File 'lib/lockstep_sdk/models/currency_model.rb', line 46

def as_json(options={})
    {
        'alphaCode' => @alpha_code,
        'numericCode' => @numeric_code,
        'currencyName' => @currency_name,
        'minorUnit' => @minor_unit,
        'symbol' => @symbol,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



57
58
59
# File 'lib/lockstep_sdk/models/currency_model.rb', line 57

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end