Class: Slack::BlockKit::Element::Button
- Inherits:
-
Object
- Object
- Slack::BlockKit::Element::Button
- Defined in:
- lib/slack/block_kit/element/button.rb
Overview
An interactive element that inserts a button. The button can be a trigger for anything from opening a simple link to starting a complex workflow.
Constant Summary collapse
- TYPE =
'button'
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(text:, action_id:, style: nil, emoji: nil, url: nil, value: nil) {|_self| ... } ⇒ Button
constructor
A new instance of Button.
Methods included from Composition::ConfirmationDialog::Confirmable
#confirmation_dialog, included
Constructor Details
#initialize(text:, action_id:, style: nil, emoji: nil, url: nil, value: nil) {|_self| ... } ⇒ Button
Returns a new instance of Button.
16 17 18 19 20 21 22 23 24 |
# File 'lib/slack/block_kit/element/button.rb', line 16 def initialize(text:, action_id:, style: nil, emoji: nil, url: nil, value: nil) @text = Composition::PlainText.new(text: text, emoji: emoji) @action_id = action_id @url = url @style = style @value = value yield(self) if block_given? end |
Instance Method Details
#as_json ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/slack/block_kit/element/button.rb', line 26 def as_json(*) { type: TYPE, text: @text.as_json, action_id: @action_id, url: @url, value: @value, style: @style, confirm: confirm&.as_json }.compact end |