Class: Whatsapp::MessageTemplates::Component::LimitedTimeOffer
- Defined in:
- lib/ruby/whatsapp/message_templates/component/limited_time_offer.rb
Overview
The offer banner that turns a marketing template into a limited-time offer, optionally with a live countdown timer.
Its presence changes the rules for the rest of the template: a footer becomes forbidden, the body drops to 600 characters, the header narrows to image or video, and the category must be MARKETING. Those are all cross-component rules, so Template enforces them.
The expiry timestamp itself is not set here — it is supplied per message when
sending, as expiration_time_ms. This component only declares that the
template has one.
Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/marketing-templates/limited-time-offer-templates
Defined Under Namespace
Modules: Defaults
Instance Attribute Summary collapse
Attributes inherited from Base
#example_error, #parameter_format
Instance Method Summary collapse
-
#initialize(text:, has_expiration: nil) ⇒ LimitedTimeOffer
constructor
A new instance of LimitedTimeOffer.
-
#serialize ⇒ Hash
The serialized component.
Methods inherited from Base
Methods included from ValueObject
Constructor Details
#initialize(text:, has_expiration: nil) ⇒ LimitedTimeOffer
Returns a new instance of LimitedTimeOffer.
38 39 40 41 42 43 44 45 |
# File 'lib/ruby/whatsapp/message_templates/component/limited_time_offer.rb', line 38 def initialize(text:, has_expiration: nil, **) super(**) @text = text @has_expiration = has_expiration validate! end |
Instance Attribute Details
#has_expiration ⇒ Boolean?
30 31 32 |
# File 'lib/ruby/whatsapp/message_templates/component/limited_time_offer.rb', line 30 def has_expiration @has_expiration end |
#text ⇒ String
26 27 28 |
# File 'lib/ruby/whatsapp/message_templates/component/limited_time_offer.rb', line 26 def text @text end |