bugsnag-api 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +1 -18
- data/CHANGELOG.md +19 -0
- data/README.md +1 -2
- data/bugsnag-api.gemspec +8 -41
- data/lib/bugsnag/api/client.rb +6 -2
- data/lib/bugsnag/api/response/raise_error.rb +1 -1
- data/lib/bugsnag/api/version.rb +1 -1
- data/lib/bugsnag/api.rb +4 -1
- data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_organizations/when_using_user_credentials/returns_users_organizations.yml +1 -1
- data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_projects/when_using_user_credentials/lists_current_user_s_projects_in_the_organization.yml +1 -1
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/_create_organization/creates_a_new_organization.yml +1 -1
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_delete_organization/deletes_the_organization.yml +2 -2
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_organization/returns_the_requested_organization.yml +2 -2
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_update_organization/updates_and_returns_the_organization.yml +2 -2
- data/spec/spec_helper.rb +21 -2
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb92be973f329fc0b534281572a49ac0bfc82d4a5effd917d7b10f2eb9d9a19c
|
4
|
+
data.tar.gz: 6bfb6147eb71be5cb1673c8a550b28af198e63dbd024eb1c1e8da40ec46e14b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d021963f0b0b663ced606dd48b8beef0d1b92cac78452ef582bcc10c46e96f3cffbdbeed6bfad82699cac1c207d0b9b26d19f6ac71380dd938f9af8d4ca56bb0
|
7
|
+
data.tar.gz: c3e14c300c70fa0fd80f498819f9e1f9ae59ec31b6ba5a2344e85b8eda87b66b163e21ad0eacb36686d9452a26b9396a03957b925979d590054e37cebde5fe73
|
data/.github/workflows/tests.yml
CHANGED
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
|
-
ruby-version: ['2.
|
11
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
|
12
12
|
|
13
13
|
steps:
|
14
14
|
- uses: actions/checkout@v2
|
@@ -34,20 +34,3 @@ jobs:
|
|
34
34
|
bundler-cache: true
|
35
35
|
|
36
36
|
- run: bundle exec rubocop lib/
|
37
|
-
|
38
|
-
# Ruby 1.9 and 2.0 aren't supported by setup-ruby so we have to use Docker instead
|
39
|
-
legacy:
|
40
|
-
runs-on: ubuntu-latest
|
41
|
-
strategy:
|
42
|
-
fail-fast: false
|
43
|
-
matrix:
|
44
|
-
ruby-version: ['1.9', '2.0']
|
45
|
-
|
46
|
-
container: ruby:${{ matrix.ruby-version }}
|
47
|
-
|
48
|
-
steps:
|
49
|
-
- uses: actions/checkout@v2
|
50
|
-
|
51
|
-
- run: bundle install
|
52
|
-
|
53
|
-
- run: bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## 3.0.0 (3 November 2022)
|
5
|
+
|
6
|
+
### Enhancements
|
7
|
+
|
8
|
+
* Update required Sawyer version to `~> 0.9.2`
|
9
|
+
| [ilvez](https://github.com/ilvez)
|
10
|
+
| [#43](https://github.com/bugsnag/bugsnag-api-ruby/pull/43)
|
11
|
+
|
12
|
+
* Require Ruby 2.6+
|
13
|
+
| [#44](https://github.com/bugsnag/bugsnag-api-ruby/pull/44)
|
14
|
+
|
15
|
+
## 2.1.1 (2 November 2021)
|
16
|
+
|
17
|
+
### Fixes
|
18
|
+
|
19
|
+
* Fix Faraday deprecation warning
|
20
|
+
| [sambostock](https://github.com/sambostock)
|
21
|
+
| [#36](https://github.com/bugsnag/bugsnag-api-ruby/pull/36)
|
22
|
+
|
4
23
|
## 2.1.0 (28 July 2021)
|
5
24
|
|
6
25
|
### Enhancements
|
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
Bugsnag API Toolkit for Ruby
|
2
2
|
============================
|
3
|
-
![Build status](https://travis-ci.org/bugsnag/bugsnag-api-ruby.svg?branch=master)
|
4
3
|
|
5
4
|
The library allows for quick read/write access to the [Bugsnag Data Access API](https://docs.bugsnag.com/api/data-access/) from your Ruby applications. You can use this library to build your own applications which leverage data found in your Bugsnag dashboard.
|
6
5
|
|
7
|
-
Version
|
6
|
+
Version 3.x (current) and 2.x of this gem corresponds to v2 of the Data Access API, while [1.x](https://github.com/bugsnag/bugsnag-api-ruby/tree/v1.0.3) uses the (deprecated) v1 of the Data Access API.
|
8
7
|
|
9
8
|
If you are looking to automatically detect crashes in your Ruby apps, you should take a look at the [Bugsnag Ruby Detection Library](https://docs.bugsnag.com/platforms/ruby) instead.
|
10
9
|
|
data/bugsnag-api.gemspec
CHANGED
@@ -18,49 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
|
22
|
-
spec.add_dependency "sawyer", '0.8.1'
|
21
|
+
spec.required_ruby_version = ">= 2.6"
|
23
22
|
|
24
|
-
|
25
|
-
spec.add_development_dependency "rubocop", "0.41.2"
|
26
|
-
spec.add_development_dependency "faker", "1.3.0"
|
27
|
-
|
28
|
-
# i18n is used by faker
|
29
|
-
spec.add_development_dependency "i18n", "< 1.0.0"
|
30
|
-
|
31
|
-
# crack is used by webmock
|
32
|
-
spec.add_development_dependency "crack", "< 0.4.5"
|
33
|
-
else
|
34
|
-
spec.add_dependency "sawyer", '~> 0.8.1'
|
35
|
-
|
36
|
-
spec.add_development_dependency "rake"
|
37
|
-
spec.add_development_dependency "rubocop", "~> 0.52.1"
|
38
|
-
spec.add_development_dependency "faker", "> 1.7.3"
|
39
|
-
end
|
40
|
-
|
41
|
-
if RUBY_VERSION < "2.0.0"
|
42
|
-
spec.add_development_dependency "json", "< 2.0.0"
|
43
|
-
spec.add_development_dependency "webmock", "2.3.2"
|
44
|
-
spec.add_development_dependency "addressable", "2.3.6"
|
45
|
-
|
46
|
-
# hashdiff is used by webmock
|
47
|
-
spec.add_development_dependency "hashdiff", "< 0.3.8"
|
48
|
-
|
49
|
-
# parser is used by rubocop
|
50
|
-
spec.add_development_dependency "parser", "< 2.5.0"
|
51
|
-
else
|
52
|
-
spec.add_development_dependency "json"
|
53
|
-
spec.add_development_dependency "webmock", "> 2.3.2"
|
54
|
-
spec.add_development_dependency "addressable", "> 2.3.6"
|
55
|
-
end
|
56
|
-
|
57
|
-
# public_suffix is used by addressable & sawyer
|
58
|
-
if RUBY_VERSION < "2.0.0"
|
59
|
-
spec.add_development_dependency "public_suffix", "< 1.5.0"
|
60
|
-
elsif RUBY_VERSION < "2.1.0"
|
61
|
-
spec.add_development_dependency "public_suffix", "< 3.0.0"
|
62
|
-
end
|
23
|
+
spec.add_dependency "sawyer", '~> 0.9.2'
|
63
24
|
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rubocop", "~> 0.52.1"
|
27
|
+
spec.add_development_dependency "faker", "> 1.7.3"
|
28
|
+
spec.add_development_dependency "webmock", "> 2.3.2"
|
29
|
+
spec.add_development_dependency "addressable", "> 2.3.6"
|
30
|
+
spec.add_development_dependency "json"
|
64
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
65
32
|
spec.add_development_dependency "vcr", "~> 2.9"
|
66
33
|
end
|
data/lib/bugsnag/api/client.rb
CHANGED
@@ -13,6 +13,8 @@ require "bugsnag/api/client/comments"
|
|
13
13
|
require "bugsnag/api/client/stability"
|
14
14
|
require "bugsnag/api/client/releases"
|
15
15
|
|
16
|
+
require "base64"
|
17
|
+
|
16
18
|
module Bugsnag
|
17
19
|
module Api
|
18
20
|
|
@@ -169,9 +171,11 @@ module Bugsnag
|
|
169
171
|
http.headers[:user_agent] = configuration.user_agent
|
170
172
|
|
171
173
|
if basic_authenticated?
|
172
|
-
|
174
|
+
credentials = Base64.strict_encode64("#{configuration.email}:#{configuration.password}")
|
175
|
+
|
176
|
+
http.headers[:Authorization] = "Basic #{credentials}"
|
173
177
|
elsif token_authenticated?
|
174
|
-
http.
|
178
|
+
http.headers[:Authorization] = "token #{configuration.auth_token}"
|
175
179
|
end
|
176
180
|
end
|
177
181
|
end
|
@@ -8,7 +8,7 @@ module Bugsnag
|
|
8
8
|
|
9
9
|
# This class raises an Bugsnag-flavored exception based
|
10
10
|
# HTTP status codes returned by the API
|
11
|
-
class RaiseError < Faraday::Response::
|
11
|
+
class RaiseError < Faraday::Response::RaiseError
|
12
12
|
def on_complete(response)
|
13
13
|
if error = Bugsnag::Api::Error.from_response(response)
|
14
14
|
raise error
|
data/lib/bugsnag/api/version.rb
CHANGED
data/lib/bugsnag/api.rb
CHANGED
@@ -20,7 +20,10 @@ module Bugsnag
|
|
20
20
|
client.configuration
|
21
21
|
end
|
22
22
|
|
23
|
-
# Get the static API client
|
23
|
+
# Get the static API client. Note that using the static API
|
24
|
+
# client may not work as expected in a multithreaded environment
|
25
|
+
# (e.g. when using the {#paginate} or {#last_response} instance
|
26
|
+
# methods)
|
24
27
|
#
|
25
28
|
# @return [Bugsnag::Api::Client] API client
|
26
29
|
def client
|
@@ -16,7 +16,7 @@ http_interactions:
|
|
16
16
|
X-Bugsnag-Api:
|
17
17
|
- 'true'
|
18
18
|
Authorization:
|
19
|
-
- Basic
|
19
|
+
- Basic QlVHU05BR19VU0VSX0VNQUlMOkJVR1NOQUdfUEFTU1dPUkQ=
|
20
20
|
Accept-Encoding:
|
21
21
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
22
|
Accept:
|
@@ -84,7 +84,7 @@ http_interactions:
|
|
84
84
|
X-Bugsnag-Api:
|
85
85
|
- 'true'
|
86
86
|
Authorization:
|
87
|
-
- Basic
|
87
|
+
- Basic QlVHU05BR19VU0VSX0VNQUlMOkJVR1NOQUdfUEFTU1dPUkQ=
|
88
88
|
Accept-Encoding:
|
89
89
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
90
90
|
Accept:
|
@@ -16,7 +16,7 @@ http_interactions:
|
|
16
16
|
X-Bugsnag-Api:
|
17
17
|
- 'true'
|
18
18
|
Authorization:
|
19
|
-
- Basic
|
19
|
+
- Basic QlVHU05BR19VU0VSX0VNQUlMOkJVR1NOQUdfUEFTU1dPUkQ=
|
20
20
|
Accept-Encoding:
|
21
21
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
22
|
Accept:
|
@@ -84,7 +84,7 @@ http_interactions:
|
|
84
84
|
X-Bugsnag-Api:
|
85
85
|
- 'true'
|
86
86
|
Authorization:
|
87
|
-
- Basic
|
87
|
+
- Basic QlVHU05BR19VU0VSX0VNQUlMOkJVR1NOQUdfUEFTU1dPUkQ=
|
88
88
|
Accept-Encoding:
|
89
89
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
90
90
|
Accept:
|
@@ -16,7 +16,7 @@ http_interactions:
|
|
16
16
|
X-Bugsnag-Api:
|
17
17
|
- 'true'
|
18
18
|
Authorization:
|
19
|
-
- Basic
|
19
|
+
- Basic QlVHU05BR19VU0VSX0VNQUlMOkJVR1NOQUdfUEFTU1dPUkQ=
|
20
20
|
Accept-Encoding:
|
21
21
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
22
|
Accept:
|
@@ -84,7 +84,7 @@ http_interactions:
|
|
84
84
|
X-Bugsnag-Api:
|
85
85
|
- 'true'
|
86
86
|
Authorization:
|
87
|
-
- Basic
|
87
|
+
- Basic QlVHU05BR19VU0VSX0VNQUlMOkJVR1NOQUdfUEFTU1dPUkQ=
|
88
88
|
Accept-Encoding:
|
89
89
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
90
90
|
Accept:
|
data/spec/spec_helper.rb
CHANGED
@@ -23,9 +23,28 @@ VCR.configure do |c|
|
|
23
23
|
c.cassette_library_dir = "spec/cassettes"
|
24
24
|
c.hook_into :webmock
|
25
25
|
c.configure_rspec_metadata!
|
26
|
+
|
27
|
+
USER_AGENT_REGEX = /\ABugsnag API Ruby Gem \d+\.\d+\.\d+\z/
|
28
|
+
HEADERS_SET_BY_BUGSNAG = ["Content-Type", "X-Version", "X-Bugsnag-Api", "Authorization"]
|
29
|
+
|
30
|
+
user_agent_valid = lambda do |values|
|
31
|
+
return false if values.length != 1
|
32
|
+
|
33
|
+
values.first.match(USER_AGENT_REGEX)
|
34
|
+
end
|
35
|
+
|
36
|
+
header_matcher = lambda do |request_a, request_b|
|
37
|
+
return false unless user_agent_valid.(request_a.headers["User-Agent"])
|
38
|
+
return false unless user_agent_valid.(request_b.headers["User-Agent"])
|
39
|
+
|
40
|
+
HEADERS_SET_BY_BUGSNAG.all? do |header|
|
41
|
+
request_a.headers[header] == request_b.headers[header]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
26
45
|
c.default_cassette_options = {
|
27
|
-
:record => ENV['
|
28
|
-
:match_requests_on => [:method, :path]
|
46
|
+
:record => ENV['CI'] ? :none : :once,
|
47
|
+
:match_requests_on => [:method, :path, header_matcher]
|
29
48
|
}
|
30
49
|
|
31
50
|
c.filter_sensitive_data("https://api.bugsnag.com") { test_bugsnag_endpoint }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sawyer
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.9.2
|
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: 0.
|
26
|
+
version: 0.9.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,47 +67,47 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.7.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.3.2
|
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: 2.3.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: addressable
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.3.
|
89
|
+
version: 2.3.6
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.3.
|
96
|
+
version: 2.3.6
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: json
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,14 +257,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
257
257
|
requirements:
|
258
258
|
- - ">="
|
259
259
|
- !ruby/object:Gem::Version
|
260
|
-
version: '
|
260
|
+
version: '2.6'
|
261
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
262
|
requirements:
|
263
263
|
- - ">="
|
264
264
|
- !ruby/object:Gem::Version
|
265
265
|
version: '0'
|
266
266
|
requirements: []
|
267
|
-
rubygems_version: 3.
|
267
|
+
rubygems_version: 3.0.3.1
|
268
268
|
signing_key:
|
269
269
|
specification_version: 4
|
270
270
|
summary: Bugsnag API toolkit for ruby
|