Class: Whatsapp::MessageTemplates::Component::Footer
- Defined in:
- lib/ruby/whatsapp/message_templates/component/footer.rb
Overview
The optional small-print line below the body. At most one per template.
Two mutually exclusive shapes, mirroring Body:
standard — `text` (60 chars, and no placeholders at all)
authentication — `code_expiration_minutes`, which renders Meta's own
localised "This code expires in N minutes." Omit the footer
entirely to omit that notice.
Forbidden altogether in limited-time-offer templates, which Template enforces. Source: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/components/
Defined Under Namespace
Modules: Defaults
Instance Attribute Summary collapse
-
#code_expiration_minutes ⇒ Integer?
Authentication templates only.
- #text ⇒ String?
Attributes inherited from Base
#example_error, #parameter_format
Instance Method Summary collapse
-
#authentication? ⇒ Boolean
Whether this is the expiry-based authentication shape.
-
#initialize(text: nil, code_expiration_minutes: nil) ⇒ Footer
constructor
A new instance of Footer.
-
#serialize ⇒ Hash
The serialized component.
Methods inherited from Base
Methods included from ValueObject
Constructor Details
#initialize(text: nil, code_expiration_minutes: nil) ⇒ Footer
Returns a new instance of Footer.
41 42 43 44 45 46 47 48 |
# File 'lib/ruby/whatsapp/message_templates/component/footer.rb', line 41 def initialize(text: nil, code_expiration_minutes: nil, **) super(**) @text = text @code_expiration_minutes = code_expiration_minutes validate! end |
Instance Attribute Details
#code_expiration_minutes ⇒ Integer?
Returns Authentication templates only.
30 31 32 |
# File 'lib/ruby/whatsapp/message_templates/component/footer.rb', line 30 def code_expiration_minutes @code_expiration_minutes end |
#text ⇒ String?
26 27 28 |
# File 'lib/ruby/whatsapp/message_templates/component/footer.rb', line 26 def text @text end |
Instance Method Details
#authentication? ⇒ Boolean
Returns Whether this is the expiry-based authentication shape.
51 52 53 |
# File 'lib/ruby/whatsapp/message_templates/component/footer.rb', line 51 def authentication? !code_expiration_minutes.nil? end |