slack-ruby-block-kit 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -8
- data/Gemfile.lock +12 -8
- data/lib/slack/block_kit/blocks.rb +3 -2
- data/lib/slack/block_kit/composition/dispatch_action_configuration.rb +34 -0
- data/lib/slack/block_kit/element/date_picker.rb +9 -6
- data/lib/slack/block_kit/element/plain_text_input.rb +11 -1
- data/lib/slack/block_kit/layout/input.rb +5 -2
- data/lib/slack/block_kit/layout/section.rb +1 -0
- data/lib/slack/block_kit/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 644f871d525941f478c3be328b24038bdcfa219555efa6e1aa3e7c0a6fe2b0af
|
4
|
+
data.tar.gz: 8ffd58726aee0032b5ffb7b97b879d8c56fb8c81a26f6cf9db251dc608ad756e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5096cf81affb99eb90fe44f7c873caca6738b37579fc90d15dfec3ec6ea4f7c8fca7956958dbefcec9cf01105bf13dba834bf3e1ba9da3e4c51ebdd53c26e8e7
|
7
|
+
data.tar.gz: dbf34713c3d0ecfaa61d8d36d8df7b7fff94482723bd42572d2c5fb98868e1db16673aae70196f7b340856774e4cb4919491576ad74a93e4e643e9f51c0c66f6
|
data/CHANGELOG.md
CHANGED
@@ -24,21 +24,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
24
24
|
### Security
|
25
25
|
- N/A
|
26
26
|
|
27
|
+
|
28
|
+
[Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.15.0...HEAD
|
29
|
+
|
30
|
+
|
31
|
+
---
|
32
|
+
|
33
|
+
|
34
|
+
## [0.15.0] - 2021-06-14
|
35
|
+
|
36
|
+
### Added
|
37
|
+
- Support `dispatch_action` and `dispatch_action_config` (#94 by @deecewan)
|
38
|
+
|
39
|
+
|
40
|
+
[0.15.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.1...v0.15.0
|
41
|
+
|
42
|
+
|
27
43
|
---
|
28
44
|
|
45
|
+
|
29
46
|
## [0.14.1] - 2021-05-05
|
30
47
|
|
31
48
|
### Fixed
|
32
49
|
- Allow Layout::Section to render without `text` (#87 by @pbendersky)
|
33
50
|
|
34
51
|
|
52
|
+
[0.14.1]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.0...v0.14.1
|
53
|
+
|
54
|
+
|
35
55
|
---
|
36
56
|
|
57
|
+
|
37
58
|
## [0.14.0] - 2021-02-06
|
38
59
|
|
39
60
|
### Added
|
40
61
|
- `Slack::BlockKit::Blocks#header` (#74 by @rspeicher)
|
41
62
|
|
63
|
+
|
64
|
+
[0.14.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.13.0...v0.14.0
|
65
|
+
|
66
|
+
|
67
|
+
---
|
68
|
+
|
69
|
+
|
42
70
|
## [0.13.0] - 2020-12-29
|
43
71
|
|
44
72
|
### Added
|
@@ -50,6 +78,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
50
78
|
- Development dependencies now managed by bundler via Gemfile, rather than in gemspec
|
51
79
|
|
52
80
|
|
81
|
+
[0.13.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.12.0...v0.13.0
|
82
|
+
|
83
|
+
|
53
84
|
---
|
54
85
|
|
55
86
|
|
@@ -64,6 +95,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
64
95
|
- `Slack::BlockKit::Element::StaticSelect#initial`, use the `initial:` keyword on `#option`
|
65
96
|
|
66
97
|
|
98
|
+
[0.12.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.11.0...v0.12.0
|
99
|
+
|
100
|
+
|
67
101
|
---
|
68
102
|
|
69
103
|
|
@@ -79,6 +113,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
79
113
|
- Ruby2.7 kwarg deprecation warnings
|
80
114
|
|
81
115
|
|
116
|
+
[0.11.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.10.0...v0.11.0
|
117
|
+
|
118
|
+
|
82
119
|
---
|
83
120
|
|
84
121
|
|
@@ -91,17 +128,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
91
128
|
- Fixed initial options in multi select blocks (#46 by @caalberts)
|
92
129
|
|
93
130
|
|
131
|
+
[0.10.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.9.0...v0.10.0
|
132
|
+
|
133
|
+
|
94
134
|
---
|
95
135
|
|
96
136
|
See [releases] for previous changes.
|
97
137
|
|
98
138
|
|
99
|
-
[Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.1...HEAD
|
100
|
-
[0.14.1]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.0...v0.14.1
|
101
|
-
[0.14.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.13.0...v0.14.0
|
102
|
-
[0.13.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.12.0...v0.13.0
|
103
|
-
[0.12.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.11.0...v0.12.0
|
104
|
-
[0.11.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.10.0...v0.11.0
|
105
|
-
[0.10.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.9.0...v0.10.0
|
106
|
-
|
107
139
|
[releases]: https://github.com/CGA1123/slack-ruby-block-kit/releases
|
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.15.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -13,19 +13,23 @@ GEM
|
|
13
13
|
diff-lcs (1.4.4)
|
14
14
|
docile (1.3.5)
|
15
15
|
dotenv (2.7.6)
|
16
|
-
faraday (1.4.
|
16
|
+
faraday (1.4.2)
|
17
|
+
faraday-em_http (~> 1.0)
|
18
|
+
faraday-em_synchrony (~> 1.0)
|
17
19
|
faraday-excon (~> 1.1)
|
18
20
|
faraday-net_http (~> 1.0)
|
19
21
|
faraday-net_http_persistent (~> 1.1)
|
20
22
|
multipart-post (>= 1.2, < 3)
|
21
23
|
ruby2_keywords (>= 0.0.4)
|
24
|
+
faraday-em_http (1.0.0)
|
25
|
+
faraday-em_synchrony (1.0.0)
|
22
26
|
faraday-excon (1.1.0)
|
23
27
|
faraday-net_http (1.0.1)
|
24
28
|
faraday-net_http_persistent (1.1.0)
|
25
29
|
method_source (1.0.0)
|
26
30
|
multipart-post (2.1.1)
|
27
31
|
parallel (1.20.1)
|
28
|
-
parser (3.0.1.
|
32
|
+
parser (3.0.1.1)
|
29
33
|
ast (~> 2.4.1)
|
30
34
|
pry (0.14.1)
|
31
35
|
coderay (~> 1.1)
|
@@ -49,20 +53,20 @@ GEM
|
|
49
53
|
rspec-support (3.10.2)
|
50
54
|
rspec_junit_formatter (0.4.1)
|
51
55
|
rspec-core (>= 2, < 4, != 2.12.0)
|
52
|
-
rubocop (1.
|
56
|
+
rubocop (1.16.1)
|
53
57
|
parallel (~> 1.10)
|
54
58
|
parser (>= 3.0.0.0)
|
55
59
|
rainbow (>= 2.2.2, < 4.0)
|
56
60
|
regexp_parser (>= 1.8, < 3.0)
|
57
61
|
rexml
|
58
|
-
rubocop-ast (>= 1.
|
62
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
59
63
|
ruby-progressbar (~> 1.7)
|
60
64
|
unicode-display_width (>= 1.4.0, < 3.0)
|
61
|
-
rubocop-ast (1.
|
62
|
-
parser (>=
|
65
|
+
rubocop-ast (1.7.0)
|
66
|
+
parser (>= 3.0.1.1)
|
63
67
|
rubocop-rake (0.5.1)
|
64
68
|
rubocop
|
65
|
-
rubocop-rspec (2.
|
69
|
+
rubocop-rspec (2.4.0)
|
66
70
|
rubocop (~> 1.0)
|
67
71
|
rubocop-ast (>= 1.1.0)
|
68
72
|
ruby-progressbar (1.11.0)
|
@@ -63,11 +63,12 @@ module Slack
|
|
63
63
|
append(block)
|
64
64
|
end
|
65
65
|
|
66
|
-
def input(label:, hint: nil, block_id: nil)
|
66
|
+
def input(label:, hint: nil, block_id: nil, dispatch_action: nil)
|
67
67
|
block = Layout::Input.new(
|
68
68
|
label: label,
|
69
69
|
hint: hint,
|
70
|
-
block_id: block_id
|
70
|
+
block_id: block_id,
|
71
|
+
dispatch_action: dispatch_action
|
71
72
|
)
|
72
73
|
|
73
74
|
yield(block) if block_given?
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module BlockKit
|
5
|
+
module Composition
|
6
|
+
# Determines when a plain-text input element will return a block_actions
|
7
|
+
# interaction payload.
|
8
|
+
#
|
9
|
+
# @param [Array] triggers - values for the `trigger_actions_on` array
|
10
|
+
#
|
11
|
+
# https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config
|
12
|
+
# https://api.slack.com/reference/block-kit/block-elements#input
|
13
|
+
class DispatchActionConfiguration
|
14
|
+
def initialize(triggers: nil)
|
15
|
+
@triggers = triggers || []
|
16
|
+
end
|
17
|
+
|
18
|
+
def trigger_on_enter_pressed
|
19
|
+
@triggers << :on_enter_pressed
|
20
|
+
end
|
21
|
+
|
22
|
+
def trigger_on_character_entered
|
23
|
+
@triggers << :on_character_entered
|
24
|
+
end
|
25
|
+
|
26
|
+
def as_json(*)
|
27
|
+
{
|
28
|
+
trigger_actions_on: @triggers.uniq
|
29
|
+
}.compact
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -17,12 +17,7 @@ module Slack
|
|
17
17
|
def initialize(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
18
18
|
@action_id = action_id
|
19
19
|
@initial_date = initial
|
20
|
-
|
21
|
-
@placeholder = Composition::PlainText.new(
|
22
|
-
text: placeholder,
|
23
|
-
emoji: emoji
|
24
|
-
)
|
25
|
-
end
|
20
|
+
@placeholder = placeholder_text(placeholder, emoji)
|
26
21
|
|
27
22
|
yield(self) if block_given?
|
28
23
|
end
|
@@ -36,6 +31,14 @@ module Slack
|
|
36
31
|
confirm: confirm&.as_json
|
37
32
|
}.compact
|
38
33
|
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def placeholder_text(text, emoji)
|
38
|
+
return unless text
|
39
|
+
|
40
|
+
Composition::PlainText.new(text: text, emoji: emoji)
|
41
|
+
end
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
@@ -28,6 +28,15 @@ module Slack
|
|
28
28
|
@multiline = multiline
|
29
29
|
@min_length = min_length
|
30
30
|
@max_length = max_length
|
31
|
+
@dispatch_action_config = nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def dispatch_action_config(triggers: nil)
|
35
|
+
@dispatch_action_config = Composition::DispatchActionConfiguration.new(triggers: triggers)
|
36
|
+
|
37
|
+
yield(@dispatch_action_config) if block_given?
|
38
|
+
|
39
|
+
self
|
31
40
|
end
|
32
41
|
|
33
42
|
def as_json(*)
|
@@ -38,7 +47,8 @@ module Slack
|
|
38
47
|
multiline: @multiline,
|
39
48
|
min_length: @min_length,
|
40
49
|
max_length: @max_length,
|
41
|
-
initial_value: @initial_value
|
50
|
+
initial_value: @initial_value,
|
51
|
+
dispatch_action_config: @dispatch_action_config&.as_json
|
42
52
|
}.compact
|
43
53
|
end
|
44
54
|
end
|
@@ -19,13 +19,15 @@ module Slack
|
|
19
19
|
block_id: nil,
|
20
20
|
hint: nil,
|
21
21
|
optional: nil,
|
22
|
-
emoji: nil
|
22
|
+
emoji: nil,
|
23
|
+
dispatch_action: nil
|
23
24
|
)
|
24
25
|
@label = Composition::PlainText.new(text: label, emoji: emoji) if label
|
25
26
|
@hint = Composition::PlainText.new(text: hint, emoji: emoji) if hint
|
26
27
|
@block_id = block_id
|
27
28
|
@optional = optional
|
28
29
|
@element = element
|
30
|
+
@dispatch_action = dispatch_action
|
29
31
|
end
|
30
32
|
|
31
33
|
def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil)
|
@@ -228,7 +230,8 @@ module Slack
|
|
228
230
|
label: @label&.as_json,
|
229
231
|
hint: @hint&.as_json,
|
230
232
|
block_id: @block_id,
|
231
|
-
optional: optional
|
233
|
+
optional: optional,
|
234
|
+
dispatch_action: @dispatch_action
|
232
235
|
}.compact
|
233
236
|
end
|
234
237
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
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.15.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: 2021-
|
11
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- c_arlt@hotmail.com
|
16
16
|
executables: []
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/slack/block_kit/blocks.rb
|
36
36
|
- lib/slack/block_kit/composition/confirmation_dialog.rb
|
37
37
|
- lib/slack/block_kit/composition/conversation_filter.rb
|
38
|
+
- lib/slack/block_kit/composition/dispatch_action_configuration.rb
|
38
39
|
- lib/slack/block_kit/composition/mrkdwn.rb
|
39
40
|
- lib/slack/block_kit/composition/option.rb
|
40
41
|
- lib/slack/block_kit/composition/option_group.rb
|
@@ -74,7 +75,7 @@ homepage: https://github.com/CGA1123/slack-ruby-block-kit
|
|
74
75
|
licenses:
|
75
76
|
- MIT
|
76
77
|
metadata: {}
|
77
|
-
post_install_message:
|
78
|
+
post_install_message:
|
78
79
|
rdoc_options: []
|
79
80
|
require_paths:
|
80
81
|
- lib
|
@@ -89,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
- !ruby/object:Gem::Version
|
90
91
|
version: '0'
|
91
92
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
93
|
-
signing_key:
|
93
|
+
rubygems_version: 3.1.4
|
94
|
+
signing_key:
|
94
95
|
specification_version: 4
|
95
96
|
summary: A ruby wrapper for Slack's Block Kit
|
96
97
|
test_files: []
|