Class: WhatsappSdk::Resource::InteractiveActionSectionRow

Inherits:
Object
  • Object
show all
Defined in:
lib/whatsapp_sdk/resource/interactive_action_section_row.rb

Constant Summary collapse

ACTION_SECTION_TITLE_MAXIMUM =
24
ACTION_SECTION_DESCRIPTION_MAXIMUM =
72
ACTION_SECTION_ID_MAXIMUM =
256

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, id:, description: "") ⇒ InteractiveActionSectionRow

Returns a new instance of InteractiveActionSectionRow.



26
27
28
29
30
31
# File 'lib/whatsapp_sdk/resource/interactive_action_section_row.rb', line 26

def initialize(title:, id:, description: "")
  @title = title
  @id = id
  @description = description
  validate
end

Instance Attribute Details

#descriptionObject

Returns the ActionSection description you want to send.



14
15
16
# File 'lib/whatsapp_sdk/resource/interactive_action_section_row.rb', line 14

def description
  @description
end

#idObject

Returns the ActionSection unique identifier you want to send. This ID is returned in the webhook when the section is selected by the user.



20
21
22
# File 'lib/whatsapp_sdk/resource/interactive_action_section_row.rb', line 20

def id
  @id
end

#titleObject

Returns the ActionSection title you want to send.



9
10
11
# File 'lib/whatsapp_sdk/resource/interactive_action_section_row.rb', line 9

def title
  @title
end

Instance Method Details

#to_jsonObject



33
34
35
36
37
38
39
40
41
# File 'lib/whatsapp_sdk/resource/interactive_action_section_row.rb', line 33

def to_json
  json = {
    id: id,
    title: title
  }
  json[:description] = description if description.length.positive?

  json
end