Class: Whatsapp::Messages::Interactive::ListButtons::Section
- Inherits:
-
Object
- Object
- Whatsapp::Messages::Interactive::ListButtons::Section
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb,
lib/ruby/whatsapp/messages/interactive/list_buttons/section/row.rb
Defined Under Namespace
Modules: Defaults Classes: Row
Instance Attribute Summary collapse
Class Method Summary collapse
-
.serialize(**section) ⇒ Hash
Serialized representation of the Section.
Instance Method Summary collapse
-
#initialize(title:, rows:) ⇒ Section
constructor
A new instance of Section.
-
#serialize ⇒ Hash
Serialized representation of the Section.
Constructor Details
#initialize(title:, rows:) ⇒ Section
Returns a new instance of Section.
30 31 32 33 34 35 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb', line 30 def initialize(title:, rows:) @title = title @rows = rows validate! end |
Instance Attribute Details
#rows ⇒ Array<Hash>
22 23 24 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb', line 22 def rows @rows end |
#title ⇒ String
18 19 20 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb', line 18 def title @title end |
Class Method Details
.serialize(**section) ⇒ Hash
Returns Serialized representation of the Section. @raise [ActiveModel::ValidationError] if validation fails.
40 41 42 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb', line 40 def serialize(**section) new(**section).serialize end |
Instance Method Details
#serialize ⇒ Hash
Returns Serialized representation of the Section.
46 47 48 49 50 51 |
# File 'lib/ruby/whatsapp/messages/interactive/list_buttons/section.rb', line 46 def serialize { title:, rows: serialized_rows, } end |