Class: Whatsapp::Messages::Interactive
- Defined in:
- lib/ruby/whatsapp/messages/interactive.rb,
lib/ruby/whatsapp/messages/interactive/base.rb,
lib/ruby/whatsapp/messages/interactive/body.rb,
lib/ruby/whatsapp/messages/interactive/footer.rb,
lib/ruby/whatsapp/messages/interactive/header.rb,
lib/ruby/whatsapp/messages/interactive/url_button.rb,
lib/ruby/whatsapp/messages/interactive/list_buttons.rb,
lib/ruby/whatsapp/messages/interactive/reply_buttons.rb,
lib/ruby/whatsapp/messages/interactive/media_carousel.rb,
lib/ruby/whatsapp/messages/interactive/product_carousel.rb,
lib/ruby/whatsapp/messages/interactive/media_carousel/card.rb,
lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb,
lib/ruby/whatsapp/messages/interactive/reply_buttons/button.rb,
lib/ruby/whatsapp/messages/interactive/product_carousel/card.rb,
lib/ruby/whatsapp/messages/interactive/list_buttons/section/row.rb,
lib/ruby/whatsapp/messages/interactive/media_carousel/card/button.rb,
lib/ruby/whatsapp/messages/interactive/media_carousel/card/button/quick_reply.rb
Defined Under Namespace
Modules: Defaults Classes: Base, Body, Footer, Header, ListButtons, MediaCarousel, ProductCarousel, ReplyButtons, UrlButton
Constant Summary collapse
- ACTION_TYPES =
Maps a public action kind to its implementing class and the WhatsApp
interactive.typevalue emitted in the payload. Resolution goes through this frozen whitelist — neverconst_geton caller input.NOTE: the carousel
api_typevalues ("carousel"/"product_list") should be verified against the Meta docs for your API version before relying on them. { reply_buttons: { klass: ReplyButtons, api_type: "button" }, list_buttons: { klass: ListButtons, api_type: "list" }, url_button: { klass: UrlButton, api_type: "cta_url" }, media_carousel: { klass: MediaCarousel, api_type: "carousel" }, product_carousel: { klass: ProductCarousel, api_type: "product_list" }, }.freeze
Instance Attribute Summary collapse
- #action ⇒ Hash
- #body ⇒ String
- #footer ⇒ Hash?
- #header ⇒ Hash?
-
#type ⇒ Symbol
The action kind (e.g. :reply_buttons, :list_buttons).
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(type:, body:, action:, header: nil, footer: nil) ⇒ Interactive
constructor
A new instance of Interactive.
-
#serialize ⇒ Hash
Serialized representation of the Interactive message.
Constructor Details
#initialize(type:, body:, action:, header: nil, footer: nil) ⇒ Interactive
Returns a new instance of Interactive.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ruby/whatsapp/messages/interactive.rb', line 55 def initialize(type:, body:, action:, header: nil, footer: nil, **) super(**) @type = type.to_sym @body = body @action = action @header = header @footer = validate! end |
Instance Attribute Details
#action ⇒ Hash
42 43 44 |
# File 'lib/ruby/whatsapp/messages/interactive.rb', line 42 def action @action end |
#body ⇒ String
34 35 36 |
# File 'lib/ruby/whatsapp/messages/interactive.rb', line 34 def body @body end |
#footer ⇒ Hash?
38 39 40 |
# File 'lib/ruby/whatsapp/messages/interactive.rb', line 38 def @footer end |
#header ⇒ Hash?
30 31 32 |
# File 'lib/ruby/whatsapp/messages/interactive.rb', line 30 def header @header end |
#type ⇒ Symbol
Returns The action kind (e.g. :reply_buttons, :list_buttons).
26 27 28 |
# File 'lib/ruby/whatsapp/messages/interactive.rb', line 26 def type @type end |