Class: Arafa::Whatsapp::MessageBody::Interactive::Buttons

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

Overview

Interactive buttons WhatsApp message body: {action: {buttons}, body: {text}, header: {text}}.

Instance Method Summary collapse

Instance Method Details

#to_hObject



97
98
99
100
101
# File 'lib/arafa/whatsapp/message_body.rb', line 97

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