Class: WhatsappSdk::Resource::Currency

Inherits:
Object
  • Object
show all
Defined in:
lib/whatsapp_sdk/resource/currency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fallback_value:, code:, amount:) ⇒ Currency

Returns a new instance of Currency.



21
22
23
24
25
# File 'lib/whatsapp_sdk/resource/currency.rb', line 21

def initialize(fallback_value:, code:, amount:)
  @fallback_value = fallback_value
  @code = code
  @amount = amount
end

Instance Attribute Details

#amountObject

Amount multiplied by 1000.



19
20
21
# File 'lib/whatsapp_sdk/resource/currency.rb', line 19

def amount
  @amount
end

#codeObject

Currency code as defined in ISO 4217.



14
15
16
# File 'lib/whatsapp_sdk/resource/currency.rb', line 14

def code
  @code
end

#fallback_valueObject

Returns default text if localization fails.



9
10
11
# File 'lib/whatsapp_sdk/resource/currency.rb', line 9

def fallback_value
  @fallback_value
end

Instance Method Details

#to_jsonObject



27
28
29
30
31
32
33
# File 'lib/whatsapp_sdk/resource/currency.rb', line 27

def to_json
  {
    fallback_value: fallback_value,
    code: code,
    amount_1000: amount
  }
end