Class: Whatsapp::MessageTemplates::Button::Otp
- Defined in:
- lib/ruby/whatsapp/message_templates/button/otp.rb,
lib/ruby/whatsapp/message_templates/button/otp/supported_app.rb
Overview
The one-time-passcode button that authentication templates are built around.
Unlike every other button, its label is not settable: Meta supplies and
localises both text and autofill_text per language. Passing either is
therefore an error rather than something silently dropped.
Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/authentication-templates
Defined Under Namespace
Modules: Defaults, OtpTypes Classes: SupportedApp
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#autofill_text ⇒ nil
Always nil — see the class comment.
- #otp_type ⇒ String
- #supported_apps ⇒ Array<Otp::SupportedApp>
-
#text ⇒ nil
Always nil — see the class comment.
- #zero_tap_terms_accepted ⇒ Boolean?
Instance Method Summary collapse
-
#initialize(otp_type:, supported_apps: [], zero_tap_terms_accepted: nil, text: nil, autofill_text: nil) ⇒ Otp
constructor
A new instance of Otp.
-
#serialize ⇒ Hash
The serialized button.
Methods inherited from Base
Methods included from ValueObject
Constructor Details
#initialize(otp_type:, supported_apps: [], zero_tap_terms_accepted: nil, text: nil, autofill_text: nil) ⇒ Otp
Returns a new instance of Otp.
69 70 71 72 73 74 75 76 77 |
# File 'lib/ruby/whatsapp/message_templates/button/otp.rb', line 69 def initialize(otp_type:, supported_apps: [], zero_tap_terms_accepted: nil, text: nil, autofill_text: nil) @otp_type = normalize_otp_type(otp_type) @supported_apps = build_supported_apps(supported_apps) @zero_tap_terms_accepted = zero_tap_terms_accepted @text = text @autofill_text = autofill_text validate! end |
Instance Attribute Details
#autofill_text ⇒ nil
Always nil — see the class comment.
55 56 57 |
# File 'lib/ruby/whatsapp/message_templates/button/otp.rb', line 55 def autofill_text @autofill_text end |
#otp_type ⇒ String
37 38 39 |
# File 'lib/ruby/whatsapp/message_templates/button/otp.rb', line 37 def otp_type @otp_type end |
#supported_apps ⇒ Array<Otp::SupportedApp>
41 42 43 |
# File 'lib/ruby/whatsapp/message_templates/button/otp.rb', line 41 def supported_apps @supported_apps end |
#text ⇒ nil
Always nil — see the class comment.
50 51 52 |
# File 'lib/ruby/whatsapp/message_templates/button/otp.rb', line 50 def text @text end |
#zero_tap_terms_accepted ⇒ Boolean?
45 46 47 |
# File 'lib/ruby/whatsapp/message_templates/button/otp.rb', line 45 def zero_tap_terms_accepted @zero_tap_terms_accepted end |