Class: Slack::BlockKit::Layout::RichText::RichTextElements::Channel

Inherits:
Object
  • Object
show all
Includes:
StyleHelper
Defined in:
lib/slack/block_kit/layout/rich_text/rich_text_elements/channel.rb

Overview

Constant Summary collapse

TYPE =
'channel'
VALID_STYLES =
%w[bold italic strike highlight client_highlight unlink].freeze

Instance Method Summary collapse

Methods included from StyleHelper

#styles_as_json, #validate_styles

Constructor Details

#initialize(channel_id:, styles: []) ⇒ Channel

Returns a new instance of Channel.



14
15
16
17
18
# File 'lib/slack/block_kit/layout/rich_text/rich_text_elements/channel.rb', line 14

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

Instance Method Details

#as_jsonObject



20
21
22
23
24
25
26
# File 'lib/slack/block_kit/layout/rich_text/rich_text_elements/channel.rb', line 20

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