Class: Messenger::Elements::Button
- Inherits:
-
Object
- Object
- Messenger::Elements::Button
- Defined in:
- lib/messenger/components/elements/button.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(type:, title:, value:) ⇒ Button
constructor
A new instance of Button.
- #postback ⇒ Object
- #web_url ⇒ Object
Constructor Details
#initialize(type:, title:, value:) ⇒ Button
Returns a new instance of Button.
4 5 6 7 8 |
# File 'lib/messenger/components/elements/button.rb', line 4 def initialize(type:, title:, value:) @type = type @title = title @value = value end |
Instance Method Details
#build ⇒ Object
10 11 12 |
# File 'lib/messenger/components/elements/button.rb', line 10 def build { type: @type, title: @title }.merge! eval(@type.to_s) end |
#postback ⇒ Object
18 19 20 |
# File 'lib/messenger/components/elements/button.rb', line 18 def postback { payload: @value } end |
#web_url ⇒ Object
14 15 16 |
# File 'lib/messenger/components/elements/button.rb', line 14 def web_url { url: @value } end |