class Messenger::Elements::Button

Attributes

title[RW]
type[RW]
value[RW]

Public Class Methods

new(type:, title:, value:) click to toggle source
# File lib/messenger/components/elements/button.rb, line 6
def initialize(type:, title:, value:)
  @type  = type
  @title = title
  @value = value
end

Public Instance Methods

build() click to toggle source
# File lib/messenger/components/elements/button.rb, line 12
def build
  { type: @type, title: @title }.merge! eval(@type.to_s)
end
postback() click to toggle source
# File lib/messenger/components/elements/button.rb, line 20
def postback
  { payload: @value }
end
web_url() click to toggle source
# File lib/messenger/components/elements/button.rb, line 16
def web_url
  { url: @value }
end