Class: Slack::BlockKit::Composition::ConfirmationDialog

Inherits:
Object
  • Object
show all
Defined in:
lib/slack/block_kit/composition/confirmation_dialog.rb

Overview

An object that defines a dialog that provides a confirmation step to any interactive element. This dialog will ask the user to confirm their action by offering confirm and deny buttons.

api.slack.com/reference/messaging/composition-objects#confirm

Defined Under Namespace

Modules: Confirmable

Instance Method Summary collapse

Constructor Details

#initializeConfirmationDialog

Returns a new instance of ConfirmationDialog.



28
29
30
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 28

def initialize
  @title, @confirm, @text, @style = nil
end

Instance Method Details

#as_jsonObject



68
69
70
71
72
73
74
75
76
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 68

def as_json(*)
  {
    title: @title.as_json,
    text: @text.as_json,
    confirm: @confirm.as_json,
    deny: @deny.as_json,
    style: @style
  }.compact
end

#confirm(text:, emoji: nil) ⇒ Object



38
39
40
41
42
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 38

def confirm(text:, emoji: nil)
  @confirm = PlainText.new(text: text, emoji: emoji)

  self
end

#deny(text:, emoji: nil) ⇒ Object



44
45
46
47
48
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 44

def deny(text:, emoji: nil)
  @deny = PlainText.new(text: text, emoji: emoji)

  self
end

#mrkdwn(text:, verbatim: nil) ⇒ Object



62
63
64
65
66
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 62

def mrkdwn(text:, verbatim: nil)
  @text = Mrkdwn.new(text: text, verbatim: verbatim)

  self
end

#plain_text(text:, emoji: nil) ⇒ Object



50
51
52
53
54
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 50

def plain_text(text:, emoji: nil)
  @text = PlainText.new(text: text, emoji: emoji)

  self
end

#style(value) ⇒ Object



56
57
58
59
60
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 56

def style(value)
  @style = value

  self
end

#title(text:, emoji: nil) ⇒ Object



32
33
34
35
36
# File 'lib/slack/block_kit/composition/confirmation_dialog.rb', line 32

def title(text:, emoji: nil)
  @title = PlainText.new(text: text, emoji: emoji)

  self
end