bugsnag 1.8.3 → 1.8.4
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/CHANGELOG.md +5 -0
- data/README.md +10 -0
- data/VERSION +1 -1
- data/lib/bugsnag/notification.rb +19 -6
- data/spec/notification_spec.rb +8 -0
- 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: c744dba45c2a6935acc11b8f4ec4bf4ba45c5eab
|
4
|
+
data.tar.gz: 2a465d826f1487c35a4b0218363dc169c4bc2069
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b45ad522fec4a680c7321fbf6bf0976a948dbc93b69cbc69c78a34a13784a69841098e3db0e7f715b11e1af5f683758fb434845a31ef8489cb7b713414f04b6f
|
7
|
+
data.tar.gz: ff24132faa1a219aabe36bd7306c8d4f0953f73fc0569d1667834f66810b5e9d87c9175fa492d896528267bc708eb5f836b9886d69dcc505f1f0f79e8b27751e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -460,6 +460,16 @@ You can also view the order of the currently activated middleware by running `ra
|
|
460
460
|
Check out Bugsnag's [built in middleware classes](https://github.com/bugsnag/bugsnag-ruby/tree/master/lib/bugsnag/middleware)
|
461
461
|
for some real examples of middleware in action.
|
462
462
|
|
463
|
+
### Multiple projects
|
464
|
+
|
465
|
+
If you want to divide errors into multiple Bugsnag projects, you can specify the API key as a parameter to `Bugsnag.notify`:
|
466
|
+
|
467
|
+
```ruby
|
468
|
+
rescue => e
|
469
|
+
Bugsnag.notify e, api_key: "your-api-key-here"
|
470
|
+
end
|
471
|
+
```
|
472
|
+
|
463
473
|
|
464
474
|
Deploy Tracking
|
465
475
|
---------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.4
|
data/lib/bugsnag/notification.rb
CHANGED
@@ -55,10 +55,15 @@ module Bugsnag
|
|
55
55
|
@request_data = request_data
|
56
56
|
@meta_data = {}
|
57
57
|
@user = {}
|
58
|
-
|
58
|
+
|
59
59
|
self.severity = @overrides[:severity]
|
60
60
|
@overrides.delete :severity
|
61
61
|
|
62
|
+
if @overrides.key? :api_key
|
63
|
+
self.api_key = @overrides[:api_key]
|
64
|
+
@overrides.delete :api_key
|
65
|
+
end
|
66
|
+
|
62
67
|
# Unwrap exceptions
|
63
68
|
@exceptions = []
|
64
69
|
ex = exception
|
@@ -138,16 +143,24 @@ module Bugsnag
|
|
138
143
|
@severity || "error"
|
139
144
|
end
|
140
145
|
|
146
|
+
def api_key=(api_key)
|
147
|
+
@api_key = api_key
|
148
|
+
end
|
149
|
+
|
150
|
+
def api_key
|
151
|
+
@api_key ||= @configuration.api_key
|
152
|
+
end
|
153
|
+
|
141
154
|
# Deliver this notification to bugsnag.com Also runs through the middleware as required.
|
142
155
|
def deliver
|
143
156
|
return unless @configuration.should_notify?
|
144
157
|
|
145
158
|
# Check we have at least an api_key
|
146
|
-
if
|
159
|
+
if api_key.nil?
|
147
160
|
Bugsnag.warn "No API key configured, couldn't notify"
|
148
161
|
return
|
149
|
-
elsif
|
150
|
-
Bugsnag.warn "Your API key (#{
|
162
|
+
elsif api_key !~ API_KEY_REGEX
|
163
|
+
Bugsnag.warn "Your API key (#{api_key}) is not valid, couldn't notify"
|
151
164
|
return
|
152
165
|
end
|
153
166
|
|
@@ -179,7 +192,7 @@ module Bugsnag
|
|
179
192
|
|
180
193
|
# Build the endpoint url
|
181
194
|
endpoint = (@configuration.use_ssl ? "https://" : "http://") + @configuration.endpoint
|
182
|
-
Bugsnag.log("Notifying #{endpoint} of #{@exceptions.last.class} from api_key #{
|
195
|
+
Bugsnag.log("Notifying #{endpoint} of #{@exceptions.last.class} from api_key #{api_key}")
|
183
196
|
|
184
197
|
# Build the payload's exception event
|
185
198
|
payload_event = {
|
@@ -199,7 +212,7 @@ module Bugsnag
|
|
199
212
|
|
200
213
|
# Build the payload hash
|
201
214
|
payload = {
|
202
|
-
:apiKey =>
|
215
|
+
:apiKey => api_key,
|
203
216
|
:notifier => {
|
204
217
|
:name => NOTIFIER_NAME,
|
205
218
|
:version => NOTIFIER_VERSION,
|
data/spec/notification_spec.rb
CHANGED
@@ -40,6 +40,14 @@ describe Bugsnag::Notification do
|
|
40
40
|
Bugsnag.notify(BugsnagTestException.new("It crashed"))
|
41
41
|
end
|
42
42
|
|
43
|
+
it "should let you override the api_key" do
|
44
|
+
Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
|
45
|
+
payload[:apiKey].should be == "9d84383f9be2ca94902e45c756a9979d"
|
46
|
+
end
|
47
|
+
|
48
|
+
Bugsnag.notify(BugsnagTestException.new("It crashed"), :api_key => "9d84383f9be2ca94902e45c756a9979d")
|
49
|
+
end
|
50
|
+
|
43
51
|
it "should use the env variable apiKey" do
|
44
52
|
ENV["BUGSNAG_API_KEY"] = "c9d60ae4c7e70c4b6c4ebd3e8056d2b9"
|
45
53
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|