slack-ruby-block-kit 0.20.0 → 0.21.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44fcae6fb294fcbfa6ca384c2a0347e017a512071e0b80c0fa32a222aed25ce4
4
- data.tar.gz: 8aeeab3e359a31780efa1bc4a112a2ea6ecee249fd5d8053a1934e33a8b583ad
3
+ metadata.gz: 5468729c5b17bca80befff3cb61182d2bb28cc5e72b04fe3f4712c7af9b9c201
4
+ data.tar.gz: 5dfe1013be40d5a50ca3d29c613da3452442e837df421d3716638e8b17de93e1
5
5
  SHA512:
6
- metadata.gz: 9826b5aeafed46bbaed087d3dc6840c02da3c28c556b6d21954b24a5784a4c10cb1894b5f20bc06856f89678a1aec3063386a46e7cc3d268fdb344186ab91899
7
- data.tar.gz: 32a1d531da9ba92c3b526b84d3c0ea6c9fe962d6386705dcbe7752848c37fc701de1412fa3fa405d0a3a320c984f44383b29c8a5bb19f685ff914be3d9e922db
6
+ metadata.gz: e33f622b3a8b6fcb925ace62fec77046c6ba461237bd17870233727630274ddd7c79e8a0e0d7341888866795d6382bdd014f5b3ae3cede0910304ae6d01e9c84
7
+ data.tar.gz: 49a1e0364f053e1d0c81830044be1bf93496276ea9d91cf9e35c42bcd601577b0442cfb1ee0d3f9a52e5e57a7ecece72a9363c28f9b9415861f210c217a8ce85
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.7', '3.0' ]
19
+ ruby: [ '2.6', '2.7', '3.0', '3.1' ]
20
20
  experimental: [ false ]
21
21
  name: Ruby ${{ matrix.ruby }}
22
22
  steps:
data/CHANGELOG.md CHANGED
@@ -25,6 +25,13 @@ 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.21.0] - 2023-02-19
29
+
30
+ ### Added
31
+ - `Slack::BlockKit::Element::UrlTextInput` (#164 by @dimerman)
32
+ - `Slack::BlockKit::Element::EmailTextInput` (#166 by @CGA1123)
33
+ - `Slack::BlockKit::Element::Datetimepicker` (#167 by @CGA1123)
34
+
28
35
  ## [0.20.0] - 2022-09-25
29
36
 
30
37
  ### Added
@@ -155,7 +162,8 @@ This release contains a breaking change on the `Layout::Actions` interface.
155
162
  - Fixed initial options in multi select blocks (#46 by @caalberts)
156
163
 
157
164
 
158
- [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.20.0...HEAD
165
+ [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.21.0...HEAD
166
+ [0.21.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.20.0...v0.21.0
159
167
  [0.20.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.19.0...v0.20.0
160
168
  [0.19.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.18.0...v0.19.0
161
169
  [0.18.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.17.0...v0.18.0
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ 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.5'
12
+ gem 'rspec_junit_formatter', '~> 0.6'
13
13
 
14
14
  gem 'codecov', '~> 0.6', require: false
15
15
  gem 'rubocop', '~> 1', require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack-ruby-block-kit (0.20.0)
4
+ slack-ruby-block-kit (0.21.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.2)
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.2.3)
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.1)
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.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)
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.11.0)
61
- rspec-mocks (3.11.0)
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.11.0)
64
- rspec-support (3.11.0)
65
- rspec_junit_formatter (0.5.1)
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.0)
91
+ zeitwerk (2.6.7)
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.5)
105
+ rspec_junit_formatter (~> 0.6)
106
106
  rubocop (~> 1)
107
107
  rubocop-rake (~> 0.6)
108
108
  rubocop-rspec (~> 2)
@@ -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
@@ -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
@@ -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
@@ -104,6 +104,17 @@ module Slack
104
104
  self
105
105
  end
106
106
 
107
+ def datetimepicker(action_id:, initial: nil)
108
+ @element = Element::Datetimepicker.new(
109
+ action_id: action_id,
110
+ initial: initial
111
+ )
112
+
113
+ yield(@element) if block_given?
114
+
115
+ self
116
+ end
117
+
107
118
  def multi_channels_select(placeholder:, action_id:, initial: nil, emoji: nil, max_selected_items: nil)
108
119
  @element = Element::MultiChannelsSelect.new(
109
120
  placeholder: placeholder,
@@ -201,6 +212,34 @@ module Slack
201
212
  self
202
213
  end
203
214
 
215
+ def url_text_input(
216
+ action_id:,
217
+ placeholder: nil,
218
+ initial_value: nil,
219
+ focus_on_load: nil
220
+ )
221
+ @element = Element::UrlTextInput.new(
222
+ action_id: action_id,
223
+ placeholder: placeholder,
224
+ initial_value: initial_value,
225
+ focus_on_load: focus_on_load
226
+ )
227
+ end
228
+
229
+ def email_text_input(
230
+ action_id:,
231
+ placeholder: nil,
232
+ initial_value: nil,
233
+ focus_on_load: nil
234
+ )
235
+ @element = Element::EmailTextInput.new(
236
+ action_id: action_id,
237
+ placeholder: placeholder,
238
+ initial_value: initial_value,
239
+ focus_on_load: focus_on_load
240
+ )
241
+ end
242
+
204
243
  def radio_buttons(action_id:)
205
244
  @element = Element::RadioButtons.new(action_id: action_id)
206
245
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Slack
4
4
  module BlockKit
5
- VERSION = '0.20.0'
5
+ VERSION = '0.21.0'
6
6
  end
7
7
  end
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.20.0
4
+ version: 0.21.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: 2022-09-25 00:00:00.000000000 Z
11
+ date: 2023-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -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
@@ -73,6 +75,7 @@ files:
73
75
  - lib/slack/block_kit/element/radio_buttons.rb
74
76
  - lib/slack/block_kit/element/static_select.rb
75
77
  - lib/slack/block_kit/element/timepicker.rb
78
+ - lib/slack/block_kit/element/url_text_input.rb
76
79
  - lib/slack/block_kit/element/users_select.rb
77
80
  - lib/slack/block_kit/formatting.rb
78
81
  - lib/slack/block_kit/layout/actions.rb
@@ -112,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
115
  - !ruby/object:Gem::Version
113
116
  version: '0'
114
117
  requirements: []
115
- rubygems_version: 3.3.22
118
+ rubygems_version: 3.4.7
116
119
  signing_key:
117
120
  specification_version: 4
118
121
  summary: A ruby wrapper for Slack's Block Kit