Class: Geckoboard::MoneyField

Inherits:
OptionalField show all
Defined in:
lib/geckoboard/field_types.rb

Instance Attribute Summary collapse

Attributes inherited from OptionalField

#optional

Attributes inherited from Field

#id, #name

Instance Method Summary collapse

Constructor Details

#initialize(id, currency_code: nil, **options) ⇒ MoneyField

Returns a new instance of MoneyField.

Raises:

  • (ArgumentError)


58
59
60
61
62
63
# File 'lib/geckoboard/field_types.rb', line 58

def initialize(id, currency_code: nil, **options)
  raise ArgumentError, "`currency_code:' is a required argument" if currency_code.nil?

  super(id, **options)
  @currency_code = currency_code
end

Instance Attribute Details

#currency_codeObject (readonly)

Returns the value of attribute currency_code.



56
57
58
# File 'lib/geckoboard/field_types.rb', line 56

def currency_code
  @currency_code
end

Instance Method Details

#to_hashObject



65
66
67
# File 'lib/geckoboard/field_types.rb', line 65

def to_hash
  super.merge(type: :money, currency_code: currency_code)
end