uniform_notifier 1.6.0 → 1.6.1
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/lib/uniform_notifier.rb +1 -1
- data/lib/uniform_notifier/bugsnag.rb +5 -4
- data/lib/uniform_notifier/version.rb +1 -1
- data/spec/uniform_notifier/bugsnag_spec.rb +31 -9
- 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: 61cb8e4a13116e9f516f1ce964bc97b9113e60f9
|
4
|
+
data.tar.gz: 9a6779d8bf219015cf5d14c69394d0cc525224be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3390be5ee6e2eda38b9e575ac012c7417763b708be2d4dba1979a9adfdccabd7d81d5e4a6dea8c1e04088a2e10d5afea663838dd31273494ee16faba73a3690
|
7
|
+
data.tar.gz: d14fdb5871e395efcb08a8b172e172d1028dc51821f4243f86c391a533e0bad9e4ab28bb0da6d8a3aed70a72d9bb61ca17b1646494687d33c52c880fb383fb97
|
data/lib/uniform_notifier.rb
CHANGED
@@ -16,7 +16,7 @@ module UniformNotifier
|
|
16
16
|
class <<self
|
17
17
|
attr_accessor :alert, :console, :growl, :rails_logger, :xmpp, :airbrake, :bugsnag, :raise
|
18
18
|
|
19
|
-
NOTIFIERS = [JavascriptAlert, JavascriptConsole, Growl, Xmpp, RailsLogger, CustomizedLogger, AirbrakeNotifier, Raise]
|
19
|
+
NOTIFIERS = [JavascriptAlert, JavascriptConsole, Growl, Xmpp, RailsLogger, CustomizedLogger, AirbrakeNotifier, BugsnagNotifier, Raise]
|
20
20
|
|
21
21
|
def active_notifiers
|
22
22
|
NOTIFIERS.select { |notifier| notifier.active? }
|
@@ -7,15 +7,16 @@ module UniformNotifier
|
|
7
7
|
protected
|
8
8
|
|
9
9
|
def self._out_of_channel_notify(data)
|
10
|
-
message = data.values.compact.join("\n")
|
11
|
-
|
12
10
|
opt = {}
|
13
11
|
if UniformNotifier.bugsnag.is_a?(Hash)
|
14
12
|
opt = UniformNotifier.bugsnag
|
15
13
|
end
|
16
14
|
|
17
|
-
exception = Exception.new(
|
18
|
-
Bugsnag.notify(exception, opt
|
15
|
+
exception = Exception.new(data[:title])
|
16
|
+
Bugsnag.notify(exception, opt.merge(
|
17
|
+
:grouping_hash => data[:body] || data[:title],
|
18
|
+
:notification => data,
|
19
|
+
))
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -5,21 +5,43 @@ class Bugsnag
|
|
5
5
|
end
|
6
6
|
|
7
7
|
describe UniformNotifier::BugsnagNotifier do
|
8
|
+
let(:notification_data) { {} }
|
8
9
|
it "should not notify bugsnag" do
|
9
|
-
|
10
|
+
Bugsnag.should_not_receive(:notify)
|
11
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
10
12
|
end
|
13
|
+
context "with string notification" do
|
14
|
+
let(:notification_data) { {:user => 'user', :title => 'notify bugsnag', :url => 'URL', body: 'something'} }
|
11
15
|
|
12
|
-
|
13
|
-
|
16
|
+
it "should notify bugsnag" do
|
17
|
+
Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new(notification_data[:title]), :grouping_hash => notification_data[:body], :notification => notification_data)
|
14
18
|
|
15
|
-
|
16
|
-
|
19
|
+
UniformNotifier.bugsnag = true
|
20
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should notify bugsnag with option" do
|
24
|
+
Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new(notification_data[:title]), :foo => :bar, :grouping_hash => notification_data[:body], :notification => notification_data)
|
25
|
+
|
26
|
+
UniformNotifier.bugsnag = { :foo => :bar }
|
27
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
28
|
+
end
|
17
29
|
end
|
30
|
+
context "with hash notification" do
|
31
|
+
let(:notification_data) { "notify bugsnag" }
|
32
|
+
|
33
|
+
it "should notify bugsnag" do
|
34
|
+
Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new("notify bugsnag"), :grouping_hash => "notify bugsnag", :notification => {:title => "notify bugsnag"})
|
35
|
+
|
36
|
+
UniformNotifier.bugsnag = true
|
37
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
38
|
+
end
|
18
39
|
|
19
|
-
|
20
|
-
|
40
|
+
it "should notify bugsnag with option" do
|
41
|
+
Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new("notify bugsnag"), :foo => :bar, :grouping_hash => "notify bugsnag", :notification => {:title => "notify bugsnag"})
|
21
42
|
|
22
|
-
|
23
|
-
|
43
|
+
UniformNotifier.bugsnag = { :foo => :bar }
|
44
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
45
|
+
end
|
24
46
|
end
|
25
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniform_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-growl
|