Sha256: d4d77c3467aa548472ebd1742ec614ea28c6cb8435dfc3e912fabb7111c3cfbb

Contents?: true

Size: 909 Bytes

Versions: 11

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true

module Slack
  module BlockKit
    module Composition
      # Determines when a plain-text input element will return a block_actions
      # interaction payload.
      #
      # @param [Array] triggers - values for the `trigger_actions_on` array
      #
      # https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config
      # https://api.slack.com/reference/block-kit/block-elements#input
      class DispatchActionConfiguration
        def initialize(triggers: nil)
          @triggers = triggers || []
        end

        def trigger_on_enter_pressed
          @triggers << :on_enter_pressed
        end

        def trigger_on_character_entered
          @triggers << :on_character_entered
        end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
slack-ruby-block-kit-0.25.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.24.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.23.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.22.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.21.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.20.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.19.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.18.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.17.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.16.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb
slack-ruby-block-kit-0.15.0 lib/slack/block_kit/composition/dispatch_action_configuration.rb