slack-notification 0.1.14 → 0.1.16
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/slack_notification.rb +4 -3
- data/slack-notification.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be838cb0708360ea98602edcadcc2157fcb05f5886b619fd07f9acdd7aa1302e
|
4
|
+
data.tar.gz: 0fed577d425cb44a812d485537a947c026fea11040d1ef31646eef742f712ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba3b55509475aa62b4608fd807018088c840a5e9e2cfde80be8e09352c42e65605d043277575704a4e8fc99a2ff9549f194be3573b463d6ae1aedf14fa888baf
|
7
|
+
data.tar.gz: a1f83220efd4d99f0147c7af8c6e4c4f79b8ab1a0d45a68b88c65c414bd5234d3631bd3aae4becac0e8ef2836e83a3bbc2aad3e98260d2b59eaecd589b41c271
|
data/Gemfile.lock
CHANGED
data/lib/slack_notification.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'slack-notifier'
|
4
4
|
|
5
5
|
class SlackNotification
|
6
|
-
attr_accessor :type, :dryrun, :title, :fallback, :fields, :blocks, :channel
|
6
|
+
attr_accessor :type, :dryrun, :title, :fallback, :fields, :blocks, :channel, :only_blocks
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@channel = validated_channel(options[:channel].to_s)
|
@@ -11,6 +11,7 @@ class SlackNotification
|
|
11
11
|
@title = options[:title]
|
12
12
|
@fallback = options[:fallback]
|
13
13
|
@dryrun = options[:dryrun] || (defined?(Rails) && Rails.env.test?)
|
14
|
+
@only_blocks = options[:only_blocks]
|
14
15
|
@fields = validated_fields(options[:fields])
|
15
16
|
@blocks = options[:blocks]
|
16
17
|
@footer = options[:footer]
|
@@ -26,7 +27,7 @@ class SlackNotification
|
|
26
27
|
@data
|
27
28
|
end
|
28
29
|
|
29
|
-
def notify!
|
30
|
+
def notify!
|
30
31
|
options = { blocks: @blocks }
|
31
32
|
options.merge!(attachments: [data]) unless only_blocks
|
32
33
|
@dryrun ? data : notifier.post(**options)
|
@@ -64,7 +65,7 @@ private
|
|
64
65
|
elsif fields.is_a?(String)
|
65
66
|
@title = fields
|
66
67
|
fields = []
|
67
|
-
elsif !fields.is_a?(Array)
|
68
|
+
elsif !only_blocks && !fields.is_a?(Array)
|
68
69
|
raise ArgumentError, 'Unsupported fields format.'
|
69
70
|
end
|
70
71
|
|
data/slack-notification.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'slack-notification'
|
8
|
-
spec.version = '0.1.
|
8
|
+
spec.version = '0.1.16'
|
9
9
|
spec.date = '2025-03-05'
|
10
10
|
spec.authors = ['Julian Fiander']
|
11
11
|
spec.email = ['julian@fiander.one']
|