Sha256: 5d0780deb7d7aa6218380c032e3f8516589f2f79818a5f939ec50d194a2928a1

Contents?: true

Size: 1.82 KB

Versions: 9

Compression:

Stored size: 1.82 KB

Contents

# frozen_string_literal: true

module Slack
  module BlockKit
    module Composition; end

    module Element; end

    module Layout; end

    module_function

    def blocks
      blocks = Blocks.new

      yield(blocks) if block_given?

      blocks
    end

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

      yield(home_surface) if block_given?

      home_surface
    end

    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: 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

    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slack-ruby-block-kit-0.26.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.25.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.24.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.23.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.22.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.21.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.20.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.19.0 lib/slack/block_kit.rb
slack-ruby-block-kit-0.18.0 lib/slack/block_kit.rb