Class: Whatsapp::MessageTemplates::Button::Base

Inherits:
Object
  • Object
show all
Includes:
ValueObject
Defined in:
lib/ruby/whatsapp/message_templates/button/base.rb

Overview

Shared behaviour for every button a template can declare.

Each subclass owns its own wire type as Defaults::TYPE rather than having it supplied by the TYPES registry — a button's type is intrinsic to the button, so keeping it on the class means one source of truth for both serialization and the per-type cap checks in Component::Buttons.

Direct Known Subclasses

CopyCode, Otp, PhoneNumber, QuickReply, Url

Constant Summary collapse

MAX_TEXT_LENGTH =

Character limit shared by every button that carries a tappable label.

25

Instance Method Summary collapse

Methods included from ValueObject

included, #serialize

Instance Method Details

#api_typeString

The uppercase value Meta expects in the button's type field.

Returns:

  • (String)


20
21
22
# File 'lib/ruby/whatsapp/message_templates/button/base.rb', line 20

def api_type
  self.class::Defaults::TYPE
end