Sha256: f1c41bc74dcd4d248ee766a3df20df6e9576cb68e975dc5ea74aa088fed4e3ea

Contents?: true

Size: 847 Bytes

Versions: 2

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

module Slack
  module BlockKit
    module Layout
      class RichText
        module RichTextElements
          # https://api.slack.com/reference/block-kit/blocks#element-types
          class Channel
            include RichTextElements::StyleHelper
            TYPE = 'channel'
            VALID_STYLES = %w[bold italic strike highlight client_highlight unlink].freeze

            def initialize(channel_id:, styles: [])
              @channel_id = channel_id
              @styles = styles
              validate_styles(styles, VALID_STYLES)
            end

            def as_json(*)
              {
                type: TYPE,
                channel_id: @channel_id,
                style: styles_as_json(@styles)
              }.compact
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-ruby-block-kit-0.25.0 lib/slack/block_kit/layout/rich_text/rich_text_elements/channel.rb
slack-ruby-block-kit-0.24.0 lib/slack/block_kit/layout/rich_text/rich_text_elements/channel.rb