slackiq 0.0.2 → 0.0.3
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/README.md +3 -1
- data/lib/slackiq.rb +7 -0
- data/lib/slackiq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4443c85830f98e8e8f8206eeced59bc57a67714d
|
|
4
|
+
data.tar.gz: 3bf7637a2175fc9ef88643d59fa9ae96a66d04d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e443da2e0523607404a784d179535f48a7aca0088ab770a37de6dc4e76c034f7310ed71f6c588ec27c8df2fb122acb64336490472ab5cef1979a20b46ba4f3d
|
|
7
|
+
data.tar.gz: ebee654dc480deb09fb1e21bdd29d86646889ec1410130a952d5f5f716bfe5cac29f402c9cf64047cba89d054172e3c1c7081c4260a4e1e60b269b7c7ab2c2e0
|
data/README.md
CHANGED
|
@@ -28,9 +28,11 @@ You can call `notify` to send a nicely-formatted notification to your Slack.
|
|
|
28
28
|
The `notify` method has a single Hash parameter. Here are the keys and values in the Hash:
|
|
29
29
|
* `:webhook_name` The name of the webhook (Symbol) that you configured (eg. `:main` or `:data_processing`)
|
|
30
30
|
* `:title` The title of the notification (String)
|
|
31
|
-
* `:status` An instance of `Sidekiq::Batch::Status`
|
|
31
|
+
* `:status` An instance of `Sidekiq::Batch::Status`
|
|
32
32
|
* Any other keys and values (both Strings) can be added too, and they'll be added to the Slack notification!
|
|
33
33
|
|
|
34
|
+
If you haven't used batches with Sidekiq Pro before, [read this first](https://github.com/mperham/sidekiq/wiki/Batches).
|
|
35
|
+
|
|
34
36
|
Here's an example showing how you would use Slackiq to send a notification to your Slack when your Sidekiq batch completes:
|
|
35
37
|
|
|
36
38
|
```
|
data/lib/slackiq.rb
CHANGED
|
@@ -22,6 +22,13 @@ module Slackiq
|
|
|
22
22
|
title = options[:title]
|
|
23
23
|
#description = options[:description]
|
|
24
24
|
status = options[:status]
|
|
25
|
+
|
|
26
|
+
if (bid = options[:bid]) && status.nil?
|
|
27
|
+
raise "Sidekiq::Batch::Status is not defined. Are you sure Sidekiq Pro is set up correctly?" unless defined?(Sidekiq::Batch::Status)
|
|
28
|
+
|
|
29
|
+
status = Sidekiq::Batch::Status.new(bid)
|
|
30
|
+
end
|
|
31
|
+
|
|
25
32
|
extra_fields = options.except(:webhook_name, :title, :description, :status)
|
|
26
33
|
|
|
27
34
|
if status
|
data/lib/slackiq/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slackiq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Lew
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-07-
|
|
11
|
+
date: 2015-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|