slack-ruby-block-kit 0.7.0 → 0.8.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: fa3cc74b7d6e5de2e6889ec9fdc8ba02b8678be5731708cb7b5319985d839354
4
- data.tar.gz: a261f505882c2662bd1009ff3a020a394154dcfe336439e032e0942085a2df46
3
+ metadata.gz: ba4b59b1f8d591f6560563d913833ea5193d3c0ad1ff46e30b4484949d8cfeda
4
+ data.tar.gz: 90c8576e1fadb6b9a17d8e6c76f9c871e073fa0cab1e9178a26959b80e62b1fa
5
5
  SHA512:
6
- metadata.gz: 99d3a21decd19a4cfb54351bf31d2ec36516f2777a010ceae26e21b121f3bf229b8c8df2d7a9cef7598ae8fe2f93e42642321d8d7cd72cccdc8b384a62845da2
7
- data.tar.gz: c90b7442867bc51d87d8d1bb2c6a34193bcc6ad3cec7808527955e5bc0b157360ffac521ed58b8bd545fca76c3bf86f4d459e649eb26f0e5a69b10a990aa4076
6
+ metadata.gz: 37e969657c3cd6f54fd0f4d9a77292b4740917463823b84af9325a87455b6b686af353d98769a09d6e36e2ddd503e62fc1d460f981c359326deb87232349d89c
7
+ data.tar.gz: af06784a17f10737b24c85b3ee2b59dd34f0bd61da21e19234d1cca04e213a195ca5698ec8ddbb876dd3a8fdf5894814b2c39da65305747f78a907401fbf5ccb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack-ruby-block-kit (0.7.0)
4
+ slack-ruby-block-kit (0.8.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -14,9 +14,9 @@ GEM
14
14
  multipart-post (>= 1.2, < 3)
15
15
  method_source (1.0.0)
16
16
  multipart-post (2.1.1)
17
- parallel (1.19.1)
18
- parser (2.7.1.3)
19
- ast (~> 2.4.0)
17
+ parallel (1.19.2)
18
+ parser (2.7.1.4)
19
+ ast (~> 2.4.1)
20
20
  pry (0.13.1)
21
21
  coderay (~> 1.1)
22
22
  method_source (~> 1.0)
@@ -39,13 +39,13 @@ GEM
39
39
  rspec-support (3.9.3)
40
40
  rspec_junit_formatter (0.4.1)
41
41
  rspec-core (>= 2, < 4, != 2.12.0)
42
- rubocop (0.85.1)
42
+ rubocop (0.86.0)
43
43
  parallel (~> 1.10)
44
44
  parser (>= 2.7.0.1)
45
45
  rainbow (>= 2.2.2, < 4.0)
46
46
  regexp_parser (>= 1.7)
47
47
  rexml
48
- rubocop-ast (>= 0.0.3)
48
+ rubocop-ast (>= 0.0.3, < 1.0)
49
49
  ruby-progressbar (~> 1.7)
50
50
  unicode-display_width (>= 1.4.0, < 2.0)
51
51
  rubocop-ast (0.0.3)
@@ -6,7 +6,7 @@ module Slack
6
6
  module Element; end
7
7
  module Layout; end
8
8
 
9
- VERSION = '0.7.0'
9
+ VERSION = '0.8.0'
10
10
 
11
11
  Dir[File.join(__dir__, 'block_kit', 'composition', '*.rb')].sort.each { |file| require file }
12
12
  Dir[File.join(__dir__, 'block_kit', 'element', '*.rb')].sort.each { |file| require file }
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ module Composition
6
+ # Provides a way to filter the list of options in a conversations select menu
7
+ # or conversations multi-select menu.
8
+ #
9
+ # @param [Array] only - "include" field
10
+ #
11
+ # https://api.slack.com/reference/block-kit/composition-objects#filter_conversations
12
+ # https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select
13
+ # https://api.slack.com/reference/block-kit/block-elements#conversation_select
14
+ class ConversationFilter
15
+ def initialize(only: nil,
16
+ exclude_external_shared_channels: nil,
17
+ exclude_bot_users: nil)
18
+ @only = only
19
+ @exclude_external_shared_channels = exclude_external_shared_channels
20
+ @exclude_bot_users = exclude_bot_users
21
+ end
22
+
23
+ def as_json(*)
24
+ {
25
+ include: @only,
26
+ exclude_external_shared_channels: @exclude_external_shared_channels,
27
+ exclude_bot_users: @exclude_bot_users
28
+ }.compact
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -22,6 +22,7 @@ module Slack
22
22
  @placeholder = Composition::PlainText.new(text: placeholder, emoji: emoji)
23
23
  @action_id = action_id
24
24
  @initial_conversation = initial
25
+ @filter = nil
25
26
 
26
27
  yield(self) if block_given?
27
28
  end
@@ -34,13 +35,26 @@ module Slack
34
35
  self
35
36
  end
36
37
 
38
+ def filter(only: nil,
39
+ exclude_external_shared_channels: nil,
40
+ exclude_bot_users: nil)
41
+ @filter = Composition::ConversationFilter.new(
42
+ only: only,
43
+ exclude_external_shared_channels: exclude_external_shared_channels,
44
+ exclude_bot_users: exclude_bot_users
45
+ )
46
+
47
+ self
48
+ end
49
+
37
50
  def as_json(*)
38
51
  {
39
52
  type: TYPE,
40
53
  placeholder: @placeholder.as_json,
41
54
  action_id: @action_id,
42
55
  initial_conversation: @initial_conversation,
43
- confirm: @confirm&.as_json
56
+ confirm: @confirm&.as_json,
57
+ filter: @filter&.as_json
44
58
  }.compact
45
59
  end
46
60
  end
@@ -24,6 +24,7 @@ module Slack
24
24
  @initial_conversation = initial
25
25
  @confirm = nil
26
26
  @max_selected_items = max_selected_items
27
+ @filter = nil
27
28
 
28
29
  yield(self) if block_given?
29
30
  end
@@ -36,6 +37,18 @@ module Slack
36
37
  self
37
38
  end
38
39
 
40
+ def filter(only: nil,
41
+ exclude_external_shared_channels: nil,
42
+ exclude_bot_users: nil)
43
+ @filter = Composition::ConversationFilter.new(
44
+ only: only,
45
+ exclude_external_shared_channels: exclude_external_shared_channels,
46
+ exclude_bot_users: exclude_bot_users
47
+ )
48
+
49
+ self
50
+ end
51
+
39
52
  def as_json(*)
40
53
  {
41
54
  type: TYPE,
@@ -43,7 +56,8 @@ module Slack
43
56
  action_id: @action_id,
44
57
  initial_conversation: @initial_conversation,
45
58
  confirm: @confirm&.as_json,
46
- max_selected_items: @max_selected_items
59
+ max_selected_items: @max_selected_items,
60
+ filter: @filter&.as_json
47
61
  }.compact
48
62
  end
49
63
  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.7.0
4
+ version: 0.8.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: 2020-06-19 00:00:00.000000000 Z
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,6 +159,7 @@ files:
159
159
  - lib/slack/block_kit.rb
160
160
  - lib/slack/block_kit/blocks.rb
161
161
  - lib/slack/block_kit/composition/confirmation_dialog.rb
162
+ - lib/slack/block_kit/composition/conversation_filter.rb
162
163
  - lib/slack/block_kit/composition/mrkdwn.rb
163
164
  - lib/slack/block_kit/composition/option.rb
164
165
  - lib/slack/block_kit/composition/option_group.rb