slack-ruby-block-kit 0.13.0 → 0.17.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: 0f8259eb752347ee6abf3210ab4b0f0c44ee962d238e3034185735c4762a8063
4
- data.tar.gz: 7649061472dff64eddb8704311ee17afbd0c29d07ac6d101982725fbf55fbd35
3
+ metadata.gz: 8a488cd59a504fbfd8a214f8ff50299a30dccc1050b825349b1c663deb667281
4
+ data.tar.gz: 21ff7316500a08924c6b3fbb4a08a4d2418f7edf099f6ac51751810b0084b86d
5
5
  SHA512:
6
- metadata.gz: d9ab666ea3cca8ca7ade809cb1fc3881e534d5a9ffb1651f2de2d1ddc30266e6d44ac1a89947b1cba62d35ba59e292479ec33e0098fe50d1b6d7a1d1e77a0184
7
- data.tar.gz: 709140300213ec4afef7c43665e56dd9ccfe673118284d2cb5efbe5a03c87ee9d42fed94e6c8277cc49ffec74d5232108d1b0555c53dcc7e23cc77f6cc70413d
6
+ metadata.gz: 3ae1fffebc4396488b956afdfe06d312936ae027df6bc51b527afa3ed3e7877f7d98bf5aa4915240ca7bf63878432dc602783e42a2171fd99844d4f01880d68c
7
+ data.tar.gz: a78da5148ac91bbde126cd7d72a9f65dae16899270f2b34cfe8ec2c48d46689c11016217a2351ad3a500e6a201bc45e4d8f532919c3261038a3acba37ba43be9
data/.gitignore CHANGED
@@ -8,8 +8,6 @@
8
8
  /spec/examples.txt
9
9
  /tmp/
10
10
 
11
- Gemfile.lock
12
-
13
11
  # rspec failure tracking
14
12
  .rspec_status
15
13
  *.gem
data/.rubocop.yml CHANGED
@@ -2,8 +2,6 @@ require:
2
2
  - rubocop-rake
3
3
  - rubocop-rspec
4
4
 
5
- inherit_from: .rubocop_todo.yml
6
-
7
5
  AllCops:
8
6
  TargetRubyVersion: 2.5.3
9
7
  NewCops: enable
@@ -75,3 +73,15 @@ RSpec/MultipleMemoizedHelpers:
75
73
 
76
74
  RSpec/NestedGroups:
77
75
  Max: 4
76
+
77
+ Style/Documentation:
78
+ Enabled: false
79
+
80
+ Metrics/ClassLength:
81
+ Max: 200
82
+
83
+ Metrics/CyclomaticComplexity:
84
+ Max: 8
85
+
86
+ RSpec/ExampleLength:
87
+ Max: 6
data/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -25,8 +26,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
25
26
  - N/A
26
27
 
27
28
 
29
+ [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.17.0...HEAD
30
+
31
+
32
+ ---
33
+
34
+
35
+ ## [0.17.0] - 2021-06-28
36
+
37
+ ### Added
38
+ - `Slack::BlockKit::Formatting` with utility functions for Slack text formatting (#98 by @CGA1123)
39
+
40
+
41
+ [0.17.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.16.0...v0.17.0
42
+
43
+
44
+ ---
45
+
46
+
47
+ ## [0.16.0] - 2021-06-23
48
+
49
+ This release contains a breaking change on the `Layout::Actions` interface.
50
+
51
+ ### Added
52
+ - Added new `Layout::Actions#checkboxes` method (#96 by @ryanwilsonperkin)
53
+
54
+ ### Removed
55
+ - `Layout::Actions#converstation_select` (use `#conversation_select` instead) (#97 by @ryanwilsonperkin)
56
+
57
+ ### Fixed
58
+ - Fixed name of method in `Layout::Actions` to be `conversation_select` (#97 by @ryanwilsonperkin)
59
+
60
+
61
+ [0.16.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.15.0...v0.16.0
62
+
63
+
64
+ ---
65
+
66
+
67
+ ## [0.15.0] - 2021-06-14
68
+
69
+ ### Added
70
+ - Support `dispatch_action` and `dispatch_action_config` (#94 by @deecewan)
71
+
72
+
73
+ [0.15.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.1...v0.15.0
74
+
75
+
28
76
  ---
29
77
 
78
+
79
+ ## [0.14.1] - 2021-05-05
80
+
81
+ ### Fixed
82
+ - Allow Layout::Section to render without `text` (#87 by @pbendersky)
83
+
84
+
85
+ [0.14.1]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.14.0...v0.14.1
86
+
87
+
88
+ ---
89
+
90
+
91
+ ## [0.14.0] - 2021-02-06
92
+
93
+ ### Added
94
+ - `Slack::BlockKit::Blocks#header` (#74 by @rspeicher)
95
+
96
+
97
+ [0.14.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.13.0...v0.14.0
98
+
99
+
100
+ ---
101
+
102
+
30
103
  ## [0.13.0] - 2020-12-29
31
104
 
32
105
  ### Added
@@ -38,6 +111,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
111
  - Development dependencies now managed by bundler via Gemfile, rather than in gemspec
39
112
 
40
113
 
114
+ [0.13.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.12.0...v0.13.0
115
+
116
+
41
117
  ---
42
118
 
43
119
 
@@ -52,6 +128,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
52
128
  - `Slack::BlockKit::Element::StaticSelect#initial`, use the `initial:` keyword on `#option`
53
129
 
54
130
 
131
+ [0.12.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.11.0...v0.12.0
132
+
133
+
55
134
  ---
56
135
 
57
136
 
@@ -67,6 +146,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
67
146
  - Ruby2.7 kwarg deprecation warnings
68
147
 
69
148
 
149
+ [0.11.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.10.0...v0.11.0
150
+
151
+
70
152
  ---
71
153
 
72
154
 
@@ -79,15 +161,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
79
161
  - Fixed initial options in multi select blocks (#46 by @caalberts)
80
162
 
81
163
 
164
+ [0.10.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.9.0...v0.10.0
165
+
166
+
82
167
  ---
83
168
 
84
169
  See [releases] for previous changes.
85
170
 
86
171
 
87
- [Unreleased]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.13.0...HEAD
88
- [0.13.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.12.0...v0.13.0
89
- [0.12.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.11.0...v0.12.0
90
- [0.11.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.10.0...v0.11.0
91
- [0.10.0]: https://github.com/CGA1123/slack-ruby-block-kit/compare/v0.9.0...v0.10.0
92
-
93
172
  [releases]: https://github.com/CGA1123/slack-ruby-block-kit/releases
data/Gemfile CHANGED
@@ -6,14 +6,13 @@ gemspec
6
6
 
7
7
  gem 'dotenv', '~> 2'
8
8
  gem 'faraday', '~> 1'
9
- gem 'pry', '~> 0.13'
9
+ gem 'pry', '~> 0.14'
10
10
  gem 'rake', '~> 13'
11
11
  gem 'rspec', '~> 3'
12
12
  gem 'rspec_junit_formatter', '~> 0.4'
13
13
 
14
+ gem 'codecov', '~> 0.5', require: false
14
15
  gem 'rubocop', '~> 1', require: false
15
16
  gem 'rubocop-rake', '~> 0.5', require: false
16
17
  gem 'rubocop-rspec', '~> 2', require: false
17
-
18
- gem 'codecov', '~> 0.2', require: false
19
- gem 'simplecov', '~> 0.20', require: false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
18
+ gem 'simplecov', '~> 0.21', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ slack-ruby-block-kit (0.17.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ codecov (0.5.2)
11
+ simplecov (>= 0.15, < 0.22)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.4.4)
14
+ docile (1.3.5)
15
+ dotenv (2.7.6)
16
+ faraday (1.4.3)
17
+ faraday-em_http (~> 1.0)
18
+ faraday-em_synchrony (~> 1.0)
19
+ faraday-excon (~> 1.1)
20
+ faraday-net_http (~> 1.0)
21
+ faraday-net_http_persistent (~> 1.1)
22
+ multipart-post (>= 1.2, < 3)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-em_http (1.0.0)
25
+ faraday-em_synchrony (1.0.0)
26
+ faraday-excon (1.1.0)
27
+ faraday-net_http (1.0.1)
28
+ faraday-net_http_persistent (1.1.0)
29
+ method_source (1.0.0)
30
+ multipart-post (2.1.1)
31
+ parallel (1.20.1)
32
+ parser (3.0.1.1)
33
+ ast (~> 2.4.1)
34
+ pry (0.14.1)
35
+ coderay (~> 1.1)
36
+ method_source (~> 1.0)
37
+ rainbow (3.0.0)
38
+ rake (13.0.3)
39
+ regexp_parser (2.1.1)
40
+ rexml (3.2.5)
41
+ rspec (3.10.0)
42
+ rspec-core (~> 3.10.0)
43
+ rspec-expectations (~> 3.10.0)
44
+ rspec-mocks (~> 3.10.0)
45
+ rspec-core (3.10.1)
46
+ rspec-support (~> 3.10.0)
47
+ rspec-expectations (3.10.1)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-mocks (3.10.2)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-support (3.10.2)
54
+ rspec_junit_formatter (0.4.1)
55
+ rspec-core (>= 2, < 4, != 2.12.0)
56
+ rubocop (1.17.0)
57
+ parallel (~> 1.10)
58
+ parser (>= 3.0.0.0)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.8, < 3.0)
61
+ rexml
62
+ rubocop-ast (>= 1.7.0, < 2.0)
63
+ ruby-progressbar (~> 1.7)
64
+ unicode-display_width (>= 1.4.0, < 3.0)
65
+ rubocop-ast (1.7.0)
66
+ parser (>= 3.0.1.1)
67
+ rubocop-rake (0.5.1)
68
+ rubocop
69
+ rubocop-rspec (2.4.0)
70
+ rubocop (~> 1.0)
71
+ rubocop-ast (>= 1.1.0)
72
+ ruby-progressbar (1.11.0)
73
+ ruby2_keywords (0.0.4)
74
+ simplecov (0.21.2)
75
+ docile (~> 1.1)
76
+ simplecov-html (~> 0.11)
77
+ simplecov_json_formatter (~> 0.1)
78
+ simplecov-html (0.12.3)
79
+ simplecov_json_formatter (0.1.2)
80
+ unicode-display_width (2.0.0)
81
+
82
+ PLATFORMS
83
+ ruby
84
+ x86_64-darwin-19
85
+
86
+ DEPENDENCIES
87
+ codecov (~> 0.5)
88
+ dotenv (~> 2)
89
+ faraday (~> 1)
90
+ pry (~> 0.14)
91
+ rake (~> 13)
92
+ rspec (~> 3)
93
+ rspec_junit_formatter (~> 0.4)
94
+ rubocop (~> 1)
95
+ rubocop-rake (~> 0.5)
96
+ rubocop-rspec (~> 2)
97
+ simplecov (~> 0.21)
98
+ slack-ruby-block-kit!
99
+
100
+ BUNDLED WITH
101
+ 2.2.3
@@ -37,6 +37,12 @@ module Slack
37
37
  append(block)
38
38
  end
39
39
 
40
+ def header(text:, block_id: nil, emoji: nil)
41
+ block = Layout::Header.new(text: text, block_id: block_id, emoji: emoji)
42
+
43
+ append(block)
44
+ end
45
+
40
46
  def image(url:, alt_text:, title: nil, block_id: nil, emoji: nil)
41
47
  block = Layout::Image.new(
42
48
  url: url,
@@ -57,11 +63,12 @@ module Slack
57
63
  append(block)
58
64
  end
59
65
 
60
- def input(label:, hint: nil, block_id: nil)
66
+ def input(label:, hint: nil, block_id: nil, dispatch_action: nil)
61
67
  block = Layout::Input.new(
62
68
  label: label,
63
69
  hint: hint,
64
- block_id: block_id
70
+ block_id: block_id,
71
+ dispatch_action: dispatch_action
65
72
  )
66
73
 
67
74
  yield(block) if block_given?
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ module Composition
6
+ # Determines when a plain-text input element will return a block_actions
7
+ # interaction payload.
8
+ #
9
+ # @param [Array] triggers - values for the `trigger_actions_on` array
10
+ #
11
+ # https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config
12
+ # https://api.slack.com/reference/block-kit/block-elements#input
13
+ class DispatchActionConfiguration
14
+ def initialize(triggers: nil)
15
+ @triggers = triggers || []
16
+ end
17
+
18
+ def trigger_on_enter_pressed
19
+ @triggers << :on_enter_pressed
20
+ end
21
+
22
+ def trigger_on_character_entered
23
+ @triggers << :on_character_entered
24
+ end
25
+
26
+ def as_json(*)
27
+ {
28
+ trigger_actions_on: @triggers.uniq
29
+ }.compact
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -17,12 +17,7 @@ module Slack
17
17
  def initialize(action_id:, placeholder: nil, initial: nil, emoji: nil)
18
18
  @action_id = action_id
19
19
  @initial_date = initial
20
- if placeholder
21
- @placeholder = Composition::PlainText.new(
22
- text: placeholder,
23
- emoji: emoji
24
- )
25
- end
20
+ @placeholder = placeholder_text(placeholder, emoji)
26
21
 
27
22
  yield(self) if block_given?
28
23
  end
@@ -36,6 +31,14 @@ module Slack
36
31
  confirm: confirm&.as_json
37
32
  }.compact
38
33
  end
34
+
35
+ private
36
+
37
+ def placeholder_text(text, emoji)
38
+ return unless text
39
+
40
+ Composition::PlainText.new(text: text, emoji: emoji)
41
+ end
39
42
  end
40
43
  end
41
44
  end
@@ -28,6 +28,15 @@ module Slack
28
28
  @multiline = multiline
29
29
  @min_length = min_length
30
30
  @max_length = max_length
31
+ @dispatch_action_config = nil
32
+ end
33
+
34
+ def dispatch_action_config(triggers: nil)
35
+ @dispatch_action_config = Composition::DispatchActionConfiguration.new(triggers: triggers)
36
+
37
+ yield(@dispatch_action_config) if block_given?
38
+
39
+ self
31
40
  end
32
41
 
33
42
  def as_json(*)
@@ -38,7 +47,8 @@ module Slack
38
47
  multiline: @multiline,
39
48
  min_length: @min_length,
40
49
  max_length: @max_length,
41
- initial_value: @initial_value
50
+ initial_value: @initial_value,
51
+ dispatch_action_config: @dispatch_action_config&.as_json
42
52
  }.compact
43
53
  end
44
54
  end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ # Formatting contains some utility functions to help formatting text
6
+ #
7
+ # See: https://api.slack.com/reference/surfaces/formatting
8
+ module Formatting
9
+ extend self # rubocop:disable Style/ModuleFunction
10
+
11
+ DATE_FORMAT_TOKENS = [
12
+ # 2014-02-18
13
+ DATE_NUM = '{date_num}',
14
+
15
+ # February 18th, 2014
16
+ DATE = '{date}',
17
+
18
+ # Feb 18, 2014
19
+ DATE_SHORT = '{date_short}',
20
+
21
+ # Tuesday, February 18th, 2014
22
+ DATE_LONG = '{date_long}',
23
+
24
+ # February 18th, 2014 but uses "yesterday", "today", or "tomorrow"
25
+ # where
26
+ # appropriate
27
+ DATE_PRETTY = '{date_pretty}',
28
+
29
+ # Feb 18, 2014 but uses "yesterday", "today", or "tomorrow" where
30
+ # appropriate
31
+ DATE_SHORT_PRETTY = '{date_short_pretty}',
32
+
33
+ # Tuesday, February 18th, 2014 but uses "yesterday", "today", or
34
+ # "tomorrow" where appropriate
35
+ DATE_LONG_PRETTY = '{date_long_pretty}',
36
+
37
+ # 6:39 AM or 6:39 PM / 06:39 or 18:39 (depending on user preferences)
38
+ TIME = '{time}',
39
+
40
+ # 6:39:45 AM 6:39:42 PM / 06:39:45 or 18:39:42 (depending on user
41
+ # preferences)
42
+ TIME_SECS = '{time_secs}'
43
+ ].freeze
44
+
45
+ # Format a URL
46
+ #
47
+ # See: https://api.slack.com/reference/surfaces/formatting#links
48
+ def link(url, link_text: nil)
49
+ "<#{[url, link_text].compact.join('|')}>"
50
+ end
51
+
52
+ # Format a mailto link
53
+ #
54
+ # See: https://api.slack.com/reference/surfaces/formatting#links
55
+ def mailto(address, link_text: nil)
56
+ "<mailto:#{[address, link_text].compact.join('|')}>"
57
+ end
58
+
59
+ # Link a public channel
60
+ #
61
+ # See: https://api.slack.com/reference/surfaces/formatting#linking-channels
62
+ def channel(identifier)
63
+ "<##{identifier}>"
64
+ end
65
+
66
+ # Mention a user
67
+ #
68
+ # See: https://api.slack.com/reference/surfaces/formatting#mentioning-users
69
+ def user(identifier)
70
+ "<@#{identifier}>"
71
+ end
72
+
73
+ # Mention a group
74
+ #
75
+ # See: https://api.slack.com/reference/surfaces/formatting#mentioning-groups
76
+ def group(identifier)
77
+ "<!subteam^#{identifier}>"
78
+ end
79
+
80
+ # Mention @here (all active users in the current channel)
81
+ #
82
+ # See: https://api.slack.com/reference/surfaces/formatting#special-mentions
83
+ def at_here
84
+ # additional "|here" is for supporting very old mobile clients apparently!
85
+ '<!here|here>'
86
+ end
87
+
88
+ # Mention @channel (all users in the current channel)
89
+ #
90
+ # See: https://api.slack.com/reference/surfaces/formatting#special-mentions
91
+ def at_channel
92
+ '<!channel>'
93
+ end
94
+
95
+ # Mention @everyone (all users in #general)
96
+ #
97
+ # See: https://api.slack.com/reference/surfaces/formatting#special-mentions
98
+ def at_everyone
99
+ '<!everyone>'
100
+ end
101
+
102
+ # Localise a UNIX timestamp to the user's local timezone
103
+ #
104
+ # See: https://api.slack.com/reference/surfaces/formatting#date-formatting
105
+ def date(timestamp, token_string:, link: nil, fallback_text: nil)
106
+ datetime_str = [timestamp, token_string, link].compact.join('^')
107
+ str = [datetime_str, fallback_text].compact.join('|')
108
+
109
+ "<!date^#{str}>"
110
+ end
111
+
112
+ # Escape special characters (<,>,&) with their HTML entity code so
113
+ # Slack's text parsers knows to interpret them as literals.
114
+ #
115
+ # See: https://api.slack.com/reference/surfaces/formatting#escaping
116
+ def escape(text)
117
+ text
118
+ .gsub('&', '&amp;')
119
+ .gsub('>', '&gt;')
120
+ .gsub('<', '&lt;')
121
+ end
122
+ end
123
+ end
124
+ end
@@ -46,7 +46,7 @@ module Slack
46
46
  append(element)
47
47
  end
48
48
 
49
- def converstation_select(placeholder:, action_id:, initial: nil, emoji: nil)
49
+ def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil)
50
50
  element = Element::ConversationsSelect.new(
51
51
  placeholder: placeholder,
52
52
  action_id: action_id,
@@ -119,6 +119,16 @@ module Slack
119
119
  append(element)
120
120
  end
121
121
 
122
+ def checkboxes(action_id:)
123
+ element = Element::Checkboxes.new(
124
+ action_id: action_id
125
+ )
126
+
127
+ yield(element) if block_given?
128
+
129
+ append(element)
130
+ end
131
+
122
132
  def append(element)
123
133
  @elements << element
124
134
 
@@ -8,9 +8,7 @@ module Slack
8
8
  # a select menu element, a multi-select menu element, or a datepicker.
9
9
  #
10
10
  # https://api.slack.com/reference/block-kit/blocks#input
11
- # rubocop:disable Metrics/ClassLength
12
11
  class Input
13
- # rubocop:enable Metrics/ClassLength
14
12
  TYPE = 'input'
15
13
 
16
14
  attr_accessor :label, :element, :block_id, :hint, :optional, :emoji
@@ -21,13 +19,15 @@ module Slack
21
19
  block_id: nil,
22
20
  hint: nil,
23
21
  optional: nil,
24
- emoji: nil
22
+ emoji: nil,
23
+ dispatch_action: nil
25
24
  )
26
25
  @label = Composition::PlainText.new(text: label, emoji: emoji) if label
27
26
  @hint = Composition::PlainText.new(text: hint, emoji: emoji) if hint
28
27
  @block_id = block_id
29
28
  @optional = optional
30
29
  @element = element
30
+ @dispatch_action = dispatch_action
31
31
  end
32
32
 
33
33
  def conversation_select(placeholder:, action_id:, initial: nil, emoji: nil)
@@ -230,7 +230,8 @@ module Slack
230
230
  label: @label&.as_json,
231
231
  hint: @hint&.as_json,
232
232
  block_id: @block_id,
233
- optional: optional
233
+ optional: optional,
234
+ dispatch_action: @dispatch_action
234
235
  }.compact
235
236
  end
236
237
  end
@@ -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
 
@@ -23,6 +20,7 @@ module Slack
23
20
  @block_id = block_id
24
21
  @fields = nil
25
22
  @accessory = nil
23
+ @text = nil
26
24
 
27
25
  yield(self) if block_given?
28
26
  end
@@ -189,7 +187,7 @@ module Slack
189
187
  def as_json(*)
190
188
  {
191
189
  type: TYPE,
192
- text: @text.as_json,
190
+ text: @text&.as_json,
193
191
  block_id: @block_id,
194
192
  fields: @fields&.map(&:as_json),
195
193
  accessory: @accessory&.as_json
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Slack
4
4
  module BlockKit
5
- VERSION = '0.13.0'
5
+ VERSION = '0.17.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-block-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.17.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-12-29 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - c_arlt@hotmail.com
16
16
  executables: []
@@ -23,9 +23,9 @@ files:
23
23
  - ".gitignore"
24
24
  - ".rspec"
25
25
  - ".rubocop.yml"
26
- - ".rubocop_todo.yml"
27
26
  - CHANGELOG.md
28
27
  - Gemfile
28
+ - Gemfile.lock
29
29
  - LICENSE.txt
30
30
  - README.md
31
31
  - Rakefile
@@ -35,6 +35,7 @@ files:
35
35
  - lib/slack/block_kit/blocks.rb
36
36
  - lib/slack/block_kit/composition/confirmation_dialog.rb
37
37
  - lib/slack/block_kit/composition/conversation_filter.rb
38
+ - lib/slack/block_kit/composition/dispatch_action_configuration.rb
38
39
  - lib/slack/block_kit/composition/mrkdwn.rb
39
40
  - lib/slack/block_kit/composition/option.rb
40
41
  - lib/slack/block_kit/composition/option_group.rb
@@ -57,6 +58,7 @@ files:
57
58
  - lib/slack/block_kit/element/static_select.rb
58
59
  - lib/slack/block_kit/element/timepicker.rb
59
60
  - lib/slack/block_kit/element/users_select.rb
61
+ - lib/slack/block_kit/formatting.rb
60
62
  - lib/slack/block_kit/layout/actions.rb
61
63
  - lib/slack/block_kit/layout/context.rb
62
64
  - lib/slack/block_kit/layout/divider.rb
@@ -74,7 +76,7 @@ homepage: https://github.com/CGA1123/slack-ruby-block-kit
74
76
  licenses:
75
77
  - MIT
76
78
  metadata: {}
77
- post_install_message:
79
+ post_install_message:
78
80
  rdoc_options: []
79
81
  require_paths:
80
82
  - lib
@@ -89,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
91
  - !ruby/object:Gem::Version
90
92
  version: '0'
91
93
  requirements: []
92
- rubygems_version: 3.2.3
93
- signing_key:
94
+ rubygems_version: 3.1.4
95
+ signing_key:
94
96
  specification_version: 4
95
97
  summary: A ruby wrapper for Slack's Block Kit
96
98
  test_files: []
data/.rubocop_todo.yml DELETED
@@ -1,43 +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
- - 'spec/lib/slack/block_kit/element/radio_buttons_spec.rb'
35
- - 'spec/lib/slack/block_kit/composition/option_spec.rb'
36
- - 'spec/lib/slack/block_kit/element/multi_static_select_spec.rb'
37
-
38
- # Offense count: 4
39
- Style/Documentation:
40
- Exclude:
41
- - 'spec/**/*'
42
- - 'test/**/*'
43
- - 'lib/slack/block_kit.rb'