Class: WhatsappSdk::Resource::InteractiveActionSection
- Inherits:
-
Object
- Object
- WhatsappSdk::Resource::InteractiveActionSection
- Defined in:
- lib/whatsapp_sdk/resource/interactive_action_section.rb
Constant Summary collapse
- ACTION_SECTION_TITLE_MAXIMUM =
24
- ACTION_SECTION_ROWS_MAXIMUM =
10
Instance Attribute Summary collapse
-
#rows ⇒ Object
Returns the ActionSection rows you want to send.
-
#title ⇒ Object
Returns the ActionSection title you want to send.
Instance Method Summary collapse
- #add_row(row) ⇒ Object
-
#initialize(title:, rows: []) ⇒ InteractiveActionSection
constructor
A new instance of InteractiveActionSection.
- #to_json ⇒ Object
- #validate(skip_rows: false) ⇒ Object
Constructor Details
#initialize(title:, rows: []) ⇒ InteractiveActionSection
23 24 25 26 27 |
# File 'lib/whatsapp_sdk/resource/interactive_action_section.rb', line 23 def initialize(title:, rows: []) @title = title @rows = rows validate(skip_rows: true) end |
Instance Attribute Details
#rows ⇒ Object
Returns the ActionSection rows you want to send.
14 15 16 |
# File 'lib/whatsapp_sdk/resource/interactive_action_section.rb', line 14 def rows @rows end |
#title ⇒ Object
Returns the ActionSection title you want to send.
9 10 11 |
# File 'lib/whatsapp_sdk/resource/interactive_action_section.rb', line 9 def title @title end |
Instance Method Details
#add_row(row) ⇒ Object
16 17 18 |
# File 'lib/whatsapp_sdk/resource/interactive_action_section.rb', line 16 def add_row(row) @rows << row end |
#to_json ⇒ Object
29 30 31 32 33 34 |
# File 'lib/whatsapp_sdk/resource/interactive_action_section.rb', line 29 def to_json { title: title, rows: rows.map(&:to_json) } end |
#validate(skip_rows: false) ⇒ Object
36 37 38 39 |
# File 'lib/whatsapp_sdk/resource/interactive_action_section.rb', line 36 def validate(skip_rows: false) validate_title validate_rows unless skip_rows end |