Class: WhatsAppCloudApi::Currency
- Defined in:
- lib/whats_app_cloud_api/models/currency.rb
Overview
Currency Model.
Instance Attribute Summary collapse
-
#amount_1000 ⇒ Integer
Amount multiplied by 1000.
-
#code ⇒ String
Currency code as defined in ISO 4217.
-
#fallback_value ⇒ String
Default text if localization fails.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(fallback_value = nil, code = nil, amount_1000 = nil) ⇒ Currency
constructor
A new instance of Currency.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(fallback_value = nil, code = nil, amount_1000 = nil) ⇒ Currency
Returns a new instance of Currency.
43 44 45 46 47 48 49 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 43 def initialize(fallback_value = nil, code = nil, amount_1000 = nil) @fallback_value = fallback_value unless fallback_value == SKIP @code = code unless code == SKIP @amount_1000 = amount_1000 unless amount_1000 == SKIP end |
Instance Attribute Details
#amount_1000 ⇒ Integer
Amount multiplied by 1000.
22 23 24 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 22 def amount_1000 @amount_1000 end |
#code ⇒ String
Currency code as defined in ISO 4217.
18 19 20 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 18 def code @code end |
#fallback_value ⇒ String
Default text if localization fails.
14 15 16 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 14 def fallback_value @fallback_value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 52 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. fallback_value = hash.key?('fallback_value') ? hash['fallback_value'] : SKIP code = hash.key?('code') ? hash['code'] : SKIP amount_1000 = hash.key?('amount_1000') ? hash['amount_1000'] : SKIP # Create object from extracted values. Currency.new(fallback_value, code, amount_1000) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['fallback_value'] = 'fallback_value' @_hash['code'] = 'code' @_hash['amount_1000'] = 'amount_1000' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 39 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
34 35 36 |
# File 'lib/whats_app_cloud_api/models/currency.rb', line 34 def optionals [] end |