Class: Arafa::Whatsapp::MessageBody::Interactive::List

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/arafa/whatsapp/message_body.rb

Overview

Interactive list WhatsApp message body: {action: {button, sections}, body: {text}, header: {text}, footer: {text}}.

Instance Method Summary collapse

Instance Method Details

#to_hObject



113
114
115
116
117
118
# File 'lib/arafa/whatsapp/message_body.rb', line 113

def to_h
  body = { action: { button: button, sections: sections.map(&:to_h) }, body: { text: body_text } }
  body[:header] = { text: header_text } unless header_text.nil?
  body[:footer] = { text: footer_text } unless footer_text.nil?
  body
end