Class: Slack::BlockKit::Composition::DispatchActionConfiguration

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

Overview

Determines when a plain-text input element will return a block_actions interaction payload.

api.slack.com/reference/block-kit/composition-objects#dispatch_action_config api.slack.com/reference/block-kit/block-elements#input

Instance Method Summary collapse

Constructor Details

#initialize(triggers: nil) ⇒ DispatchActionConfiguration

Returns a new instance of DispatchActionConfiguration.



14
15
16
# File 'lib/slack/block_kit/composition/dispatch_action_configuration.rb', line 14

def initialize(triggers: nil)
  @triggers = triggers || []
end

Instance Method Details

#as_jsonObject



26
27
28
29
30
# File 'lib/slack/block_kit/composition/dispatch_action_configuration.rb', line 26

def as_json(*)
  {
    trigger_actions_on: @triggers.uniq
  }.compact
end

#trigger_on_character_enteredObject



22
23
24
# File 'lib/slack/block_kit/composition/dispatch_action_configuration.rb', line 22

def trigger_on_character_entered
  @triggers << :on_character_entered
end

#trigger_on_enter_pressedObject



18
19
20
# File 'lib/slack/block_kit/composition/dispatch_action_configuration.rb', line 18

def trigger_on_enter_pressed
  @triggers << :on_enter_pressed
end