Class: Whatsapp::Messages::Interactive::ListButtons
- Defined in:
- lib/ruby/whatsapp/messages/interactive/list_buttons.rb,
lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb,
lib/ruby/whatsapp/messages/interactive/list_buttons/section/row.rb
Overview
Interactive list messages allow you to present WhatsApp users with a list of options to choose from Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/interactive-list-messages
Defined Under Namespace
Modules: Defaults Classes: Section
Instance Attribute Summary collapse
Class Method Summary collapse
-
.serialize(**list_buttons) ⇒ Hash
Serialized representation of the ListButtons.
Instance Method Summary collapse
-
#initialize(button:, sections:) ⇒ ListButtons
constructor
A new instance of ListButtons.
-
#serialize ⇒ Hash
Serialized representation of the ListButtons.
Constructor Details
#initialize(button:, sections:) ⇒ ListButtons
Returns a new instance of ListButtons.
30 31 32 33 34 35 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons.rb', line 30 def initialize(button:, sections:) @button = @sections = sections validate! end |
Instance Attribute Details
#button ⇒ String
17 18 19 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons.rb', line 17 def @button end |
#sections ⇒ Array<Hash>
21 22 23 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons.rb', line 21 def sections @sections end |
Class Method Details
.serialize(**list_buttons) ⇒ Hash
Returns Serialized representation of the ListButtons. @raise [ActiveModel::ValidationError] if validation fails.
40 41 42 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons.rb', line 40 def serialize(**) new(**).serialize end |
Instance Method Details
#serialize ⇒ Hash
Returns Serialized representation of the ListButtons.
46 47 48 49 50 51 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons.rb', line 46 def serialize { button:, sections: serialized_sections, } end |