Class: Messenger::Templates::Buttons

Inherits:
Object
  • Object
show all
Includes:
Components::Attachment
Defined in:
lib/messenger/components/templates/buttons.rb

Constant Summary collapse

ATTRIBUTES =
%w(template_type text buttons).freeze

Instance Attribute Summary collapse

Attributes included from Components::Attachment

#type

Instance Method Summary collapse

Methods included from Components::Attachment

#all_attributes, #allowed_attribute?, #build, #build_elements, #payload

Constructor Details

#initialize(text:, buttons:) ⇒ Buttons

Returns a new instance of Buttons.



12
13
14
15
16
17
# File 'lib/messenger/components/templates/buttons.rb', line 12

def initialize(text:, buttons:)
  @type          = 'template'
  @template_type = 'button'
  @text          = text
  @buttons       = build_elements(buttons)
end

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



8
9
10
# File 'lib/messenger/components/templates/buttons.rb', line 8

def buttons
  @buttons
end

#template_typeObject

Returns the value of attribute template_type.



8
9
10
# File 'lib/messenger/components/templates/buttons.rb', line 8

def template_type
  @template_type
end

#textObject

Returns the value of attribute text.



8
9
10
# File 'lib/messenger/components/templates/buttons.rb', line 8

def text
  @text
end