Class: Whatsapp::MessageTemplates::Component::Carousel
- Defined in:
- lib/ruby/whatsapp/message_templates/component/carousel.rb,
lib/ruby/whatsapp/message_templates/component/carousel/card.rb
Overview
A horizontally scrollable set of 2 to 10 cards, each with its own media header and buttons. Marketing templates only, which Template enforces.
The card count is fixed at creation: an approved carousel template must be sent with exactly the number of cards it was created with.
Every card must share the same structure — same header format, same button types, and body text either on all of them or none. Meta's stated reason for the body rule is keeping card heights consistent. Card#signature is what makes this checkable. Source: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/carousel-templates
Defined Under Namespace
Modules: Defaults Classes: Card
Instance Attribute Summary collapse
Attributes inherited from Base
#example_error, #parameter_format
Instance Method Summary collapse
-
#initialize(cards: []) ⇒ Carousel
constructor
A new instance of Carousel.
-
#serialize ⇒ Hash
The serialized component.
Methods inherited from Base
Methods included from ValueObject
Constructor Details
#initialize(cards: []) ⇒ Carousel
Returns a new instance of Carousel.
35 36 37 38 39 40 41 |
# File 'lib/ruby/whatsapp/message_templates/component/carousel.rb', line 35 def initialize(cards: [], **) super(**) @cards = build_cards(cards) validate! end |
Instance Attribute Details
#cards ⇒ Array<Carousel::Card>
26 27 28 |
# File 'lib/ruby/whatsapp/message_templates/component/carousel.rb', line 26 def cards @cards end |