Class: Whatsapp::Webhook::Message::Button
- Defined in:
- lib/ruby/whatsapp/webhook/message/button.rb
Overview
An inbound tap on a template's quick-reply button.
Instance Attribute Summary collapse
-
#payload ⇒ String?
The developer-defined payload configured on the template button.
-
#text ⇒ String?
The button's display text.
Attributes inherited from Base
#context, #from, #id, #referral, #timestamp, #type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text:, payload:, **base_attributes) ⇒ Button
constructor
A new instance of Button.
Methods inherited from Base
Constructor Details
#initialize(text:, payload:, **base_attributes) ⇒ Button
Returns a new instance of Button.
16 17 18 19 20 21 |
# File 'lib/ruby/whatsapp/webhook/message/button.rb', line 16 def initialize(text:, payload:, **base_attributes) super(**base_attributes) @text = text @payload = payload end |
Instance Attribute Details
#payload ⇒ String?
Returns The developer-defined payload configured on the template button.
14 15 16 |
# File 'lib/ruby/whatsapp/webhook/message/button.rb', line 14 def payload @payload end |
#text ⇒ String?
Returns The button's display text.
10 11 12 |
# File 'lib/ruby/whatsapp/webhook/message/button.rb', line 10 def text @text end |
Class Method Details
.deserialize(data) ⇒ Button
26 27 28 |
# File 'lib/ruby/whatsapp/webhook/message/button.rb', line 26 def deserialize(data) new(text: data.dig("button", "text"), payload: data.dig("button", "payload"), **common_attributes(data)) end |