Class: MessengerClient::ButtonTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/messenger_client/button_template.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, buttons) ⇒ ButtonTemplate

Returns a new instance of ButtonTemplate.



3
4
5
6
# File 'lib/messenger_client/button_template.rb', line 3

def initialize(text, buttons)
  @text    = text
  @buttons = parse_buttons(buttons)
end

Instance Method Details

#to_jsonObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/messenger_client/button_template.rb', line 8

def to_json
  {
    attachment: {
      type: "template",
      payload: {
        template_type: "button",
        text:          @text,
        buttons:       @buttons
      }
    }
  }
end