Class: WhatsappSdk::Resource::Interactive
- Inherits:
-
Object
- Object
- WhatsappSdk::Resource::Interactive
- Defined in:
- lib/whatsapp_sdk/resource/interactive.rb
Defined Under Namespace
Modules: Type
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the interactive action.
-
#body ⇒ Object
Returns the interactive body.
-
#footer ⇒ Object
Returns the interactive footer if present.
-
#header ⇒ Object
Returns the interactive header if present.
-
#type ⇒ Object
Returns the Interactive type of message you want to send.
Instance Method Summary collapse
-
#initialize(type:, body:, action:, header: nil, footer: nil) ⇒ Interactive
constructor
A new instance of Interactive.
- #to_json ⇒ Object
Constructor Details
#initialize(type:, body:, action:, header: nil, footer: nil) ⇒ Interactive
Returns a new instance of Interactive.
38 39 40 41 42 43 44 45 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 38 def initialize(type:, body:, action:, header: nil, footer: nil) @type = type @body = body @action = action @header = header @footer = validate end |
Instance Attribute Details
#action ⇒ Object
Returns the interactive action.
36 37 38 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 36 def action @action end |
#body ⇒ Object
Returns the interactive body.
26 27 28 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 26 def body @body end |
#footer ⇒ Object
Returns the interactive footer if present.
31 32 33 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 31 def @footer end |
#header ⇒ Object
Returns the interactive header if present. Required for type product_list.
21 22 23 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 21 def header @header end |
#type ⇒ Object
Returns the Interactive type of message you want to send.
16 17 18 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 16 def type @type end |
Instance Method Details
#to_json ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/whatsapp_sdk/resource/interactive.rb', line 47 def to_json json = { type: type } json[:header] = header.to_json if header json[:body] = body.to_json json[:footer] = .to_json if json[:action] = action.to_json json end |