slack-ruby-block-kit 0.9.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.deepsource.toml +15 -0
  3. data/.github/workflows/ci.yml +33 -0
  4. data/.rubocop.yml +22 -2
  5. data/CHANGELOG.md +98 -0
  6. data/Gemfile +13 -1
  7. data/Gemfile.lock +61 -43
  8. data/README.md +3 -1
  9. data/lib/slack/block_kit.rb +2 -2
  10. data/lib/slack/block_kit/blocks.rb +18 -0
  11. data/lib/slack/block_kit/composition/confirmation_dialog.rb +16 -0
  12. data/lib/slack/block_kit/composition/option.rb +6 -1
  13. data/lib/slack/block_kit/composition/option_group.rb +2 -2
  14. data/lib/slack/block_kit/element/button.rb +3 -11
  15. data/lib/slack/block_kit/element/channels_select.rb +3 -11
  16. data/lib/slack/block_kit/element/checkboxes.rb +53 -0
  17. data/lib/slack/block_kit/element/conversations_select.rb +3 -11
  18. data/lib/slack/block_kit/element/date_picker.rb +3 -9
  19. data/lib/slack/block_kit/element/external_select.rb +3 -12
  20. data/lib/slack/block_kit/element/multi_channels_select.rb +5 -14
  21. data/lib/slack/block_kit/element/multi_conversations_select.rb +5 -14
  22. data/lib/slack/block_kit/element/multi_external_select.rb +5 -14
  23. data/lib/slack/block_kit/element/multi_static_select.rb +18 -25
  24. data/lib/slack/block_kit/element/multi_users_select.rb +5 -14
  25. data/lib/slack/block_kit/element/overflow_menu.rb +4 -11
  26. data/lib/slack/block_kit/element/radio_buttons.rb +53 -0
  27. data/lib/slack/block_kit/element/static_select.rb +20 -25
  28. data/lib/slack/block_kit/element/timepicker.rb +49 -0
  29. data/lib/slack/block_kit/element/users_select.rb +3 -11
  30. data/lib/slack/block_kit/layout/header.rb +29 -0
  31. data/lib/slack/block_kit/layout/input.rb +196 -3
  32. data/lib/slack/block_kit/layout/section.rb +20 -3
  33. data/lib/slack/block_kit/version.rb +7 -0
  34. data/slack-ruby-block-kit.gemspec +1 -18
  35. metadata +17 -138
  36. data/.circleci/config.yml +0 -49
  37. data/.rubocop_todo.yml +0 -33
@@ -10,10 +10,7 @@ module Slack
10
10
  # with any of the available block elements.
11
11
  #
12
12
  # https://api.slack.com/reference/messaging/blocks#section
13
- # rubocop:disable Metrics/ClassLength
14
13
  class Section
15
- # rubocop:enable Metrics/ClassLength
16
-
17
14
  include Section::MultiSelectElements
18
15
  TYPE = 'section'
19
16
 
@@ -156,6 +153,26 @@ module Slack
156
153
  accessorise(element)
157
154
  end
158
155
 
156
+ def checkboxes(action_id:)
157
+ element = Element::Checkboxes.new(
158
+ action_id: action_id
159
+ )
160
+
161
+ yield(element) if block_given?
162
+
163
+ accessorise(element)
164
+ end
165
+
166
+ def radio_buttons(action_id:)
167
+ element = Element::RadioButtons.new(
168
+ action_id: action_id
169
+ )
170
+
171
+ yield(element) if block_given?
172
+
173
+ accessorise(element)
174
+ end
175
+
159
176
  def image(url:, alt_text:)
160
177
  accessorise(Element::Image.new(image_url: url, alt_text: alt_text))
161
178
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ VERSION = '0.14.0'
6
+ end
7
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'slack-ruby-block-kit'
5
+ require 'slack/block_kit/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'slack-ruby-block-kit'
@@ -13,13 +13,6 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'https://github.com/CGA1123/slack-ruby-block-kit'
14
14
  spec.license = 'MIT'
15
15
 
16
- if spec.respond_to?(:metadata)
17
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
- else
19
- raise 'RubyGems 2.0 or newer is required to protect against ' \
20
- 'public gem pushes.'
21
- end
22
-
23
16
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
17
  `git ls-files -z`
25
18
  .split("\x0")
@@ -27,14 +20,4 @@ Gem::Specification.new do |spec|
27
20
  end
28
21
  spec.require_paths = ['lib']
29
22
  spec.required_ruby_version = '>= 2.5'
30
-
31
- spec.add_development_dependency 'bundler'
32
- spec.add_development_dependency 'dotenv'
33
- spec.add_development_dependency 'faraday'
34
- spec.add_development_dependency 'pry'
35
- spec.add_development_dependency 'rake'
36
- spec.add_development_dependency 'rspec'
37
- spec.add_development_dependency 'rspec_junit_formatter'
38
- spec.add_development_dependency 'rubocop'
39
- spec.add_development_dependency 'rubocop-rspec'
40
23
  end
metadata CHANGED
@@ -1,154 +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.9.0
4
+ version: 0.14.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: 2020-07-01 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: dotenv
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: faraday
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec_junit_formatter
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- description:
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
140
14
  email:
141
15
  - c_arlt@hotmail.com
142
16
  executables: []
143
17
  extensions: []
144
18
  extra_rdoc_files: []
145
19
  files:
146
- - ".circleci/config.yml"
20
+ - ".deepsource.toml"
147
21
  - ".github/dependabot.yml"
22
+ - ".github/workflows/ci.yml"
148
23
  - ".gitignore"
149
24
  - ".rspec"
150
25
  - ".rubocop.yml"
151
- - ".rubocop_todo.yml"
26
+ - CHANGELOG.md
152
27
  - Gemfile
153
28
  - Gemfile.lock
154
29
  - LICENSE.txt
@@ -166,6 +41,7 @@ files:
166
41
  - lib/slack/block_kit/composition/plain_text.rb
167
42
  - lib/slack/block_kit/element/button.rb
168
43
  - lib/slack/block_kit/element/channels_select.rb
44
+ - lib/slack/block_kit/element/checkboxes.rb
169
45
  - lib/slack/block_kit/element/conversations_select.rb
170
46
  - lib/slack/block_kit/element/date_picker.rb
171
47
  - lib/slack/block_kit/element/external_select.rb
@@ -177,15 +53,19 @@ files:
177
53
  - lib/slack/block_kit/element/multi_users_select.rb
178
54
  - lib/slack/block_kit/element/overflow_menu.rb
179
55
  - lib/slack/block_kit/element/plain_text_input.rb
56
+ - lib/slack/block_kit/element/radio_buttons.rb
180
57
  - lib/slack/block_kit/element/static_select.rb
58
+ - lib/slack/block_kit/element/timepicker.rb
181
59
  - lib/slack/block_kit/element/users_select.rb
182
60
  - lib/slack/block_kit/layout/actions.rb
183
61
  - lib/slack/block_kit/layout/context.rb
184
62
  - lib/slack/block_kit/layout/divider.rb
63
+ - lib/slack/block_kit/layout/header.rb
185
64
  - lib/slack/block_kit/layout/image.rb
186
65
  - lib/slack/block_kit/layout/input.rb
187
66
  - lib/slack/block_kit/layout/section.rb
188
67
  - lib/slack/block_kit/layout/section/multi_select_elements.rb
68
+ - lib/slack/block_kit/version.rb
189
69
  - lib/slack/surfaces/home.rb
190
70
  - lib/slack/surfaces/message.rb
191
71
  - lib/slack/surfaces/modal.rb
@@ -193,9 +73,8 @@ files:
193
73
  homepage: https://github.com/CGA1123/slack-ruby-block-kit
194
74
  licenses:
195
75
  - MIT
196
- metadata:
197
- allowed_push_host: https://rubygems.org
198
- post_install_message:
76
+ metadata: {}
77
+ post_install_message:
199
78
  rdoc_options: []
200
79
  require_paths:
201
80
  - lib
@@ -210,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
89
  - !ruby/object:Gem::Version
211
90
  version: '0'
212
91
  requirements: []
213
- rubygems_version: 3.0.3
214
- signing_key:
92
+ rubygems_version: 3.2.3
93
+ signing_key:
215
94
  specification_version: 4
216
95
  summary: A ruby wrapper for Slack's Block Kit
217
96
  test_files: []
data/.circleci/config.yml DELETED
@@ -1,49 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- docker:
5
- - image: circleci/ruby:2.7
6
-
7
- working_directory: ~/repo
8
-
9
- steps:
10
- - checkout
11
- - restore_cache:
12
- keys:
13
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
14
- - v1-dependencies-
15
-
16
- - run:
17
- name: bundle
18
- command: |
19
- bundle install --jobs=4 --retry=3 --path vendor/bundle
20
-
21
- - save_cache:
22
- paths:
23
- - ./vendor/bundle
24
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
25
-
26
- - run:
27
- name: rspec
28
- command: |
29
- mkdir /tmp/test-results
30
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
31
- circleci tests split --split-by=timings)"
32
-
33
- bundle exec rspec \
34
- --format progress \
35
- --format RspecJunitFormatter \
36
- --out /tmp/test-results/rspec.xml \
37
- --format progress \
38
- $TEST_FILES
39
-
40
- # collect reports
41
- - store_test_results:
42
- path: /tmp/test-results
43
- - store_artifacts:
44
- path: /tmp/test-results
45
- destination: test-results
46
-
47
- - run:
48
- name: rubocop
49
- command: bundle exec rubocop -p
data/.rubocop_todo.yml DELETED
@@ -1,33 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config --no-auto-gen-timestamp`
3
- # using RuboCop version 0.63.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 5
10
- # Configuration parameters: CountComments, ExcludedMethods.
11
- # ExcludedMethods: refine
12
- Metrics/BlockLength:
13
- Max: 63
14
-
15
- # Offense count: 1
16
- # Configuration parameters: CountComments.
17
- Metrics/ClassLength:
18
- Max: 117
19
-
20
- # Offense count: 5
21
- # Configuration parameters: Max.
22
- RSpec/ExampleLength:
23
- Exclude:
24
- - 'spec/lib/slack/block_kit/composition/confirmation_dialog_spec.rb'
25
- - 'spec/lib/slack/block_kit/composition/option_group_spec.rb'
26
- - 'spec/lib/slack/block_kit/composition/option_spec.rb'
27
-
28
- # Offense count: 4
29
- Style/Documentation:
30
- Exclude:
31
- - 'spec/**/*'
32
- - 'test/**/*'
33
- - 'lib/slack/block_kit.rb'