restful_resource_bugsnag 0.3.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +42 -0
- data/.gitignore +0 -1
- data/Gemfile.lock +95 -0
- data/lib/restful_resource_bugsnag/middleware.rb +16 -5
- data/lib/restful_resource_bugsnag/version.rb +1 -1
- data/restful_resource_bugsnag.gemspec +6 -6
- metadata +26 -32
- data/circle.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8aca2c4f060de91456555ba272cf82b9dfb3561686a5db1271458dcbcc2cc9b8
|
4
|
+
data.tar.gz: 2d061e4ef4c73a8f6974a99da117b6b9c1bbd5873b85a80885e303ed01f9486e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '091765fce9f89eda509a533a85ca55d6ac687664b7d446f198463c567fe982fe1f97077b61c231b6151a8d47c96034f05af06f41bcdee9bacf399c3a86fede38'
|
7
|
+
data.tar.gz: 391717c5b6ccc1f8bcabc498598641694fd45d6b63fd7d8970c335b12a9666e76d9a695db919610de837904ab271c37acfda243f2734738f4544e5464168a7e8
|
@@ -0,0 +1,42 @@
|
|
1
|
+
references:
|
2
|
+
ruby: &ruby
|
3
|
+
image: carwow/ruby-ci:2.6
|
4
|
+
|
5
|
+
defaults: &defaults
|
6
|
+
working_directory: ~/restful_resource_bugsnag
|
7
|
+
docker:
|
8
|
+
- *ruby
|
9
|
+
|
10
|
+
version: 2
|
11
|
+
jobs:
|
12
|
+
bundle:
|
13
|
+
<<: *defaults
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
- restore_cache:
|
17
|
+
keys:
|
18
|
+
- bundle-v2-{{ checksum "Gemfile.lock" }}
|
19
|
+
- bundle-v2-
|
20
|
+
- run: |
|
21
|
+
bundle config --local path vendor/bundle &&
|
22
|
+
bundle check || bundle install --jobs=4 --retry=3
|
23
|
+
bundle clean --force
|
24
|
+
- save_cache:
|
25
|
+
key: bundle-v2-{{ checksum "Gemfile.lock" }}
|
26
|
+
paths: [vendor/bundle]
|
27
|
+
|
28
|
+
tests:
|
29
|
+
<<: *defaults
|
30
|
+
steps:
|
31
|
+
- checkout
|
32
|
+
- restore_cache: { keys: ['bundle-v2-{{ checksum "Gemfile.lock" }}'] }
|
33
|
+
- run: |
|
34
|
+
bundle exec rspec --pattern "**/*_spec.rb" --format "progress"
|
35
|
+
|
36
|
+
workflows:
|
37
|
+
version: 2
|
38
|
+
build:
|
39
|
+
jobs:
|
40
|
+
- bundle
|
41
|
+
- tests:
|
42
|
+
requires: [bundle]
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
restful_resource_bugsnag (0.5.2)
|
5
|
+
bugsnag (~> 6)
|
6
|
+
restful_resource (~> 2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (6.0.3.4)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 0.7, < 2)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
17
|
+
addressable (2.6.0)
|
18
|
+
public_suffix (>= 2.0.2, < 4.0)
|
19
|
+
bugsnag (6.18.0)
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
crack (0.4.3)
|
23
|
+
safe_yaml (~> 1.0.0)
|
24
|
+
diff-lcs (1.3)
|
25
|
+
ethon (0.12.0)
|
26
|
+
ffi (>= 1.3.0)
|
27
|
+
faraday (1.1.0)
|
28
|
+
multipart-post (>= 1.2, < 3)
|
29
|
+
ruby2_keywords
|
30
|
+
faraday-cdn-metrics (0.2.0)
|
31
|
+
faraday (~> 1)
|
32
|
+
faraday-encoding (0.0.5)
|
33
|
+
faraday
|
34
|
+
faraday-http-cache (2.2.0)
|
35
|
+
faraday (>= 0.8)
|
36
|
+
faraday_middleware (1.0.0)
|
37
|
+
faraday (~> 1.0)
|
38
|
+
ffi (1.13.1)
|
39
|
+
hashdiff (0.3.9)
|
40
|
+
i18n (1.8.5)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
link_header (0.0.8)
|
43
|
+
minitest (5.14.2)
|
44
|
+
multipart-post (2.1.1)
|
45
|
+
public_suffix (3.0.3)
|
46
|
+
rack (2.2.3)
|
47
|
+
rake (13.0.1)
|
48
|
+
restful_resource (2.10.3)
|
49
|
+
activesupport (~> 6.0)
|
50
|
+
faraday (~> 1.0)
|
51
|
+
faraday-cdn-metrics (~> 0.2)
|
52
|
+
faraday-encoding
|
53
|
+
faraday-http-cache (~> 2.2)
|
54
|
+
faraday_middleware (~> 1.0)
|
55
|
+
link_header
|
56
|
+
rack (~> 2.2)
|
57
|
+
typhoeus (~> 1.4)
|
58
|
+
rspec (3.8.0)
|
59
|
+
rspec-core (~> 3.8.0)
|
60
|
+
rspec-expectations (~> 3.8.0)
|
61
|
+
rspec-mocks (~> 3.8.0)
|
62
|
+
rspec-core (3.8.0)
|
63
|
+
rspec-support (~> 3.8.0)
|
64
|
+
rspec-expectations (3.8.3)
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
66
|
+
rspec-support (~> 3.8.0)
|
67
|
+
rspec-mocks (3.8.0)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.8.0)
|
70
|
+
rspec-support (3.8.0)
|
71
|
+
ruby2_keywords (0.0.2)
|
72
|
+
safe_yaml (1.0.5)
|
73
|
+
thread_safe (0.3.6)
|
74
|
+
typhoeus (1.4.0)
|
75
|
+
ethon (>= 0.9.0)
|
76
|
+
tzinfo (1.2.8)
|
77
|
+
thread_safe (~> 0.1)
|
78
|
+
webmock (3.5.1)
|
79
|
+
addressable (>= 2.3.6)
|
80
|
+
crack (>= 0.3.2)
|
81
|
+
hashdiff
|
82
|
+
zeitwerk (2.4.1)
|
83
|
+
|
84
|
+
PLATFORMS
|
85
|
+
ruby
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
bundler
|
89
|
+
rake
|
90
|
+
restful_resource_bugsnag!
|
91
|
+
rspec
|
92
|
+
webmock
|
93
|
+
|
94
|
+
BUNDLED WITH
|
95
|
+
2.1.4
|
@@ -7,19 +7,18 @@ module RestfulResourceBugsnag
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(notification)
|
10
|
-
exception = notification.
|
10
|
+
exception = notification.raw_exceptions.first
|
11
11
|
|
12
12
|
if exception.is_a?(RestfulResource::HttpClient::HttpError)
|
13
13
|
notification.add_tab(:restful_resource_response, {
|
14
14
|
status: exception.response.status,
|
15
|
-
body: exception.response.body,
|
15
|
+
body: attempt_json_parse(exception.response.body),
|
16
16
|
headers: exception.response.headers
|
17
17
|
})
|
18
18
|
notification.add_tab(:restful_resource_request, {
|
19
19
|
method: exception.request.method,
|
20
20
|
url: exception.request.url,
|
21
|
-
|
22
|
-
body: exception.request.body
|
21
|
+
body: attempt_json_parse(exception.request.body)
|
23
22
|
})
|
24
23
|
end
|
25
24
|
|
@@ -34,7 +33,7 @@ module RestfulResourceBugsnag
|
|
34
33
|
notification.context = "Client error: Service unavailable #{request_host_from_exception exception}"
|
35
34
|
notification.grouping_hash = notification.context
|
36
35
|
end
|
37
|
-
|
36
|
+
|
38
37
|
if exception.is_a?(RestfulResource::HttpClient::Timeout)
|
39
38
|
notification.context = "Client error: Timeout #{request_host_from_exception exception}"
|
40
39
|
notification.grouping_hash = notification.context
|
@@ -48,5 +47,17 @@ module RestfulResourceBugsnag
|
|
48
47
|
def request_host_from_exception(exception)
|
49
48
|
URI.parse(exception.request.url).host
|
50
49
|
end
|
50
|
+
|
51
|
+
def attempt_json_parse(string)
|
52
|
+
redacted_string = redact_user_emails_from_errors(string)
|
53
|
+
JSON.parse(redacted_string)
|
54
|
+
rescue JSON::ParserError, TypeError
|
55
|
+
redacted_string
|
56
|
+
end
|
57
|
+
|
58
|
+
def redact_user_emails_from_errors(string)
|
59
|
+
# Based on Devise.email_regexp
|
60
|
+
string&.gsub(/[^@"\s]+@[^@"\s]+/, '<email-address-redacted>')
|
61
|
+
end
|
51
62
|
end
|
52
63
|
end
|
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "bugsnag", "~>
|
23
|
-
spec.add_dependency "restful_resource", "~>
|
22
|
+
spec.add_dependency "bugsnag", "~> 6"
|
23
|
+
spec.add_dependency "restful_resource", "~> 2"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "rspec"
|
28
|
-
spec.add_development_dependency "webmock"
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_development_dependency "webmock"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_resource_bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mwagg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bugsnag
|
@@ -16,90 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: restful_resource
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.0'
|
90
87
|
- - ">="
|
91
88
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
89
|
+
version: '0'
|
93
90
|
type: :development
|
94
91
|
prerelease: false
|
95
92
|
version_requirements: !ruby/object:Gem::Requirement
|
96
93
|
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '2.0'
|
100
94
|
- - ">="
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
96
|
+
version: '0'
|
103
97
|
description: A Bugsnag middleware which adds extra details to notifications for RestfulResource
|
104
98
|
errors.
|
105
99
|
email:
|
@@ -108,16 +102,17 @@ executables: []
|
|
108
102
|
extensions: []
|
109
103
|
extra_rdoc_files: []
|
110
104
|
files:
|
105
|
+
- ".circleci/config.yml"
|
111
106
|
- ".gitignore"
|
112
107
|
- ".rspec"
|
113
108
|
- CODE_OF_CONDUCT.md
|
114
109
|
- Gemfile
|
110
|
+
- Gemfile.lock
|
115
111
|
- LICENSE.txt
|
116
112
|
- README.md
|
117
113
|
- Rakefile
|
118
114
|
- bin/console
|
119
115
|
- bin/setup
|
120
|
-
- circle.yml
|
121
116
|
- lib/restful_resource_bugsnag.rb
|
122
117
|
- lib/restful_resource_bugsnag/middleware.rb
|
123
118
|
- lib/restful_resource_bugsnag/version.rb
|
@@ -126,7 +121,7 @@ homepage: https://github.com/carwow/restful_resource_bugsnag
|
|
126
121
|
licenses:
|
127
122
|
- MIT
|
128
123
|
metadata: {}
|
129
|
-
post_install_message:
|
124
|
+
post_install_message:
|
130
125
|
rdoc_options: []
|
131
126
|
require_paths:
|
132
127
|
- lib
|
@@ -141,9 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
136
|
- !ruby/object:Gem::Version
|
142
137
|
version: '0'
|
143
138
|
requirements: []
|
144
|
-
|
145
|
-
|
146
|
-
signing_key:
|
139
|
+
rubygems_version: 3.1.2
|
140
|
+
signing_key:
|
147
141
|
specification_version: 4
|
148
142
|
summary: A Bugsnag middleware which adds extra details to notifications for RestfulResource
|
149
143
|
errors.
|
data/circle.yml
DELETED