slack-ruby-block-kit 0.21.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5468729c5b17bca80befff3cb61182d2bb28cc5e72b04fe3f4712c7af9b9c201
4
- data.tar.gz: 5dfe1013be40d5a50ca3d29c613da3452442e837df421d3716638e8b17de93e1
3
+ metadata.gz: 0bc7d017312a1b9050129594164e9b4eff6516df696e52a72eeced5b434a862d
4
+ data.tar.gz: c6b04c9e520b33be39ef4efcf492b798e70558ae61024e137eb71ecac3fdb9d8
5
5
  SHA512:
6
- metadata.gz: e33f622b3a8b6fcb925ace62fec77046c6ba461237bd17870233727630274ddd7c79e8a0e0d7341888866795d6382bdd014f5b3ae3cede0910304ae6d01e9c84
7
- data.tar.gz: 49a1e0364f053e1d0c81830044be1bf93496276ea9d91cf9e35c42bcd601577b0442cfb1ee0d3f9a52e5e57a7ecece72a9363c28f9b9415861f210c217a8ce85
6
+ metadata.gz: 5aa13638ce2aad5b93175bd66b16320533693e81e20f3ec95df4f6c916f85da31c47d15aec93933b79b2d3d34da320588036e32666baa5b18bb5c81f3c4cd89d
7
+ data.tar.gz: 6a2c6f5fbb5e7447069d421e1ec9cb99d44b4eec3f62b49a6df34e31b27336e2a12fd7f870398baafbdabc87b50d881d9c2537e121164d7e7ed7adbbe6249c14
@@ -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,17 @@ 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
+
28
39
  ## [0.21.0] - 2023-02-19
29
40
 
30
41
  ### Added
@@ -162,7 +173,8 @@ This release contains a breaking change on the `Layout::Actions` interface.
162
173
  - Fixed initial options in multi select blocks (#46 by @caalberts)
163
174
 
164
175
 
165
- [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.21.0...HEAD
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
166
178
  [0.21.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.20.0...v0.21.0
167
179
  [0.20.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.19.0...v0.20.0
168
180
  [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.22.0)
5
5
  zeitwerk (~> 2.6)
6
6
 
7
7
  GEM
@@ -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
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
 
@@ -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
@@ -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.22.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.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: 2023-02-19 00:00:00.000000000 Z
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: []
@@ -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: []