slack-ruby-block-kit 0.10.0 → 0.14.1

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 +19 -2
  5. data/CHANGELOG.md +65 -3
  6. data/Gemfile +13 -1
  7. data/Gemfile.lock +66 -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 +15 -26
  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 +3 -12
  21. data/lib/slack/block_kit/element/multi_conversations_select.rb +3 -12
  22. data/lib/slack/block_kit/element/multi_external_select.rb +3 -12
  23. data/lib/slack/block_kit/element/multi_static_select.rb +18 -26
  24. data/lib/slack/block_kit/element/multi_users_select.rb +3 -12
  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 +11 -4
  33. data/lib/slack/block_kit/version.rb +7 -0
  34. data/slack-ruby-block-kit.gemspec +1 -18
  35. metadata +11 -134
  36. data/.circleci/config.yml +0 -49
  37. data/.rubocop_todo.yml +0 -40
@@ -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
 
@@ -166,6 +163,16 @@ module Slack
166
163
  accessorise(element)
167
164
  end
168
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
+
169
176
  def image(url:, alt_text:)
170
177
  accessorise(Element::Image.new(image_url: url, alt_text: alt_text))
171
178
  end
@@ -179,7 +186,7 @@ module Slack
179
186
  def as_json(*)
180
187
  {
181
188
  type: TYPE,
182
- text: @text.as_json,
189
+ text: @text&.as_json,
183
190
  block_id: @block_id,
184
191
  fields: @fields&.map(&:as_json),
185
192
  accessory: @accessory&.as_json
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ VERSION = '0.14.1'
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,141 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-block-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.14.1
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-09-11 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'
11
+ date: 2021-05-05 00:00:00.000000000 Z
12
+ dependencies: []
139
13
  description:
140
14
  email:
141
15
  - c_arlt@hotmail.com
@@ -143,12 +17,12 @@ 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"
152
26
  - CHANGELOG.md
153
27
  - Gemfile
154
28
  - Gemfile.lock
@@ -179,15 +53,19 @@ files:
179
53
  - lib/slack/block_kit/element/multi_users_select.rb
180
54
  - lib/slack/block_kit/element/overflow_menu.rb
181
55
  - lib/slack/block_kit/element/plain_text_input.rb
56
+ - lib/slack/block_kit/element/radio_buttons.rb
182
57
  - lib/slack/block_kit/element/static_select.rb
58
+ - lib/slack/block_kit/element/timepicker.rb
183
59
  - lib/slack/block_kit/element/users_select.rb
184
60
  - lib/slack/block_kit/layout/actions.rb
185
61
  - lib/slack/block_kit/layout/context.rb
186
62
  - lib/slack/block_kit/layout/divider.rb
63
+ - lib/slack/block_kit/layout/header.rb
187
64
  - lib/slack/block_kit/layout/image.rb
188
65
  - lib/slack/block_kit/layout/input.rb
189
66
  - lib/slack/block_kit/layout/section.rb
190
67
  - lib/slack/block_kit/layout/section/multi_select_elements.rb
68
+ - lib/slack/block_kit/version.rb
191
69
  - lib/slack/surfaces/home.rb
192
70
  - lib/slack/surfaces/message.rb
193
71
  - lib/slack/surfaces/modal.rb
@@ -195,8 +73,7 @@ files:
195
73
  homepage: https://github.com/CGA1123/slack-ruby-block-kit
196
74
  licenses:
197
75
  - MIT
198
- metadata:
199
- allowed_push_host: https://rubygems.org
76
+ metadata: {}
200
77
  post_install_message:
201
78
  rdoc_options: []
202
79
  require_paths:
@@ -212,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
89
  - !ruby/object:Gem::Version
213
90
  version: '0'
214
91
  requirements: []
215
- rubygems_version: 3.0.3
92
+ rubygems_version: 3.2.3
216
93
  signing_key:
217
94
  specification_version: 4
218
95
  summary: A ruby wrapper for Slack's Block Kit
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,40 +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: 1
21
- # Configuration parameters: IgnoredMethods.
22
- Metrics/CyclomaticComplexity:
23
- Exclude:
24
- - 'lib/slack/block_kit/element/multi_static_select.rb'
25
-
26
- # Offense count: 5
27
- # Configuration parameters: Max.
28
- RSpec/ExampleLength:
29
- Exclude:
30
- - 'spec/lib/slack/block_kit/composition/confirmation_dialog_spec.rb'
31
- - 'spec/lib/slack/block_kit/composition/option_group_spec.rb'
32
- - 'spec/lib/slack/block_kit/composition/option_spec.rb'
33
- - 'spec/lib/slack/block_kit/element/checkboxes_spec.rb'
34
-
35
- # Offense count: 4
36
- Style/Documentation:
37
- Exclude:
38
- - 'spec/**/*'
39
- - 'test/**/*'
40
- - 'lib/slack/block_kit.rb'