slack-ruby-block-kit 0.21.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5468729c5b17bca80befff3cb61182d2bb28cc5e72b04fe3f4712c7af9b9c201
4
- data.tar.gz: 5dfe1013be40d5a50ca3d29c613da3452442e837df421d3716638e8b17de93e1
3
+ metadata.gz: 0c1823b83c807b7c74ed6dc2a6c9adfd1945de04ab0cc6728d2d0864e0e6ed2e
4
+ data.tar.gz: 2b90261eac6e5b840d92b9d6492ef59c7a98558104c95c3b0cd3821fe8a00619
5
5
  SHA512:
6
- metadata.gz: e33f622b3a8b6fcb925ace62fec77046c6ba461237bd17870233727630274ddd7c79e8a0e0d7341888866795d6382bdd014f5b3ae3cede0910304ae6d01e9c84
7
- data.tar.gz: 49a1e0364f053e1d0c81830044be1bf93496276ea9d91cf9e35c42bcd601577b0442cfb1ee0d3f9a52e5e57a7ecece72a9363c28f9b9415861f210c217a8ce85
6
+ metadata.gz: 41292e69ae30c232a9363259bc393cad93bac9b795a2e1bfc96c378f439072cb60947df3992c1f5a62a551bfa40c140a8f0b65fbfe659497355f524ad105bae0
7
+ data.tar.gz: fed6537c6e306897a06b34a676fef07289694c36350e097cbe5f7f45abe2493c92f0175c5d5a7d7f7e6e9b410aa43bb1f0a226f7540de59f3fe37acd8911a208
@@ -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
@@ -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: ./bin/deepsource report --analyzer test-coverage --key ruby --value-file ./coverage/.resultset.json
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
@@ -7,7 +7,7 @@ AllCops:
7
7
  NewCops: enable
8
8
 
9
9
  Layout/LineLength:
10
- Max: 120
10
+ Enabled: false
11
11
 
12
12
  Style/AsciiComments:
13
13
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -25,6 +25,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
25
25
  ### Security
26
26
  - N/A
27
27
 
28
+
29
+ ## [0.23.0] - 2023-08-07
30
+
31
+ ### Added
32
+
33
+ - Added ability to set `emoji` property via `Slack::BlockKit::Blocks#input` (#175 by @bmorton)
34
+ - Added ability to set `emoji` property via `Slack::BlockKit::Element::RadioButtons#option` (#175 by @bmorton)
35
+
36
+ ## [0.22.0] - 2023-08-05
37
+
38
+ ### Added
39
+ - Added `Slack::BlockKit::Element::NumberInput` (#169 by @CGA1123)
40
+ - Added `response_url_enabled` parameter to following elements (#171 by @rinasergeeva):
41
+ - `Slack::BlockKit::Element::ChannelsSelect`
42
+ - `Slack::BlockKit::Element::ConversationsSelect`
43
+ - Added `default_to_current_conversation` parameter to following elements (#171 by @rinasergeeva):
44
+ - `Slack::BlockKit::Element::ConversationsSelect`
45
+ - `Slack::BlockKit::Element::MultiConversationsSelect`
46
+
28
47
  ## [0.21.0] - 2023-02-19
29
48
 
30
49
  ### Added
@@ -162,7 +181,8 @@ This release contains a breaking change on the `Layout::Actions` interface.
162
181
  - Fixed initial options in multi select blocks (#46 by @caalberts)
163
182
 
164
183
 
165
- [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.21.0...HEAD
184
+ [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.22.0...HEAD
185
+ [0.22.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.21.0...v0.22.0
166
186
  [0.21.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.20.0...v0.21.0
167
187
  [0.20.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.19.0...v0.20.0
168
188
  [0.19.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.18.0...v0.19.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack-ruby-block-kit (0.21.0)
4
+ slack-ruby-block-kit (0.23.0)
5
5
  zeitwerk (~> 2.6)
6
6
 
7
7
  GEM
@@ -53,15 +53,15 @@ GEM
53
53
  rspec-core (~> 3.12.0)
54
54
  rspec-expectations (~> 3.12.0)
55
55
  rspec-mocks (~> 3.12.0)
56
- rspec-core (3.12.0)
56
+ rspec-core (3.12.2)
57
57
  rspec-support (~> 3.12.0)
58
- rspec-expectations (3.12.0)
58
+ rspec-expectations (3.12.3)
59
59
  diff-lcs (>= 1.2.0, < 2.0)
60
60
  rspec-support (~> 3.12.0)
61
- rspec-mocks (3.12.0)
61
+ rspec-mocks (3.12.6)
62
62
  diff-lcs (>= 1.2.0, < 2.0)
63
63
  rspec-support (~> 3.12.0)
64
- rspec-support (3.12.0)
64
+ rspec-support (3.12.1)
65
65
  rspec_junit_formatter (0.6.0)
66
66
  rspec-core (>= 2, < 4, != 2.12.0)
67
67
  rubocop (1.28.2)
@@ -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.7)
91
+ zeitwerk (2.6.11)
92
92
 
93
93
  PLATFORMS
94
94
  ruby
@@ -110,4 +110,4 @@ DEPENDENCIES
110
110
  slack-ruby-block-kit!
111
111
 
112
112
  BUNDLED WITH
113
- 2.2.3
113
+ 2.4.18
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/slack-ruby-block-kit.svg)](https://badge.fury.io/rb/slack-ruby-block-kit)
2
2
  [![codecov](https://codecov.io/gh/CGA1123/slack-ruby-block-kit/branch/master/graph/badge.svg)](https://codecov.io/gh/CGA1123/slack-ruby-block-kit)
3
- [![DeepSource](https://deepsource.io/gh/CGA1123/slack-ruby-block-kit.svg/?label=active+issues&show_trend=true)](https://deepsource.io/gh/CGA1123/slack-ruby-block-kit/?ref=repository-badge)
4
- [![DeepSource](https://deepsource.io/gh/CGA1123/slack-ruby-block-kit.svg/?label=resolved+issues&show_trend=true)](https://deepsource.io/gh/CGA1123/slack-ruby-block-kit/?ref=repository-badge)
5
3
 
6
4
  # Slack::BlockKit
7
5
 
@@ -76,13 +76,14 @@ module Slack
76
76
  append(block)
77
77
  end
78
78
 
79
- def input(label:, hint: nil, block_id: nil, dispatch_action: nil, optional: nil)
79
+ def input(label:, hint: nil, block_id: nil, dispatch_action: nil, optional: nil, emoji: nil)
80
80
  block = Layout::Input.new(
81
81
  label: label,
82
82
  hint: hint,
83
83
  block_id: block_id,
84
84
  dispatch_action: dispatch_action,
85
- optional: optional
85
+ optional: optional,
86
+ emoji: emoji
86
87
  )
87
88
 
88
89
  yield(block) if block_given?
@@ -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
@@ -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
@@ -21,11 +21,12 @@ module Slack
21
21
  yield(self) if block_given?
22
22
  end
23
23
 
24
- def option(value:, text:, initial: false)
24
+ def option(value:, text:, initial: false, emoji: nil)
25
25
  option = Composition::Option.new(
26
26
  value: value,
27
27
  text: text,
28
- initial: initial
28
+ initial: initial,
29
+ emoji: emoji
29
30
  )
30
31
 
31
32
  @options << option
@@ -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?
@@ -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?
@@ -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?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Slack
4
4
  module BlockKit
5
- VERSION = '0.21.0'
5
+ VERSION = '0.23.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.21.0
4
+ version: 0.23.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: 2023-02-19 00:00:00.000000000 Z
11
+ date: 2023-08-07 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: []
@@ -70,6 +70,7 @@ files:
70
70
  - lib/slack/block_kit/element/multi_external_select.rb
71
71
  - lib/slack/block_kit/element/multi_static_select.rb
72
72
  - lib/slack/block_kit/element/multi_users_select.rb
73
+ - lib/slack/block_kit/element/number_input.rb
73
74
  - lib/slack/block_kit/element/overflow_menu.rb
74
75
  - lib/slack/block_kit/element/plain_text_input.rb
75
76
  - lib/slack/block_kit/element/radio_buttons.rb
@@ -100,7 +101,7 @@ licenses:
100
101
  - MIT
101
102
  metadata:
102
103
  rubygems_mfa_required: 'true'
103
- post_install_message:
104
+ post_install_message:
104
105
  rdoc_options: []
105
106
  require_paths:
106
107
  - lib
@@ -115,8 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  - !ruby/object:Gem::Version
116
117
  version: '0'
117
118
  requirements: []
118
- rubygems_version: 3.4.7
119
- signing_key:
119
+ rubygems_version: 3.4.12
120
+ signing_key:
120
121
  specification_version: 4
121
122
  summary: A ruby wrapper for Slack's Block Kit
122
123
  test_files: []