slack-ruby-block-kit 0.17.0 → 0.18.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/.devcontainer/Dockerfile +1 -0
- data/.devcontainer/devcontainer.json +11 -0
- data/.github/dependabot.yml +2 -1
- data/.github/workflows/ci.yml +2 -1
- data/.github/workflows/release.yml +30 -0
- data/CHANGELOG.md +24 -58
- data/Gemfile +3 -3
- data/Gemfile.lock +54 -42
- data/README.md +12 -0
- data/lib/slack/block_kit/blocks.rb +3 -2
- data/lib/slack/block_kit/element/{date_picker.rb → datepicker.rb} +1 -1
- data/lib/slack/block_kit/element/timepicker.rb +11 -14
- data/lib/slack/block_kit/layout/actions.rb +15 -2
- data/lib/slack/block_kit/layout/input.rb +14 -1
- data/lib/slack/block_kit/layout/section.rb +15 -4
- data/lib/slack/block_kit/version.rb +1 -1
- data/lib/slack/block_kit.rb +0 -6
- data/lib/slack-ruby-block-kit.rb +12 -1
- data/{bin → script}/console +1 -1
- data/script/lint +3 -0
- data/script/test +3 -0
- data/slack-ruby-block-kit.gemspec +5 -3
- metadata +27 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1dbf4c507a258057e4268545eb470d52283d73f24911adedf77f4cb3bd63dea
|
|
4
|
+
data.tar.gz: fbb29fb003bc969ca8d9dc7eb3db3f025afd7585dc671009f5aa482d79fd711f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9838653c7f9641515da8433252f34123dff455b3619c3ba32fbdccaffdb8b16144f830d6ed53a246afd04acbce4ed8887a66ba45079eca99cce50b370afcbae4
|
|
7
|
+
data.tar.gz: 4d079f8202a4d9b3a8966adf4f01e37eb0c08a22e074a3dc149a09466ea63124eb7841f8585cfc295880754a68bf2352e33a6b9de8e68afa7b5092c0e9a812c0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-2.7
|
data/.github/dependabot.yml
CHANGED
data/.github/workflows/ci.yml
CHANGED
|
@@ -30,4 +30,5 @@ jobs:
|
|
|
30
30
|
- run: bundle exec rubocop
|
|
31
31
|
- run: bundle exec rspec --format progress
|
|
32
32
|
- run: ./bin/deepsource report --analyzer test-coverage --key ruby --value-file ./coverage/.resultset.json
|
|
33
|
-
|
|
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)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
otp:
|
|
7
|
+
name: 'RubyGems OTP Code'
|
|
8
|
+
required: true
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
name: Release
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
- uses: ruby/setup-ruby@v1
|
|
17
|
+
with:
|
|
18
|
+
ruby-version: 2.7
|
|
19
|
+
- run: |
|
|
20
|
+
otp=${{github.event.inputs.otp}}
|
|
21
|
+
echo "::add-mask::$otp"
|
|
22
|
+
- run: gem update --system
|
|
23
|
+
- run: git config --global user.email github-action@users.noreply.github.com
|
|
24
|
+
- run: git config --global user.name GitHub Actions
|
|
25
|
+
- run: git config --global user.password ${{ github.token }}
|
|
26
|
+
- run: bundle install
|
|
27
|
+
- run: bundle exec rake release
|
|
28
|
+
env:
|
|
29
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
|
30
|
+
GEM_HOST_OTP_CODE: ${{ github.event.inputs.otp }}
|
data/CHANGELOG.md
CHANGED
|
@@ -25,11 +25,23 @@ 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.18.0] - 2022-08-26
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
### Added
|
|
31
|
+
- `Slack::BlockKit::Layout::Input#Timepicker`
|
|
32
|
+
- `Slack::BlockKit::Layout::Actions#timepicker`
|
|
33
|
+
- `Slack::BlockKit::Layout::Section#timepicker`
|
|
30
34
|
|
|
35
|
+
### Changed
|
|
36
|
+
- `Slack::BlockKit::Element::Timepicker.initialize` now accepts `initial:`, `emoji:`, `placeholder:`
|
|
37
|
+
- Rename `Slack::BlockKit::Element::DatePicker` to `Datepicker`
|
|
38
|
+
- Rename `Slack::BlockKit::Layout::Actions#date_picker` to `#datepicker`
|
|
39
|
+
- Rename `Slack::BlockKit::Layout::Section#date_picker` to `#datepicker`
|
|
40
|
+
- `Slack::BlockKit::Blocks#input` now supports passing through the `optional:` parameter (@sophieklm)
|
|
31
41
|
|
|
32
|
-
|
|
42
|
+
### Removed
|
|
43
|
+
- `Slack::BlockKit::Element::Timepicker#placeholder`
|
|
44
|
+
- `Slack::BlockKit::Element::Timepicker#initial_time`
|
|
33
45
|
|
|
34
46
|
|
|
35
47
|
## [0.17.0] - 2021-06-28
|
|
@@ -38,12 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
38
50
|
- `Slack::BlockKit::Formatting` with utility functions for Slack text formatting (#98 by @CGA1123)
|
|
39
51
|
|
|
40
52
|
|
|
41
|
-
[0.17.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.16.0...v0.17.0
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
|
|
47
53
|
## [0.16.0] - 2021-06-23
|
|
48
54
|
|
|
49
55
|
This release contains a breaking change on the `Layout::Actions` interface.
|
|
@@ -58,48 +64,24 @@ This release contains a breaking change on the `Layout::Actions` interface.
|
|
|
58
64
|
- Fixed name of method in `Layout::Actions` to be `conversation_select` (#97 by @ryanwilsonperkin)
|
|
59
65
|
|
|
60
66
|
|
|
61
|
-
[0.16.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.15.0...v0.16.0
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
|
|
67
67
|
## [0.15.0] - 2021-06-14
|
|
68
68
|
|
|
69
69
|
### Added
|
|
70
70
|
- Support `dispatch_action` and `dispatch_action_config` (#94 by @deecewan)
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
[0.15.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.1...v0.15.0
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
|
|
79
73
|
## [0.14.1] - 2021-05-05
|
|
80
74
|
|
|
81
75
|
### Fixed
|
|
82
76
|
- Allow Layout::Section to render without `text` (#87 by @pbendersky)
|
|
83
77
|
|
|
84
78
|
|
|
85
|
-
[0.14.1]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.0...v0.14.1
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
|
|
91
79
|
## [0.14.0] - 2021-02-06
|
|
92
80
|
|
|
93
81
|
### Added
|
|
94
82
|
- `Slack::BlockKit::Blocks#header` (#74 by @rspeicher)
|
|
95
83
|
|
|
96
84
|
|
|
97
|
-
[0.14.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.13.0...v0.14.0
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
|
|
103
85
|
## [0.13.0] - 2020-12-29
|
|
104
86
|
|
|
105
87
|
### Added
|
|
@@ -111,12 +93,6 @@ This release contains a breaking change on the `Layout::Actions` interface.
|
|
|
111
93
|
- Development dependencies now managed by bundler via Gemfile, rather than in gemspec
|
|
112
94
|
|
|
113
95
|
|
|
114
|
-
[0.13.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.12.0...v0.13.0
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
|
|
120
96
|
## [0.12.0] - 2020-10-06
|
|
121
97
|
|
|
122
98
|
### Added
|
|
@@ -128,12 +104,6 @@ This release contains a breaking change on the `Layout::Actions` interface.
|
|
|
128
104
|
- `Slack::BlockKit::Element::StaticSelect#initial`, use the `initial:` keyword on `#option`
|
|
129
105
|
|
|
130
106
|
|
|
131
|
-
[0.12.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.11.0...v0.12.0
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
|
|
137
107
|
## [0.11.0] - 2020-10-03
|
|
138
108
|
|
|
139
109
|
### Added
|
|
@@ -146,12 +116,6 @@ This release contains a breaking change on the `Layout::Actions` interface.
|
|
|
146
116
|
- Ruby2.7 kwarg deprecation warnings
|
|
147
117
|
|
|
148
118
|
|
|
149
|
-
[0.11.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.10.0...v0.11.0
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
|
|
155
119
|
## [0.10.0] - 2020-09-11
|
|
156
120
|
|
|
157
121
|
### Added
|
|
@@ -161,12 +125,14 @@ This release contains a breaking change on the `Layout::Actions` interface.
|
|
|
161
125
|
- Fixed initial options in multi select blocks (#46 by @caalberts)
|
|
162
126
|
|
|
163
127
|
|
|
128
|
+
[Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.18.0...HEAD
|
|
129
|
+
[0.17.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.17.0...v0.18.0
|
|
130
|
+
[0.17.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.16.0...v0.17.0
|
|
131
|
+
[0.16.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.15.0...v0.16.0
|
|
132
|
+
[0.15.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.1...v0.15.0
|
|
133
|
+
[0.14.1]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.0...v0.14.1
|
|
134
|
+
[0.14.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.13.0...v0.14.0
|
|
135
|
+
[0.13.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.12.0...v0.13.0
|
|
136
|
+
[0.12.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.11.0...v0.12.0
|
|
137
|
+
[0.11.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.10.0...v0.11.0
|
|
164
138
|
[0.10.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.9.0...v0.10.0
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
See [releases] for previous changes.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
[releases]: https://github.com/CGA1123/slack-ruby-block-kit/releases
|
data/Gemfile
CHANGED
|
@@ -9,10 +9,10 @@ gem 'faraday', '~> 1'
|
|
|
9
9
|
gem 'pry', '~> 0.14'
|
|
10
10
|
gem 'rake', '~> 13'
|
|
11
11
|
gem 'rspec', '~> 3'
|
|
12
|
-
gem 'rspec_junit_formatter', '~> 0.
|
|
12
|
+
gem 'rspec_junit_formatter', '~> 0.5'
|
|
13
13
|
|
|
14
|
-
gem 'codecov', '~> 0.
|
|
14
|
+
gem 'codecov', '~> 0.6', require: false
|
|
15
15
|
gem 'rubocop', '~> 1', require: false
|
|
16
|
-
gem 'rubocop-rake', '~> 0.
|
|
16
|
+
gem 'rubocop-rake', '~> 0.6', require: false
|
|
17
17
|
gem 'rubocop-rspec', '~> 2', require: false
|
|
18
18
|
gem 'simplecov', '~> 0.21', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -1,98 +1,110 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
slack-ruby-block-kit (0.
|
|
4
|
+
slack-ruby-block-kit (0.18.0)
|
|
5
|
+
zeitwerk (~> 2.6)
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
8
|
remote: https://rubygems.org/
|
|
8
9
|
specs:
|
|
9
10
|
ast (2.4.2)
|
|
10
|
-
codecov (0.
|
|
11
|
+
codecov (0.6.0)
|
|
11
12
|
simplecov (>= 0.15, < 0.22)
|
|
12
13
|
coderay (1.1.3)
|
|
13
|
-
diff-lcs (1.
|
|
14
|
-
docile (1.
|
|
15
|
-
dotenv (2.
|
|
16
|
-
faraday (1.
|
|
14
|
+
diff-lcs (1.5.0)
|
|
15
|
+
docile (1.4.0)
|
|
16
|
+
dotenv (2.8.1)
|
|
17
|
+
faraday (1.10.2)
|
|
17
18
|
faraday-em_http (~> 1.0)
|
|
18
19
|
faraday-em_synchrony (~> 1.0)
|
|
19
20
|
faraday-excon (~> 1.1)
|
|
21
|
+
faraday-httpclient (~> 1.0)
|
|
22
|
+
faraday-multipart (~> 1.0)
|
|
20
23
|
faraday-net_http (~> 1.0)
|
|
21
|
-
faraday-net_http_persistent (~> 1.
|
|
22
|
-
|
|
24
|
+
faraday-net_http_persistent (~> 1.0)
|
|
25
|
+
faraday-patron (~> 1.0)
|
|
26
|
+
faraday-rack (~> 1.0)
|
|
27
|
+
faraday-retry (~> 1.0)
|
|
23
28
|
ruby2_keywords (>= 0.0.4)
|
|
24
29
|
faraday-em_http (1.0.0)
|
|
25
30
|
faraday-em_synchrony (1.0.0)
|
|
26
31
|
faraday-excon (1.1.0)
|
|
32
|
+
faraday-httpclient (1.0.1)
|
|
33
|
+
faraday-multipart (1.0.4)
|
|
34
|
+
multipart-post (~> 2)
|
|
27
35
|
faraday-net_http (1.0.1)
|
|
28
|
-
faraday-net_http_persistent (1.
|
|
36
|
+
faraday-net_http_persistent (1.2.0)
|
|
37
|
+
faraday-patron (1.0.0)
|
|
38
|
+
faraday-rack (1.0.0)
|
|
39
|
+
faraday-retry (1.0.3)
|
|
29
40
|
method_source (1.0.0)
|
|
30
|
-
multipart-post (2.
|
|
31
|
-
parallel (1.
|
|
32
|
-
parser (3.
|
|
41
|
+
multipart-post (2.2.3)
|
|
42
|
+
parallel (1.22.1)
|
|
43
|
+
parser (3.1.2.0)
|
|
33
44
|
ast (~> 2.4.1)
|
|
34
45
|
pry (0.14.1)
|
|
35
46
|
coderay (~> 1.1)
|
|
36
47
|
method_source (~> 1.0)
|
|
37
|
-
rainbow (3.
|
|
38
|
-
rake (13.0.
|
|
39
|
-
regexp_parser (2.
|
|
48
|
+
rainbow (3.1.1)
|
|
49
|
+
rake (13.0.6)
|
|
50
|
+
regexp_parser (2.3.1)
|
|
40
51
|
rexml (3.2.5)
|
|
41
|
-
rspec (3.
|
|
42
|
-
rspec-core (~> 3.
|
|
43
|
-
rspec-expectations (~> 3.
|
|
44
|
-
rspec-mocks (~> 3.
|
|
45
|
-
rspec-core (3.
|
|
46
|
-
rspec-support (~> 3.
|
|
47
|
-
rspec-expectations (3.
|
|
52
|
+
rspec (3.11.0)
|
|
53
|
+
rspec-core (~> 3.11.0)
|
|
54
|
+
rspec-expectations (~> 3.11.0)
|
|
55
|
+
rspec-mocks (~> 3.11.0)
|
|
56
|
+
rspec-core (3.11.0)
|
|
57
|
+
rspec-support (~> 3.11.0)
|
|
58
|
+
rspec-expectations (3.11.0)
|
|
48
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
49
|
-
rspec-support (~> 3.
|
|
50
|
-
rspec-mocks (3.
|
|
60
|
+
rspec-support (~> 3.11.0)
|
|
61
|
+
rspec-mocks (3.11.0)
|
|
51
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
52
|
-
rspec-support (~> 3.
|
|
53
|
-
rspec-support (3.
|
|
54
|
-
rspec_junit_formatter (0.
|
|
63
|
+
rspec-support (~> 3.11.0)
|
|
64
|
+
rspec-support (3.11.0)
|
|
65
|
+
rspec_junit_formatter (0.5.1)
|
|
55
66
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
56
|
-
rubocop (1.
|
|
67
|
+
rubocop (1.28.2)
|
|
57
68
|
parallel (~> 1.10)
|
|
58
|
-
parser (>= 3.
|
|
69
|
+
parser (>= 3.1.0.0)
|
|
59
70
|
rainbow (>= 2.2.2, < 4.0)
|
|
60
71
|
regexp_parser (>= 1.8, < 3.0)
|
|
61
72
|
rexml
|
|
62
|
-
rubocop-ast (>= 1.
|
|
73
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
|
63
74
|
ruby-progressbar (~> 1.7)
|
|
64
75
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
65
|
-
rubocop-ast (1.
|
|
66
|
-
parser (>= 3.
|
|
67
|
-
rubocop-rake (0.
|
|
68
|
-
rubocop
|
|
69
|
-
rubocop-rspec (2.4.0)
|
|
76
|
+
rubocop-ast (1.17.0)
|
|
77
|
+
parser (>= 3.1.1.0)
|
|
78
|
+
rubocop-rake (0.6.0)
|
|
70
79
|
rubocop (~> 1.0)
|
|
71
|
-
|
|
80
|
+
rubocop-rspec (2.10.0)
|
|
81
|
+
rubocop (~> 1.19)
|
|
72
82
|
ruby-progressbar (1.11.0)
|
|
73
|
-
ruby2_keywords (0.0.
|
|
83
|
+
ruby2_keywords (0.0.5)
|
|
74
84
|
simplecov (0.21.2)
|
|
75
85
|
docile (~> 1.1)
|
|
76
86
|
simplecov-html (~> 0.11)
|
|
77
87
|
simplecov_json_formatter (~> 0.1)
|
|
78
88
|
simplecov-html (0.12.3)
|
|
79
|
-
simplecov_json_formatter (0.1.
|
|
80
|
-
unicode-display_width (2.
|
|
89
|
+
simplecov_json_formatter (0.1.3)
|
|
90
|
+
unicode-display_width (2.1.0)
|
|
91
|
+
zeitwerk (2.6.0)
|
|
81
92
|
|
|
82
93
|
PLATFORMS
|
|
83
94
|
ruby
|
|
84
95
|
x86_64-darwin-19
|
|
96
|
+
x86_64-linux
|
|
85
97
|
|
|
86
98
|
DEPENDENCIES
|
|
87
|
-
codecov (~> 0.
|
|
99
|
+
codecov (~> 0.6)
|
|
88
100
|
dotenv (~> 2)
|
|
89
101
|
faraday (~> 1)
|
|
90
102
|
pry (~> 0.14)
|
|
91
103
|
rake (~> 13)
|
|
92
104
|
rspec (~> 3)
|
|
93
|
-
rspec_junit_formatter (~> 0.
|
|
105
|
+
rspec_junit_formatter (~> 0.5)
|
|
94
106
|
rubocop (~> 1)
|
|
95
|
-
rubocop-rake (~> 0.
|
|
107
|
+
rubocop-rake (~> 0.6)
|
|
96
108
|
rubocop-rspec (~> 2)
|
|
97
109
|
simplecov (~> 0.21)
|
|
98
110
|
slack-ruby-block-kit!
|
data/README.md
CHANGED
|
@@ -95,3 +95,15 @@ See [issues](https://github.com/CGA1123/slack-ruby-block-kit/issues) if you want
|
|
|
95
95
|
## License
|
|
96
96
|
|
|
97
97
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
98
|
+
|
|
99
|
+
## Releasing
|
|
100
|
+
|
|
101
|
+
Releasing is automated via the `.github/workflows/release.yml` which allows for
|
|
102
|
+
an OTP code to be passed in to authorize the release with MFA. If GitHub
|
|
103
|
+
Actions is running slow it might take another attempt to make sure the OTP code
|
|
104
|
+
is still valid when the workflow tries to push.
|
|
105
|
+
|
|
106
|
+
- Update `CHANGELOG` for the latest version (remember to update the comparison links + add in an `Unreleased` section again)
|
|
107
|
+
- Update `lib/slack/block_kit/version.rb` and run `bundle` to update the `Gemfile.lock`
|
|
108
|
+
- Push that!
|
|
109
|
+
- Run the `Release` workflow
|
|
@@ -63,12 +63,13 @@ module Slack
|
|
|
63
63
|
append(block)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
def input(label:, hint: nil, block_id: nil, dispatch_action: nil)
|
|
66
|
+
def input(label:, hint: nil, block_id: nil, dispatch_action: nil, optional: nil)
|
|
67
67
|
block = Layout::Input.new(
|
|
68
68
|
label: label,
|
|
69
69
|
hint: hint,
|
|
70
70
|
block_id: block_id,
|
|
71
|
-
dispatch_action: dispatch_action
|
|
71
|
+
dispatch_action: dispatch_action,
|
|
72
|
+
optional: optional
|
|
72
73
|
)
|
|
73
74
|
|
|
74
75
|
yield(block) if block_given?
|
|
@@ -9,7 +9,7 @@ module Slack
|
|
|
9
9
|
# Date picker elements can be used inside of section and actions blocks.
|
|
10
10
|
#
|
|
11
11
|
# https://api.slack.com/reference/messaging/block-elements#datepicker
|
|
12
|
-
class
|
|
12
|
+
class Datepicker
|
|
13
13
|
include Composition::ConfirmationDialog::Confirmable
|
|
14
14
|
|
|
15
15
|
TYPE = 'datepicker'
|
|
@@ -15,25 +15,14 @@ module Slack
|
|
|
15
15
|
|
|
16
16
|
TYPE = 'timepicker'
|
|
17
17
|
|
|
18
|
-
def initialize(action_id:)
|
|
19
|
-
@placeholder,
|
|
18
|
+
def initialize(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
19
|
+
@placeholder = placeholder_text(placeholder, emoji) if placeholder
|
|
20
|
+
@initial_time = initial
|
|
20
21
|
@action_id = action_id
|
|
21
22
|
|
|
22
23
|
yield(self) if block_given?
|
|
23
24
|
end
|
|
24
25
|
|
|
25
|
-
def placeholder(text:, emoji: nil)
|
|
26
|
-
@placeholder = Composition::PlainText.new(text: text, emoji: emoji)
|
|
27
|
-
|
|
28
|
-
self
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def initial_time(time_str)
|
|
32
|
-
@initial_time = time_str
|
|
33
|
-
|
|
34
|
-
self
|
|
35
|
-
end
|
|
36
|
-
|
|
37
26
|
def as_json(*)
|
|
38
27
|
{
|
|
39
28
|
type: TYPE,
|
|
@@ -43,6 +32,14 @@ module Slack
|
|
|
43
32
|
confirm: confirm&.as_json
|
|
44
33
|
}.compact
|
|
45
34
|
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def placeholder_text(text, emoji)
|
|
39
|
+
return unless text
|
|
40
|
+
|
|
41
|
+
Composition::PlainText.new(text: text, emoji: emoji)
|
|
42
|
+
end
|
|
46
43
|
end
|
|
47
44
|
end
|
|
48
45
|
end
|
|
@@ -59,8 +59,21 @@ module Slack
|
|
|
59
59
|
append(element)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def
|
|
63
|
-
element = Element::
|
|
62
|
+
def datepicker(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
63
|
+
element = Element::Datepicker.new(
|
|
64
|
+
placeholder: placeholder,
|
|
65
|
+
action_id: action_id,
|
|
66
|
+
initial: initial,
|
|
67
|
+
emoji: emoji
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
yield(element) if block_given?
|
|
71
|
+
|
|
72
|
+
append(element)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def timepicker(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
76
|
+
element = Element::Timepicker.new(
|
|
64
77
|
placeholder: placeholder,
|
|
65
78
|
action_id: action_id,
|
|
66
79
|
initial: initial,
|
|
@@ -79,7 +79,7 @@ module Slack
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def datepicker(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
82
|
-
@element = Element::
|
|
82
|
+
@element = Element::Datepicker.new(
|
|
83
83
|
action_id: action_id,
|
|
84
84
|
placeholder: placeholder,
|
|
85
85
|
initial: initial,
|
|
@@ -91,6 +91,19 @@ module Slack
|
|
|
91
91
|
self
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
+
def timepicker(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
95
|
+
@element = Element::Timepicker.new(
|
|
96
|
+
action_id: action_id,
|
|
97
|
+
placeholder: placeholder,
|
|
98
|
+
emoji: emoji,
|
|
99
|
+
initial: initial
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
yield(@element) if block_given?
|
|
103
|
+
|
|
104
|
+
self
|
|
105
|
+
end
|
|
106
|
+
|
|
94
107
|
def multi_channels_select(placeholder:, action_id:, initial: nil, emoji: nil, max_selected_items: nil)
|
|
95
108
|
@element = Element::MultiChannelsSelect.new(
|
|
96
109
|
placeholder: placeholder,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative './section/multi_select_elements'
|
|
4
|
-
|
|
5
3
|
module Slack
|
|
6
4
|
module BlockKit
|
|
7
5
|
module Layout
|
|
@@ -94,8 +92,21 @@ module Slack
|
|
|
94
92
|
accessorise(element)
|
|
95
93
|
end
|
|
96
94
|
|
|
97
|
-
def
|
|
98
|
-
element = Element::
|
|
95
|
+
def datepicker(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
96
|
+
element = Element::Datepicker.new(
|
|
97
|
+
placeholder: placeholder,
|
|
98
|
+
action_id: action_id,
|
|
99
|
+
initial: initial,
|
|
100
|
+
emoji: emoji
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
yield(element) if block_given?
|
|
104
|
+
|
|
105
|
+
accessorise(element)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def timepicker(action_id:, placeholder: nil, initial: nil, emoji: nil)
|
|
109
|
+
element = Element::Timepicker.new(
|
|
99
110
|
placeholder: placeholder,
|
|
100
111
|
action_id: action_id,
|
|
101
112
|
initial: initial,
|
data/lib/slack/block_kit.rb
CHANGED
|
@@ -8,12 +8,6 @@ module Slack
|
|
|
8
8
|
|
|
9
9
|
module Layout; end
|
|
10
10
|
|
|
11
|
-
Dir[File.join(__dir__, 'block_kit', 'composition', '*.rb')].sort.each { |file| require file }
|
|
12
|
-
Dir[File.join(__dir__, 'block_kit', 'element', '*.rb')].sort.each { |file| require file }
|
|
13
|
-
Dir[File.join(__dir__, 'block_kit', 'layout', '*.rb')].sort.each { |file| require file }
|
|
14
|
-
Dir[File.join(__dir__, 'block_kit', '*.rb')].sort.each { |file| require file }
|
|
15
|
-
Dir[File.join(__dir__, 'surfaces', '*.rb')].sort.each { |file| require file }
|
|
16
|
-
|
|
17
11
|
module_function
|
|
18
12
|
|
|
19
13
|
def blocks
|
data/lib/slack-ruby-block-kit.rb
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require 'zeitwerk'
|
|
4
|
+
|
|
5
|
+
loader = Zeitwerk::Loader.new
|
|
6
|
+
loader.tag = 'slack-ruby-block-kit'
|
|
7
|
+
loader.push_dir(__dir__)
|
|
8
|
+
loader.ignore(__FILE__)
|
|
9
|
+
loader.inflector.inflect('version' => 'VERSION')
|
|
10
|
+
loader.setup
|
|
11
|
+
|
|
12
|
+
require 'slack/block_kit'
|
|
13
|
+
|
|
14
|
+
loader.eager_load
|
data/{bin → script}/console
RENAMED
data/script/lint
ADDED
data/script/test
ADDED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require 'slack/block_kit/version'
|
|
3
|
+
require_relative 'lib/slack/block_kit/version'
|
|
6
4
|
|
|
7
5
|
Gem::Specification.new do |spec|
|
|
8
6
|
spec.name = 'slack-ruby-block-kit'
|
|
@@ -20,4 +18,8 @@ Gem::Specification.new do |spec|
|
|
|
20
18
|
end
|
|
21
19
|
spec.require_paths = ['lib']
|
|
22
20
|
spec.required_ruby_version = '>= 2.5'
|
|
21
|
+
spec.metadata = {
|
|
22
|
+
'rubygems_mfa_required' => 'true'
|
|
23
|
+
}
|
|
24
|
+
spec.add_dependency 'zeitwerk', '~> 2.6'
|
|
23
25
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
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.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christian Gregg
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: zeitwerk
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.6'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.6'
|
|
13
27
|
description:
|
|
14
28
|
email:
|
|
15
29
|
- c_arlt@hotmail.com
|
|
@@ -18,8 +32,11 @@ extensions: []
|
|
|
18
32
|
extra_rdoc_files: []
|
|
19
33
|
files:
|
|
20
34
|
- ".deepsource.toml"
|
|
35
|
+
- ".devcontainer/Dockerfile"
|
|
36
|
+
- ".devcontainer/devcontainer.json"
|
|
21
37
|
- ".github/dependabot.yml"
|
|
22
38
|
- ".github/workflows/ci.yml"
|
|
39
|
+
- ".github/workflows/release.yml"
|
|
23
40
|
- ".gitignore"
|
|
24
41
|
- ".rspec"
|
|
25
42
|
- ".rubocop.yml"
|
|
@@ -29,7 +46,6 @@ files:
|
|
|
29
46
|
- LICENSE.txt
|
|
30
47
|
- README.md
|
|
31
48
|
- Rakefile
|
|
32
|
-
- bin/console
|
|
33
49
|
- lib/slack-ruby-block-kit.rb
|
|
34
50
|
- lib/slack/block_kit.rb
|
|
35
51
|
- lib/slack/block_kit/blocks.rb
|
|
@@ -44,7 +60,7 @@ files:
|
|
|
44
60
|
- lib/slack/block_kit/element/channels_select.rb
|
|
45
61
|
- lib/slack/block_kit/element/checkboxes.rb
|
|
46
62
|
- lib/slack/block_kit/element/conversations_select.rb
|
|
47
|
-
- lib/slack/block_kit/element/
|
|
63
|
+
- lib/slack/block_kit/element/datepicker.rb
|
|
48
64
|
- lib/slack/block_kit/element/external_select.rb
|
|
49
65
|
- lib/slack/block_kit/element/image.rb
|
|
50
66
|
- lib/slack/block_kit/element/multi_channels_select.rb
|
|
@@ -71,11 +87,15 @@ files:
|
|
|
71
87
|
- lib/slack/surfaces/home.rb
|
|
72
88
|
- lib/slack/surfaces/message.rb
|
|
73
89
|
- lib/slack/surfaces/modal.rb
|
|
90
|
+
- script/console
|
|
91
|
+
- script/lint
|
|
92
|
+
- script/test
|
|
74
93
|
- slack-ruby-block-kit.gemspec
|
|
75
94
|
homepage: https://github.com/CGA1123/slack-ruby-block-kit
|
|
76
95
|
licenses:
|
|
77
96
|
- MIT
|
|
78
|
-
metadata:
|
|
97
|
+
metadata:
|
|
98
|
+
rubygems_mfa_required: 'true'
|
|
79
99
|
post_install_message:
|
|
80
100
|
rdoc_options: []
|
|
81
101
|
require_paths:
|
|
@@ -91,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
91
111
|
- !ruby/object:Gem::Version
|
|
92
112
|
version: '0'
|
|
93
113
|
requirements: []
|
|
94
|
-
rubygems_version: 3.
|
|
114
|
+
rubygems_version: 3.3.21
|
|
95
115
|
signing_key:
|
|
96
116
|
specification_version: 4
|
|
97
117
|
summary: A ruby wrapper for Slack's Block Kit
|