Sha256: afcf5d73369082de8830c4ad021348a6c4959f2a3e5859b127801165ee70ebc6

Contents?: true

Size: 861 Bytes

Versions: 2

Compression:

Stored size: 861 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 Usergroup
            include RichTextElements::StyleHelper
            TYPE = 'usergroup'
            VALID_STYLES = %w[bold italic strike highlight client_highlight unlink].freeze

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

            def as_json(*)
              {
                type: TYPE,
                usergroup_id: @usergroup_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/usergroup.rb
slack-ruby-block-kit-0.24.0 lib/slack/block_kit/layout/rich_text/rich_text_elements/usergroup.rb