slack-notification 0.1.13 → 0.1.15

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: 35fe42eb9ad6e1704c5ce37aacab91cbae533989c66edf032c87eb65c791a9b1
4
- data.tar.gz: f554590d4276c8edc4c1cd9e488374635d9540b6fff0cf00e9c1952a1d7545c2
3
+ metadata.gz: 03bcba4560d71f2924c05d5ff552c48e08c888de016ebeedc503ce024f3d4048
4
+ data.tar.gz: 693e77ef8afbdfac4bbc82cf1778d371f94e8ad47dafbec5fcbdb960e8dc48aa
5
5
  SHA512:
6
- metadata.gz: ccbfb61ddc15808d176cc140994a0adeb04247405d39329b6e7e316277aca43026260c3d6cc52d6596ccdf9e4f5d7143764df0405fe7f0cc1749d40310b249bd
7
- data.tar.gz: 251100af4b26c7aeb990f64fe037adb831605c0f2396487624b78b6001d559b4e38bc74bfb20c16fe5f5776899c405bd56cc3f286f53a36d28cc931d67c9e9a1
6
+ metadata.gz: ef79433a884fc0c20b12a05a0c6c2122a5a3f5725d1f2354c8f96460f6ecc2ab1cb349a8bf037585e5e1bf264bbd22197e3fcc17bfaa0bd7f8cb865b48215e96
7
+ data.tar.gz: c68e8d882a475a6984ca1285e7993ba14ab222f0dff2f0e5c2dcbfa2cb66e179250db7151ca04c36a95471ec5ff5a7dc2d9c273aaa9cde3940431cc4593f0a7e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack-notification (0.1.13)
4
+ slack-notification (0.1.15)
5
5
  slack-notifier (~> 2.3)
6
6
 
7
7
  GEM
@@ -16,7 +16,7 @@ GEM
16
16
  rainbow (3.0.0)
17
17
  rake (12.3.3)
18
18
  regexp_parser (2.0.3)
19
- rexml (3.2.5)
19
+ rexml (3.3.9)
20
20
  rspec (3.9.0)
21
21
  rspec-core (~> 3.9.0)
22
22
  rspec-expectations (~> 3.9.0)
@@ -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)
@@ -14,6 +14,7 @@ class SlackNotification
14
14
  @fields = validated_fields(options[:fields])
15
15
  @blocks = options[:blocks]
16
16
  @footer = options[:footer]
17
+ @only_blocks = options[:only_blocks]
17
18
  end
18
19
 
19
20
  def data
@@ -27,7 +28,9 @@ class SlackNotification
27
28
  end
28
29
 
29
30
  def notify!
30
- @dryrun ? data : notifier.post(attachments: [data], blocks: @blocks)
31
+ options = { blocks: @blocks }
32
+ options.merge!(attachments: [data]) unless only_blocks
33
+ @dryrun ? data : notifier.post(**options)
31
34
  end
32
35
 
33
36
  private
@@ -62,7 +65,7 @@ private
62
65
  elsif fields.is_a?(String)
63
66
  @title = fields
64
67
  fields = []
65
- elsif !fields.is_a?(Array)
68
+ elsif !only_blocks && !fields.is_a?(Array)
66
69
  raise ArgumentError, 'Unsupported fields format.'
67
70
  end
68
71
 
@@ -5,8 +5,8 @@ $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.13'
9
- spec.date = '2023-08-15'
8
+ spec.version = '0.1.15'
9
+ spec.date = '2025-03-05'
10
10
  spec.authors = ['Julian Fiander']
11
11
  spec.email = ['julian@fiander.one']
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-15 00:00:00.000000000 Z
11
+ date: 2025-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler