Class: WhatsAppCloudApi::Language
- Defined in:
- lib/whats_app_cloud_api/models/language.rb
Overview
Language Model.
Instance Attribute Summary collapse
-
#code ⇒ String
The code of the language or locale to use.
-
#policy ⇒ String
The language policy the message should follow.
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(code = nil, policy = 'deterministic') ⇒ Language
constructor
A new instance of Language.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(code = nil, policy = 'deterministic') ⇒ Language
Returns a new instance of Language.
41 42 43 44 45 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 41 def initialize(code = nil, policy = 'deterministic') @code = code unless code == SKIP @policy = policy unless policy == SKIP end |
Instance Attribute Details
#code ⇒ String
The code of the language or locale to use. Accepts both language and language_locale formats (e.g., en and en_US).
15 16 17 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 15 def code @code end |
#policy ⇒ String
The language policy the message should follow.
19 20 21 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 19 def policy @policy end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 48 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. code = hash.key?('code') ? hash['code'] : SKIP policy = hash['policy'] ||= 'deterministic' # Create object from extracted values. Language.new(code, policy) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['policy'] = 'policy' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
37 38 39 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 37 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
30 31 32 33 34 |
# File 'lib/whats_app_cloud_api/models/language.rb', line 30 def optionals %w[ policy ] end |