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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ec21526ea00d3e7952686bfa6ebbe6ddda8af07
4
- data.tar.gz: bde34918c70eae1a2a0734a1bcd72f29cbda8435
3
+ metadata.gz: 4443c85830f98e8e8f8206eeced59bc57a67714d
4
+ data.tar.gz: 3bf7637a2175fc9ef88643d59fa9ae96a66d04d0
5
5
  SHA512:
6
- metadata.gz: c1c09484ce20cf6e6028b16c0cbaff7fa35dbf938bb2942ea3f9912b61fd40aa02c8c7a44d29efa0fbb316203692a010364139f84c6e0c0017ada8fa54a9acb3
7
- data.tar.gz: b3859bc77ae70aaad00bb161fe934d42272f47bc3b10499e0836f112a54696b983618d68cd6d17c569a005ed3746af3aac5004693d54dceb7efd414add7c9d1b
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` (see [this link](https://github.com/mperham/sidekiq/wiki/Batches) for more info)
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
@@ -1,3 +1,3 @@
1
1
  module Slackiq
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-28 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty