Class: Whatsapp::Messages::Template::Language
- Inherits:
-
Object
- Object
- Whatsapp::Messages::Template::Language
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby/whatsapp/messages/template/language.rb
Overview
Language code for template messages Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/supported-languages
Instance Attribute Summary collapse
Class Method Summary collapse
-
.serialize(code:) ⇒ Hash
Serializes the language to a hash format suitable for the WhatsApp API.
Instance Method Summary collapse
-
#initialize(code:) ⇒ Language
constructor
A new instance of Language.
-
#serialize ⇒ Hash
Serializes the language to a hash format suitable for the WhatsApp API.
Constructor Details
#initialize(code:) ⇒ Language
Returns a new instance of Language.
19 20 21 22 23 |
# File 'lib/ruby/whatsapp/messages/template/language.rb', line 19 def initialize(code:) @code = code validate! end |
Instance Attribute Details
#code ⇒ String
13 14 15 |
# File 'lib/ruby/whatsapp/messages/template/language.rb', line 13 def code @code end |
Class Method Details
.serialize(code:) ⇒ Hash
Serializes the language to a hash format suitable for the WhatsApp API.
37 38 39 |
# File 'lib/ruby/whatsapp/messages/template/language.rb', line 37 def serialize(code:) new(code:).serialize end |
Instance Method Details
#serialize ⇒ Hash
Serializes the language to a hash format suitable for the WhatsApp API.
27 28 29 30 31 |
# File 'lib/ruby/whatsapp/messages/template/language.rb', line 27 def serialize { code:, } end |