slack-ruby-block-kit 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -9
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +21 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +18 -18
- data/README.md +0 -2
- data/lib/slack/block_kit/element/channels_select.rb +4 -2
- data/lib/slack/block_kit/element/conversations_select.rb +8 -2
- data/lib/slack/block_kit/element/datetimepicker.rb +40 -0
- data/lib/slack/block_kit/element/email_text_input.rb +48 -0
- data/lib/slack/block_kit/element/multi_conversations_select.rb +5 -2
- data/lib/slack/block_kit/element/number_input.rb +62 -0
- data/lib/slack/block_kit/element/url_text_input.rb +49 -0
- data/lib/slack/block_kit/layout/actions.rb +7 -4
- data/lib/slack/block_kit/layout/input.rb +50 -7
- data/lib/slack/block_kit/layout/section/multi_select_elements.rb +4 -2
- data/lib/slack/block_kit/layout/section.rb +7 -4
- data/lib/slack/block_kit/version.rb +1 -1
- metadata +11 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bc7d017312a1b9050129594164e9b4eff6516df696e52a72eeced5b434a862d
|
|
4
|
+
data.tar.gz: c6b04c9e520b33be39ef4efcf492b798e70558ae61024e137eb71ecac3fdb9d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5aa13638ce2aad5b93175bd66b16320533693e81e20f3ec95df4f6c916f85da31c47d15aec93933b79b2d3d34da320588036e32666baa5b18bb5c81f3c4cd89d
|
|
7
|
+
data.tar.gz: 6a2c6f5fbb5e7447069d421e1ec9cb99d44b4eec3f62b49a6df34e31b27336e2a12fd7f870398baafbdabc87b50d881d9c2537e121164d7e7ed7adbbe6249c14
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -6,9 +6,6 @@ on:
|
|
|
6
6
|
pull_request:
|
|
7
7
|
branches: [ master ]
|
|
8
8
|
|
|
9
|
-
env:
|
|
10
|
-
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
|
|
11
|
-
|
|
12
9
|
jobs:
|
|
13
10
|
build:
|
|
14
11
|
runs-on: ubuntu-latest
|
|
@@ -16,7 +13,7 @@ jobs:
|
|
|
16
13
|
strategy:
|
|
17
14
|
fail-fast: false
|
|
18
15
|
matrix:
|
|
19
|
-
ruby: [ '2.6', '2.7', '3.0' ]
|
|
16
|
+
ruby: [ '2.6', '2.7', '3.0', '3.1' ]
|
|
20
17
|
experimental: [ false ]
|
|
21
18
|
name: Ruby ${{ matrix.ruby }}
|
|
22
19
|
steps:
|
|
@@ -24,11 +21,7 @@ jobs:
|
|
|
24
21
|
- uses: ruby/setup-ruby@v1
|
|
25
22
|
with:
|
|
26
23
|
ruby-version: ${{ matrix.ruby }}
|
|
27
|
-
- run: curl https://deepsource.io/cli | sh
|
|
28
24
|
- run: gem install bundler:2.1.4
|
|
29
25
|
- run: bundle install
|
|
30
|
-
- run: bundle exec rubocop
|
|
31
26
|
- run: bundle exec rspec --format progress
|
|
32
|
-
- run:
|
|
33
|
-
# don't run on forks which don't have access to DEEPSOURCE_DSN
|
|
34
|
-
if: (env.DEEPSOURCE_DSN != '') && (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
|
|
27
|
+
- run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -25,6 +25,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
25
25
|
### Security
|
|
26
26
|
- N/A
|
|
27
27
|
|
|
28
|
+
## [0.22.0] - 2023-08-5
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- Added `Slack::BlockKit::Element::NumberInput` (#169 by @CGA1123)
|
|
32
|
+
- Added `response_url_enabled` parameter to following elements (#171 by @rinasergeeva):
|
|
33
|
+
- `Slack::BlockKit::Element::ChannelsSelect`
|
|
34
|
+
- `Slack::BlockKit::Element::ConversationsSelect`
|
|
35
|
+
- Added `default_to_current_conversation` parameter to following elements (#171 by @rinasergeeva):
|
|
36
|
+
- `Slack::BlockKit::Element::ConversationsSelect`
|
|
37
|
+
- `Slack::BlockKit::Element::MultiConversationsSelect`
|
|
38
|
+
|
|
39
|
+
## [0.21.0] - 2023-02-19
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- `Slack::BlockKit::Element::UrlTextInput` (#164 by @dimerman)
|
|
43
|
+
- `Slack::BlockKit::Element::EmailTextInput` (#166 by @CGA1123)
|
|
44
|
+
- `Slack::BlockKit::Element::Datetimepicker` (#167 by @CGA1123)
|
|
45
|
+
|
|
28
46
|
## [0.20.0] - 2022-09-25
|
|
29
47
|
|
|
30
48
|
### Added
|
|
@@ -155,7 +173,9 @@ This release contains a breaking change on the `Layout::Actions` interface.
|
|
|
155
173
|
- Fixed initial options in multi select blocks (#46 by @caalberts)
|
|
156
174
|
|
|
157
175
|
|
|
158
|
-
[Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.
|
|
176
|
+
[Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.22.0...HEAD
|
|
177
|
+
[0.22.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.21.0...v0.22.0
|
|
178
|
+
[0.21.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.20.0...v0.21.0
|
|
159
179
|
[0.20.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.19.0...v0.20.0
|
|
160
180
|
[0.19.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.18.0...v0.19.0
|
|
161
181
|
[0.18.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.17.0...v0.18.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
slack-ruby-block-kit (0.
|
|
4
|
+
slack-ruby-block-kit (0.22.0)
|
|
5
5
|
zeitwerk (~> 2.6)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -14,7 +14,7 @@ GEM
|
|
|
14
14
|
diff-lcs (1.5.0)
|
|
15
15
|
docile (1.4.0)
|
|
16
16
|
dotenv (2.8.1)
|
|
17
|
-
faraday (1.10.
|
|
17
|
+
faraday (1.10.3)
|
|
18
18
|
faraday-em_http (~> 1.0)
|
|
19
19
|
faraday-em_synchrony (~> 1.0)
|
|
20
20
|
faraday-excon (~> 1.1)
|
|
@@ -38,31 +38,31 @@ GEM
|
|
|
38
38
|
faraday-rack (1.0.0)
|
|
39
39
|
faraday-retry (1.0.3)
|
|
40
40
|
method_source (1.0.0)
|
|
41
|
-
multipart-post (2.
|
|
41
|
+
multipart-post (2.3.0)
|
|
42
42
|
parallel (1.22.1)
|
|
43
43
|
parser (3.1.2.0)
|
|
44
44
|
ast (~> 2.4.1)
|
|
45
|
-
pry (0.14.
|
|
45
|
+
pry (0.14.2)
|
|
46
46
|
coderay (~> 1.1)
|
|
47
47
|
method_source (~> 1.0)
|
|
48
48
|
rainbow (3.1.1)
|
|
49
49
|
rake (13.0.6)
|
|
50
50
|
regexp_parser (2.3.1)
|
|
51
51
|
rexml (3.2.5)
|
|
52
|
-
rspec (3.
|
|
53
|
-
rspec-core (~> 3.
|
|
54
|
-
rspec-expectations (~> 3.
|
|
55
|
-
rspec-mocks (~> 3.
|
|
56
|
-
rspec-core (3.
|
|
57
|
-
rspec-support (~> 3.
|
|
58
|
-
rspec-expectations (3.
|
|
52
|
+
rspec (3.12.0)
|
|
53
|
+
rspec-core (~> 3.12.0)
|
|
54
|
+
rspec-expectations (~> 3.12.0)
|
|
55
|
+
rspec-mocks (~> 3.12.0)
|
|
56
|
+
rspec-core (3.12.0)
|
|
57
|
+
rspec-support (~> 3.12.0)
|
|
58
|
+
rspec-expectations (3.12.0)
|
|
59
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
60
|
-
rspec-support (~> 3.
|
|
61
|
-
rspec-mocks (3.
|
|
60
|
+
rspec-support (~> 3.12.0)
|
|
61
|
+
rspec-mocks (3.12.0)
|
|
62
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
63
|
-
rspec-support (~> 3.
|
|
64
|
-
rspec-support (3.
|
|
65
|
-
rspec_junit_formatter (0.
|
|
63
|
+
rspec-support (~> 3.12.0)
|
|
64
|
+
rspec-support (3.12.0)
|
|
65
|
+
rspec_junit_formatter (0.6.0)
|
|
66
66
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
67
67
|
rubocop (1.28.2)
|
|
68
68
|
parallel (~> 1.10)
|
|
@@ -88,7 +88,7 @@ GEM
|
|
|
88
88
|
simplecov-html (0.12.3)
|
|
89
89
|
simplecov_json_formatter (0.1.3)
|
|
90
90
|
unicode-display_width (2.1.0)
|
|
91
|
-
zeitwerk (2.6.
|
|
91
|
+
zeitwerk (2.6.11)
|
|
92
92
|
|
|
93
93
|
PLATFORMS
|
|
94
94
|
ruby
|
|
@@ -102,7 +102,7 @@ DEPENDENCIES
|
|
|
102
102
|
pry (~> 0.14)
|
|
103
103
|
rake (~> 13)
|
|
104
104
|
rspec (~> 3)
|
|
105
|
-
rspec_junit_formatter (~> 0.
|
|
105
|
+
rspec_junit_formatter (~> 0.6)
|
|
106
106
|
rubocop (~> 1)
|
|
107
107
|
rubocop-rake (~> 0.6)
|
|
108
108
|
rubocop-rspec (~> 2)
|
data/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
[](https://badge.fury.io/rb/slack-ruby-block-kit)
|
|
2
2
|
[](https://codecov.io/gh/CGA1123/slack-ruby-block-kit)
|
|
3
|
-
[](https://deepsource.io/gh/CGA1123/slack-ruby-block-kit/?ref=repository-badge)
|
|
4
|
-
[](https://deepsource.io/gh/CGA1123/slack-ruby-block-kit/?ref=repository-badge)
|
|
5
3
|
|
|
6
4
|
# Slack::BlockKit
|
|
7
5
|
|
|
@@ -17,11 +17,12 @@ module Slack
|
|
|
17
17
|
|
|
18
18
|
TYPE = 'channels_select'
|
|
19
19
|
|
|
20
|
-
def initialize(placeholder:, action_id:, initial: nil, emoji: nil, focus_on_load: nil)
|
|
20
|
+
def initialize(placeholder:, action_id:, initial: nil, emoji: nil, focus_on_load: nil, response_url_enabled: nil)
|
|
21
21
|
@placeholder = Composition::PlainText.new(text: placeholder, emoji: emoji)
|
|
22
22
|
@action_id = action_id
|
|
23
23
|
@initial_channel = initial
|
|
24
24
|
@focus_on_load = focus_on_load
|
|
25
|
+
@response_url_enabled = response_url_enabled
|
|
25
26
|
|
|
26
27
|
yield(self) if block_given?
|
|
27
28
|
end
|
|
@@ -33,7 +34,8 @@ module Slack
|
|
|
33
34
|
action_id: @action_id,
|
|
34
35
|
focus_on_load: @focus_on_load,
|
|
35
36
|
initial_channel: @initial_channel,
|
|
36
|
-
confirm: confirm&.as_json
|
|
37
|
+
confirm: confirm&.as_json,
|
|
38
|
+
response_url_enabled: @response_url_enabled
|
|
37
39
|
}.compact
|
|
38
40
|
end
|
|
39
41
|
end
|
|
@@ -23,13 +23,17 @@ module Slack
|
|
|
23
23
|
action_id:,
|
|
24
24
|
initial: nil,
|
|
25
25
|
emoji: nil,
|
|
26
|
-
focus_on_load: nil
|
|
26
|
+
focus_on_load: nil,
|
|
27
|
+
default_to_current_conversation: nil,
|
|
28
|
+
response_url_enabled: nil
|
|
27
29
|
)
|
|
28
30
|
@placeholder = Composition::PlainText.new(text: placeholder, emoji: emoji)
|
|
29
31
|
@action_id = action_id
|
|
30
32
|
@initial_conversation = initial
|
|
31
33
|
@focus_on_load = focus_on_load
|
|
32
34
|
@filter = nil
|
|
35
|
+
@default_to_current_conversation = default_to_current_conversation
|
|
36
|
+
@response_url_enabled = response_url_enabled
|
|
33
37
|
|
|
34
38
|
yield(self) if block_given?
|
|
35
39
|
end
|
|
@@ -54,7 +58,9 @@ module Slack
|
|
|
54
58
|
focus_on_load: @focus_on_load,
|
|
55
59
|
initial_conversation: @initial_conversation,
|
|
56
60
|
confirm: confirm&.as_json,
|
|
57
|
-
filter: @filter&.as_json
|
|
61
|
+
filter: @filter&.as_json,
|
|
62
|
+
default_to_current_conversation: @default_to_current_conversation,
|
|
63
|
+
response_url_enabled: @response_url_enabled
|
|
58
64
|
}.compact
|
|
59
65
|
end
|
|
60
66
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Slack
|
|
4
|
+
module BlockKit
|
|
5
|
+
module Element
|
|
6
|
+
# An element that allows the selection of both a date and a time of day
|
|
7
|
+
# formatted as a UNIX timestamp.
|
|
8
|
+
#
|
|
9
|
+
# On desktop clients, the time picker will take the form of a dropdown
|
|
10
|
+
# list and the date picker will take the form of a dropdown calendar.
|
|
11
|
+
# Both options will have free-text entry for precise choices. On mobile
|
|
12
|
+
# clients, the time picker and date picker will use native UIs.
|
|
13
|
+
#
|
|
14
|
+
# https://api.slack.com/reference/block-kit/block-elements#datetimepicker
|
|
15
|
+
class Datetimepicker
|
|
16
|
+
include Composition::ConfirmationDialog::Confirmable
|
|
17
|
+
|
|
18
|
+
TYPE = 'datetimepicker'
|
|
19
|
+
|
|
20
|
+
def initialize(action_id:, initial: nil, focus_on_load: nil)
|
|
21
|
+
@action_id = action_id
|
|
22
|
+
@initial_datetime = initial
|
|
23
|
+
@focus_on_load = focus_on_load
|
|
24
|
+
|
|
25
|
+
yield(self) if block_given?
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def as_json(*)
|
|
29
|
+
{
|
|
30
|
+
type: TYPE,
|
|
31
|
+
action_id: @action_id,
|
|
32
|
+
initial_date_time: @initial_datetime,
|
|
33
|
+
focus_on_load: @focus_on_load,
|
|
34
|
+
confirm: confirm&.as_json
|
|
35
|
+
}.compact
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Slack
|
|
4
|
+
module BlockKit
|
|
5
|
+
module Element
|
|
6
|
+
# A Email input element, similar to the Plain-text input element, creates
|
|
7
|
+
# a single line field where a user can enter an email. It can appear as a
|
|
8
|
+
# single-line field.
|
|
9
|
+
#
|
|
10
|
+
# https://api.slack.com/reference/block-kit/block-elements#email
|
|
11
|
+
class EmailTextInput
|
|
12
|
+
TYPE = 'email_text_input'
|
|
13
|
+
|
|
14
|
+
def initialize(
|
|
15
|
+
action_id:,
|
|
16
|
+
placeholder: nil,
|
|
17
|
+
initial_value: nil,
|
|
18
|
+
focus_on_load: nil
|
|
19
|
+
)
|
|
20
|
+
@placeholder = placeholder && Composition::PlainText.new(text: placeholder)
|
|
21
|
+
@initial_value = initial_value
|
|
22
|
+
@action_id = action_id
|
|
23
|
+
@focus_on_load = focus_on_load
|
|
24
|
+
@dispatch_action_config = nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def dispatch_action_config(triggers: nil)
|
|
28
|
+
@dispatch_action_config = Composition::DispatchActionConfiguration.new(triggers: triggers)
|
|
29
|
+
|
|
30
|
+
yield(@dispatch_action_config) if block_given?
|
|
31
|
+
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def as_json(*)
|
|
36
|
+
{
|
|
37
|
+
type: TYPE,
|
|
38
|
+
action_id: @action_id,
|
|
39
|
+
placeholder: @placeholder&.as_json,
|
|
40
|
+
initial_value: @initial_value,
|
|
41
|
+
focus_on_load: @focus_on_load,
|
|
42
|
+
dispatch_action_config: @dispatch_action_config&.as_json
|
|
43
|
+
}.compact
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -24,7 +24,8 @@ module Slack
|
|
|
24
24
|
initial: nil,
|
|
25
25
|
emoji: nil,
|
|
26
26
|
max_selected_items: nil,
|
|
27
|
-
focus_on_load: nil
|
|
27
|
+
focus_on_load: nil,
|
|
28
|
+
default_to_current_conversation: nil
|
|
28
29
|
)
|
|
29
30
|
@placeholder = Composition::PlainText.new(text: placeholder, emoji: emoji)
|
|
30
31
|
@action_id = action_id
|
|
@@ -32,6 +33,7 @@ module Slack
|
|
|
32
33
|
@max_selected_items = max_selected_items
|
|
33
34
|
@focus_on_load = focus_on_load
|
|
34
35
|
@filter = nil
|
|
36
|
+
@default_to_current_conversation = default_to_current_conversation
|
|
35
37
|
|
|
36
38
|
yield(self) if block_given?
|
|
37
39
|
end
|
|
@@ -57,7 +59,8 @@ module Slack
|
|
|
57
59
|
focus_on_load: @focus_on_load,
|
|
58
60
|
confirm: confirm&.as_json,
|
|
59
61
|
max_selected_items: @max_selected_items,
|
|
60
|
-
filter: @filter&.as_json
|
|
62
|
+
filter: @filter&.as_json,
|
|
63
|
+
default_to_current_conversation: @default_to_current_conversation
|
|
61
64
|
}.compact
|
|
62
65
|
end
|
|
63
66
|
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Slack
|
|
4
|
+
module BlockKit
|
|
5
|
+
module Element
|
|
6
|
+
# Works with block types: Input
|
|
7
|
+
#
|
|
8
|
+
# Number input elements are supported in the following app surfaces:
|
|
9
|
+
# Modals
|
|
10
|
+
#
|
|
11
|
+
# This input elements accepts both whole and decimal numbers. For
|
|
12
|
+
# example, 0.25, 5.5, and -10 are all valid input values. Decimal
|
|
13
|
+
# numbers are only allowed when is_decimal_allowed is equal to true.
|
|
14
|
+
#
|
|
15
|
+
# https://api.slack.com/reference/block-kit/block-elements#number
|
|
16
|
+
class NumberInput
|
|
17
|
+
TYPE = 'number_input'
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
action_id:,
|
|
21
|
+
is_decimal_allowed:,
|
|
22
|
+
placeholder: nil,
|
|
23
|
+
initial_value: nil,
|
|
24
|
+
min_value: nil,
|
|
25
|
+
max_value: nil,
|
|
26
|
+
focus_on_load: nil
|
|
27
|
+
)
|
|
28
|
+
@placeholder = placeholder && Composition::PlainText.new(text: placeholder)
|
|
29
|
+
@initial_value = initial_value
|
|
30
|
+
@action_id = action_id
|
|
31
|
+
@is_decimal_allowed = is_decimal_allowed
|
|
32
|
+
@focus_on_load = focus_on_load
|
|
33
|
+
@dispatch_action_config = nil
|
|
34
|
+
@min_value = min_value
|
|
35
|
+
@max_value = max_value
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def dispatch_action_config(triggers: nil)
|
|
39
|
+
@dispatch_action_config = Composition::DispatchActionConfiguration.new(triggers: triggers)
|
|
40
|
+
|
|
41
|
+
yield(@dispatch_action_config) if block_given?
|
|
42
|
+
|
|
43
|
+
self
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def as_json(*)
|
|
47
|
+
{
|
|
48
|
+
type: TYPE,
|
|
49
|
+
action_id: @action_id,
|
|
50
|
+
is_decimal_allowed: @is_decimal_allowed,
|
|
51
|
+
placeholder: @placeholder&.as_json,
|
|
52
|
+
initial_value: @initial_value,
|
|
53
|
+
min_value: @min_value,
|
|
54
|
+
max_value: @max_value,
|
|
55
|
+
focus_on_load: @focus_on_load,
|
|
56
|
+
dispatch_action_config: @dispatch_action_config&.as_json
|
|
57
|
+
}.compact
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Slack
|
|
4
|
+
module BlockKit
|
|
5
|
+
module Element
|
|
6
|
+
# A URL input element, similar to the Plain-text input element, creates a single line field where a user can
|
|
7
|
+
# enter a URL. It can appear as a single-line field.
|
|
8
|
+
#
|
|
9
|
+
# URL-text input elements are currently only available in modals
|
|
10
|
+
#
|
|
11
|
+
# https://api.slack.com/reference/block-kit/block-elements#url
|
|
12
|
+
class UrlTextInput
|
|
13
|
+
TYPE = 'url_text_input'
|
|
14
|
+
|
|
15
|
+
def initialize(
|
|
16
|
+
action_id:,
|
|
17
|
+
placeholder: nil,
|
|
18
|
+
initial_value: nil,
|
|
19
|
+
focus_on_load: nil
|
|
20
|
+
)
|
|
21
|
+
@placeholder = placeholder && Composition::PlainText.new(text: placeholder)
|
|
22
|
+
@initial_value = initial_value
|
|
23
|
+
@action_id = action_id
|
|
24
|
+
@focus_on_load = focus_on_load
|
|
25
|
+
@dispatch_action_config = nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def dispatch_action_config(triggers: nil)
|
|
29
|
+
@dispatch_action_config = Composition::DispatchActionConfiguration.new(triggers: triggers)
|
|
30
|
+
|
|
31
|
+
yield(@dispatch_action_config) if block_given?
|
|
32
|
+
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def as_json(*)
|
|
37
|
+
{
|
|
38
|
+
type: TYPE,
|
|
39
|
+
action_id: @action_id,
|
|
40
|
+
placeholder: @placeholder&.as_json,
|
|
41
|
+
initial_value: @initial_value,
|
|
42
|
+
focus_on_load: @focus_on_load,
|
|
43
|
+
dispatch_action_config: @dispatch_action_config&.as_json
|
|
44
|
+
}.compact
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -33,12 +33,13 @@ module Slack
|
|
|
33
33
|
append(element)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def channel_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
|
36
|
+
def channel_select(placeholder:, action_id:, initial: nil, emoji: nil, response_url_enabled: nil)
|
|
37
37
|
element = Element::ChannelsSelect.new(
|
|
38
38
|
placeholder: placeholder,
|
|
39
39
|
action_id: action_id,
|
|
40
40
|
initial: initial,
|
|
41
|
-
emoji: emoji
|
|
41
|
+
emoji: emoji,
|
|
42
|
+
response_url_enabled: response_url_enabled
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
yield(element) if block_given?
|
|
@@ -46,12 +47,14 @@ module Slack
|
|
|
46
47
|
append(element)
|
|
47
48
|
end
|
|
48
49
|
|
|
49
|
-
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
|
50
|
+
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil, default_to_current_conversation: nil, response_url_enabled: nil)
|
|
50
51
|
element = Element::ConversationsSelect.new(
|
|
51
52
|
placeholder: placeholder,
|
|
52
53
|
action_id: action_id,
|
|
53
54
|
initial: initial,
|
|
54
|
-
emoji: emoji
|
|
55
|
+
emoji: emoji,
|
|
56
|
+
default_to_current_conversation: default_to_current_conversation,
|
|
57
|
+
response_url_enabled: response_url_enabled
|
|
55
58
|
)
|
|
56
59
|
|
|
57
60
|
yield(element) if block_given?
|
|
@@ -8,7 +8,7 @@ module Slack
|
|
|
8
8
|
# a select menu element, a multi-select menu element, or a datepicker.
|
|
9
9
|
#
|
|
10
10
|
# https://api.slack.com/reference/block-kit/blocks#input
|
|
11
|
-
class Input
|
|
11
|
+
class Input # rubocop:disable Metrics/ClassLength
|
|
12
12
|
TYPE = 'input'
|
|
13
13
|
|
|
14
14
|
attr_accessor :label, :element, :block_id, :hint, :optional, :emoji
|
|
@@ -30,12 +30,14 @@ module Slack
|
|
|
30
30
|
@dispatch_action = dispatch_action
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
|
33
|
+
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil, default_to_current_conversation: nil, response_url_enabled: nil)
|
|
34
34
|
@element = Element::ConversationsSelect.new(
|
|
35
35
|
placeholder: placeholder,
|
|
36
36
|
action_id: action_id,
|
|
37
37
|
initial: initial,
|
|
38
|
-
emoji: emoji
|
|
38
|
+
emoji: emoji,
|
|
39
|
+
default_to_current_conversation: default_to_current_conversation,
|
|
40
|
+
response_url_enabled: response_url_enabled
|
|
39
41
|
)
|
|
40
42
|
|
|
41
43
|
yield(@element) if block_given?
|
|
@@ -43,13 +45,14 @@ module Slack
|
|
|
43
45
|
self
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
def multi_conversations_select(placeholder:, action_id:, initial: nil, emoji: nil, max_selected_items: nil)
|
|
48
|
+
def multi_conversations_select(placeholder:, action_id:, initial: nil, emoji: nil, max_selected_items: nil, default_to_current_conversation: nil)
|
|
47
49
|
@element = Element::MultiConversationsSelect.new(
|
|
48
50
|
placeholder: placeholder,
|
|
49
51
|
action_id: action_id,
|
|
50
52
|
initial: initial,
|
|
51
53
|
emoji: emoji,
|
|
52
|
-
max_selected_items: max_selected_items
|
|
54
|
+
max_selected_items: max_selected_items,
|
|
55
|
+
default_to_current_conversation: default_to_current_conversation
|
|
53
56
|
)
|
|
54
57
|
|
|
55
58
|
yield(@element) if block_given?
|
|
@@ -57,12 +60,13 @@ module Slack
|
|
|
57
60
|
self
|
|
58
61
|
end
|
|
59
62
|
|
|
60
|
-
def channels_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
|
63
|
+
def channels_select(placeholder:, action_id:, initial: nil, emoji: nil, response_url_enabled: nil)
|
|
61
64
|
@element = Element::ChannelsSelect.new(
|
|
62
65
|
placeholder: placeholder,
|
|
63
66
|
action_id: action_id,
|
|
64
67
|
initial: initial,
|
|
65
|
-
emoji: emoji
|
|
68
|
+
emoji: emoji,
|
|
69
|
+
response_url_enabled: response_url_enabled
|
|
66
70
|
)
|
|
67
71
|
|
|
68
72
|
yield(@element) if block_given?
|
|
@@ -104,6 +108,17 @@ module Slack
|
|
|
104
108
|
self
|
|
105
109
|
end
|
|
106
110
|
|
|
111
|
+
def datetimepicker(action_id:, initial: nil)
|
|
112
|
+
@element = Element::Datetimepicker.new(
|
|
113
|
+
action_id: action_id,
|
|
114
|
+
initial: initial
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
yield(@element) if block_given?
|
|
118
|
+
|
|
119
|
+
self
|
|
120
|
+
end
|
|
121
|
+
|
|
107
122
|
def multi_channels_select(placeholder:, action_id:, initial: nil, emoji: nil, max_selected_items: nil)
|
|
108
123
|
@element = Element::MultiChannelsSelect.new(
|
|
109
124
|
placeholder: placeholder,
|
|
@@ -201,6 +216,34 @@ module Slack
|
|
|
201
216
|
self
|
|
202
217
|
end
|
|
203
218
|
|
|
219
|
+
def url_text_input(
|
|
220
|
+
action_id:,
|
|
221
|
+
placeholder: nil,
|
|
222
|
+
initial_value: nil,
|
|
223
|
+
focus_on_load: nil
|
|
224
|
+
)
|
|
225
|
+
@element = Element::UrlTextInput.new(
|
|
226
|
+
action_id: action_id,
|
|
227
|
+
placeholder: placeholder,
|
|
228
|
+
initial_value: initial_value,
|
|
229
|
+
focus_on_load: focus_on_load
|
|
230
|
+
)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def email_text_input(
|
|
234
|
+
action_id:,
|
|
235
|
+
placeholder: nil,
|
|
236
|
+
initial_value: nil,
|
|
237
|
+
focus_on_load: nil
|
|
238
|
+
)
|
|
239
|
+
@element = Element::EmailTextInput.new(
|
|
240
|
+
action_id: action_id,
|
|
241
|
+
placeholder: placeholder,
|
|
242
|
+
initial_value: initial_value,
|
|
243
|
+
focus_on_load: focus_on_load
|
|
244
|
+
)
|
|
245
|
+
end
|
|
246
|
+
|
|
204
247
|
def radio_buttons(action_id:)
|
|
205
248
|
@element = Element::RadioButtons.new(action_id: action_id)
|
|
206
249
|
|
|
@@ -22,13 +22,15 @@ module Slack
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def multi_conversations_select(placeholder:, action_id:,
|
|
25
|
-
initial: nil, emoji: nil, max_selected_items: nil
|
|
25
|
+
initial: nil, emoji: nil, max_selected_items: nil,
|
|
26
|
+
default_to_current_conversation: nil)
|
|
26
27
|
element = Element::MultiConversationsSelect.new(
|
|
27
28
|
placeholder: placeholder,
|
|
28
29
|
action_id: action_id,
|
|
29
30
|
initial: initial,
|
|
30
31
|
emoji: emoji,
|
|
31
|
-
max_selected_items: max_selected_items
|
|
32
|
+
max_selected_items: max_selected_items,
|
|
33
|
+
default_to_current_conversation: default_to_current_conversation
|
|
32
34
|
)
|
|
33
35
|
|
|
34
36
|
yield(element) if block_given?
|
|
@@ -66,12 +66,13 @@ module Slack
|
|
|
66
66
|
accessorise(element)
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def channel_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
|
69
|
+
def channel_select(placeholder:, action_id:, initial: nil, emoji: nil, response_url_enabled: nil)
|
|
70
70
|
element = Element::ChannelsSelect.new(
|
|
71
71
|
placeholder: placeholder,
|
|
72
72
|
action_id: action_id,
|
|
73
73
|
initial: initial,
|
|
74
|
-
emoji: emoji
|
|
74
|
+
emoji: emoji,
|
|
75
|
+
response_url_enabled: response_url_enabled
|
|
75
76
|
)
|
|
76
77
|
|
|
77
78
|
yield(element) if block_given?
|
|
@@ -79,12 +80,14 @@ module Slack
|
|
|
79
80
|
accessorise(element)
|
|
80
81
|
end
|
|
81
82
|
|
|
82
|
-
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
|
83
|
+
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil, default_to_current_conversation: nil, response_url_enabled: nil)
|
|
83
84
|
element = Element::ConversationsSelect.new(
|
|
84
85
|
placeholder: placeholder,
|
|
85
86
|
action_id: action_id,
|
|
86
87
|
initial: initial,
|
|
87
|
-
emoji: emoji
|
|
88
|
+
emoji: emoji,
|
|
89
|
+
default_to_current_conversation: default_to_current_conversation,
|
|
90
|
+
response_url_enabled: response_url_enabled
|
|
88
91
|
)
|
|
89
92
|
|
|
90
93
|
yield(element) if block_given?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slack-ruby-block-kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.22.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christian Gregg
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-08-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: zeitwerk
|
|
@@ -24,7 +24,7 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '2.6'
|
|
27
|
-
description:
|
|
27
|
+
description:
|
|
28
28
|
email:
|
|
29
29
|
- c_arlt@hotmail.com
|
|
30
30
|
executables: []
|
|
@@ -61,6 +61,8 @@ files:
|
|
|
61
61
|
- lib/slack/block_kit/element/checkboxes.rb
|
|
62
62
|
- lib/slack/block_kit/element/conversations_select.rb
|
|
63
63
|
- lib/slack/block_kit/element/datepicker.rb
|
|
64
|
+
- lib/slack/block_kit/element/datetimepicker.rb
|
|
65
|
+
- lib/slack/block_kit/element/email_text_input.rb
|
|
64
66
|
- lib/slack/block_kit/element/external_select.rb
|
|
65
67
|
- lib/slack/block_kit/element/image.rb
|
|
66
68
|
- lib/slack/block_kit/element/multi_channels_select.rb
|
|
@@ -68,11 +70,13 @@ files:
|
|
|
68
70
|
- lib/slack/block_kit/element/multi_external_select.rb
|
|
69
71
|
- lib/slack/block_kit/element/multi_static_select.rb
|
|
70
72
|
- lib/slack/block_kit/element/multi_users_select.rb
|
|
73
|
+
- lib/slack/block_kit/element/number_input.rb
|
|
71
74
|
- lib/slack/block_kit/element/overflow_menu.rb
|
|
72
75
|
- lib/slack/block_kit/element/plain_text_input.rb
|
|
73
76
|
- lib/slack/block_kit/element/radio_buttons.rb
|
|
74
77
|
- lib/slack/block_kit/element/static_select.rb
|
|
75
78
|
- lib/slack/block_kit/element/timepicker.rb
|
|
79
|
+
- lib/slack/block_kit/element/url_text_input.rb
|
|
76
80
|
- lib/slack/block_kit/element/users_select.rb
|
|
77
81
|
- lib/slack/block_kit/formatting.rb
|
|
78
82
|
- lib/slack/block_kit/layout/actions.rb
|
|
@@ -97,7 +101,7 @@ licenses:
|
|
|
97
101
|
- MIT
|
|
98
102
|
metadata:
|
|
99
103
|
rubygems_mfa_required: 'true'
|
|
100
|
-
post_install_message:
|
|
104
|
+
post_install_message:
|
|
101
105
|
rdoc_options: []
|
|
102
106
|
require_paths:
|
|
103
107
|
- lib
|
|
@@ -112,8 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
116
|
- !ruby/object:Gem::Version
|
|
113
117
|
version: '0'
|
|
114
118
|
requirements: []
|
|
115
|
-
rubygems_version: 3.
|
|
116
|
-
signing_key:
|
|
119
|
+
rubygems_version: 3.4.12
|
|
120
|
+
signing_key:
|
|
117
121
|
specification_version: 4
|
|
118
122
|
summary: A ruby wrapper for Slack's Block Kit
|
|
119
123
|
test_files: []
|