Module: Slack::BlockKit

Defined in:
lib/slack/block_kit.rb,
lib/slack/block_kit/blocks.rb,
lib/slack/block_kit/version.rb,
lib/slack/block_kit/formatting.rb,
lib/slack/block_kit/layout/image.rb,
lib/slack/block_kit/layout/input.rb,
lib/slack/block_kit/layout/video.rb,
lib/slack/block_kit/element/image.rb,
lib/slack/block_kit/layout/header.rb,
lib/slack/block_kit/element/button.rb,
lib/slack/block_kit/layout/actions.rb,
lib/slack/block_kit/layout/context.rb,
lib/slack/block_kit/layout/divider.rb,
lib/slack/block_kit/layout/section.rb,
lib/slack/block_kit/layout/rich_text.rb,
lib/slack/block_kit/composition/mrkdwn.rb,
lib/slack/block_kit/composition/option.rb,
lib/slack/block_kit/element/checkboxes.rb,
lib/slack/block_kit/element/datepicker.rb,
lib/slack/block_kit/element/timepicker.rb,
lib/slack/block_kit/element/number_input.rb,
lib/slack/block_kit/element/users_select.rb,
lib/slack/block_kit/element/overflow_menu.rb,
lib/slack/block_kit/element/radio_buttons.rb,
lib/slack/block_kit/element/static_select.rb,
lib/slack/block_kit/composition/plain_text.rb,
lib/slack/block_kit/element/datetimepicker.rb,
lib/slack/block_kit/element/url_text_input.rb,
lib/slack/block_kit/element/channels_select.rb,
lib/slack/block_kit/element/external_select.rb,
lib/slack/block_kit/composition/option_group.rb,
lib/slack/block_kit/element/email_text_input.rb,
lib/slack/block_kit/element/plain_text_input.rb,
lib/slack/block_kit/element/multi_users_select.rb,
lib/slack/block_kit/element/multi_static_select.rb,
lib/slack/block_kit/element/conversations_select.rb,
lib/slack/block_kit/element/multi_channels_select.rb,
lib/slack/block_kit/element/multi_external_select.rb,
lib/slack/block_kit/composition/confirmation_dialog.rb,
lib/slack/block_kit/composition/conversation_filter.rb,
lib/slack/block_kit/layout/rich_text/rich_text_list.rb,
lib/slack/block_kit/layout/rich_text/rich_text_quote.rb,
lib/slack/block_kit/element/multi_conversations_select.rb,
lib/slack/block_kit/layout/rich_text/rich_text_section.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements.rb,
lib/slack/block_kit/layout/section/multi_select_elements.rb,
lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/link.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/text.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/user.rb,
lib/slack/block_kit/composition/dispatch_action_configuration.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/emoji.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/channel.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/usergroup.rb,
lib/slack/block_kit/layout/rich_text/rich_text_elements/style_helper.rb

Defined Under Namespace

Modules: Composition, Element, Formatting, Layout Classes: Blocks

Constant Summary collapse

VERSION =
'0.24.0'

Class Method Summary collapse

Class Method Details

.blocks {|blocks| ... } ⇒ Object

Yields:



13
14
15
16
17
18
19
# File 'lib/slack/block_kit.rb', line 13

def blocks
  blocks = Blocks.new

  yield(blocks) if block_given?

  blocks
end

.home(blocks: nil, private_metadata: nil, callback_id: nil, external_id: nil) {|home_surface| ... } ⇒ Object

Yields:

  • (home_surface)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/slack/block_kit.rb', line 21

def home(blocks: nil,
         private_metadata: nil, callback_id: nil, external_id: nil)
  home_surface = Slack::Surfaces::Home.new(blocks: blocks,
                                           private_metadata: ,
                                           callback_id: callback_id,
                                           external_id: external_id)

  yield(home_surface) if block_given?

  home_surface
end

.message(blocks: nil, channel: nil, thread_ts: nil, as_user: nil, text: nil) {|message_surface| ... } ⇒ Object

Yields:

  • (message_surface)


50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/slack/block_kit.rb', line 50

def message(blocks: nil, channel: nil, thread_ts: nil, as_user: nil, text: nil)
  message_surface = Slack::Surfaces::Message.new(
    blocks: blocks,
    channel: channel,
    thread_ts: thread_ts,
    text: text,
    as_user: as_user
  )

  yield(message_surface) if block_given?

  message_surface
end

Yields:

  • (modal_surface)


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/slack/block_kit.rb', line 33

def modal(title: nil,
          blocks: nil,
          private_metadata: nil, callback_id: nil, external_id: nil,
          clear_on_close: nil, notify_on_close: nil)
  modal_surface = Slack::Surfaces::Modal.new(title: title,
                                             blocks: blocks,
                                             private_metadata: ,
                                             callback_id: callback_id,
                                             external_id: external_id,
                                             clear_on_close: clear_on_close,
                                             notify_on_close: notify_on_close)

  yield(modal_surface) if block_given?

  modal_surface
end