Class: Whatsapp::MessageTemplates::Component::Base
- Inherits:
-
Object
- Object
- Whatsapp::MessageTemplates::Component::Base
- Includes:
- ValueObject
- Defined in:
- lib/ruby/whatsapp/message_templates/component/base.rb
Overview
Shared behaviour for every component a template can declare.
Holds the template's parameter_format, which every component accepts even
though only Header and Body use it. Uniformity is deliberate: .build can then thread the format down without knowing which components care,
and carousel cards can pass it on to their own nested components.
Each subclass owns its wire type as Defaults::TYPE, so the TYPES
registry maps kind to class only and there is one source of truth.
Instance Attribute Summary collapse
-
#example_error ⇒ Object
readonly
Returns the value of attribute example_error.
-
#parameter_format ⇒ String
See ParameterFormats.
Instance Method Summary collapse
-
#api_type ⇒ String
The uppercase value Meta expects in the component's
typefield. -
#initialize(parameter_format: ParameterFormats::POSITIONAL) ⇒ Base
constructor
A new instance of Base.
Methods included from ValueObject
Constructor Details
#initialize(parameter_format: ParameterFormats::POSITIONAL) ⇒ Base
Returns a new instance of Base.
32 33 34 |
# File 'lib/ruby/whatsapp/message_templates/component/base.rb', line 32 def initialize(parameter_format: ParameterFormats::POSITIONAL) @parameter_format = ParameterFormats.normalize(parameter_format) end |
Instance Attribute Details
#example_error ⇒ Object (readonly)
Returns the value of attribute example_error.
26 27 28 |
# File 'lib/ruby/whatsapp/message_templates/component/base.rb', line 26 def example_error @example_error end |
#parameter_format ⇒ String
Returns see ParameterFormats.
20 21 22 |
# File 'lib/ruby/whatsapp/message_templates/component/base.rb', line 20 def parameter_format @parameter_format end |
Instance Method Details
#api_type ⇒ String
The uppercase value Meta expects in the component's type field.
38 39 40 |
# File 'lib/ruby/whatsapp/message_templates/component/base.rb', line 38 def api_type self.class::Defaults::TYPE end |