bugsnag 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "bugsnag"
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Smith"]
@@ -1,6 +1,7 @@
1
1
  module Bugsnag
2
2
  module Helpers
3
3
  def self.cleanup_hash(hash)
4
+ return nil unless hash
4
5
  hash.inject({}) do |h, (k, v)|
5
6
  h[k.to_s.gsub(/\./, "-")] = v.to_s
6
7
  h
@@ -8,13 +9,14 @@ module Bugsnag
8
9
  end
9
10
 
10
11
  def self.apply_filters(hash, filters)
11
- if filters
12
- hash.each do |k, v|
13
- if filters.any? {|f| k.to_s.include?(f.to_s) }
14
- hash[k] = "[FILTERED]"
15
- elsif v.respond_to?(:to_hash)
16
- apply_filters(hash[k])
17
- end
12
+ return nil unless hash
13
+ return hash unless filters
14
+
15
+ hash.each do |k, v|
16
+ if filters.any? {|f| k.to_s.include?(f.to_s) }
17
+ hash[k] = "[FILTERED]"
18
+ elsif v.respond_to?(:to_hash)
19
+ apply_filters(hash[k])
18
20
  end
19
21
  end
20
22
  end
@@ -22,5 +24,9 @@ module Bugsnag
22
24
  def self.param_context(params)
23
25
  "#{params[:controller]}##{params[:action]}" if params && params[:controller] && params[:action]
24
26
  end
27
+
28
+ def self.request_context(request)
29
+ "#{request.request_method} #{request.path}" if request
30
+ end
25
31
  end
26
32
  end
@@ -23,12 +23,13 @@ module Bugsnag
23
23
  def bugsnag_request_data(env)
24
24
  request = ::Rack::Request.new(env)
25
25
 
26
- session = env['rack.session'] || {}
27
- params = env['action_dispatch.request.parameters'] || request.params || {}
26
+ session = env["rack.session"]
27
+ params = env["action_dispatch.request.parameters"] || request.params
28
+ user_id = session[:session_id] || session["session_id"] if session
28
29
 
29
30
  {
30
- :user_id => session[:session_id] || session["session_id"],
31
- :context => Bugsnag::Helpers.param_context(params),
31
+ :user_id => user_id,
32
+ :context => Bugsnag::Helpers.param_context(params) || Bugsnag::Helpers.request_context(request),
32
33
  :meta_data => {
33
34
  :request => {
34
35
  :url => request.url,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 5
10
- version: 1.0.5
9
+ - 6
10
+ version: 1.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith