bugsnag-api 2.0.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +5 -5
  2. data/.buildkite/pipeline.yml +6 -0
  3. data/.github/ISSUE_TEMPLATE/A.md +14 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +16 -0
  7. data/.github/support.md +19 -0
  8. data/.github/workflows/tests.yml +53 -0
  9. data/.rubocop.yml +4 -0
  10. data/.rubocop_todo.yml +271 -0
  11. data/CHANGELOG.md +34 -0
  12. data/CONTRIBUTING.md +1 -1
  13. data/Gemfile +9 -0
  14. data/README.md +77 -2
  15. data/bugsnag-api.gemspec +48 -6
  16. data/config/.gitignore +1 -0
  17. data/docker-compose.yml +9 -0
  18. data/dockerfiles/Dockerfile.audit +5 -0
  19. data/lib/bugsnag/api/client/collaborators.rb +1 -2
  20. data/lib/bugsnag/api/client/comments.rb +1 -1
  21. data/lib/bugsnag/api/client/currentuser.rb +0 -1
  22. data/lib/bugsnag/api/client/errors.rb +12 -11
  23. data/lib/bugsnag/api/client/eventfields.rb +1 -2
  24. data/lib/bugsnag/api/client/events.rb +1 -2
  25. data/lib/bugsnag/api/client/organizations.rb +1 -2
  26. data/lib/bugsnag/api/client/pivots.rb +1 -2
  27. data/lib/bugsnag/api/client/projects.rb +2 -3
  28. data/lib/bugsnag/api/client/releases.rb +38 -0
  29. data/lib/bugsnag/api/client/stability.rb +16 -0
  30. data/lib/bugsnag/api/client/trends.rb +8 -5
  31. data/lib/bugsnag/api/client.rb +23 -3
  32. data/lib/bugsnag/api/configuration.rb +1 -1
  33. data/lib/bugsnag/api/error.rb +1 -1
  34. data/lib/bugsnag/api/response/raise_error.rb +0 -2
  35. data/lib/bugsnag/api/version.rb +1 -1
  36. data/scripts/license_finder.sh +4 -0
  37. data/spec/bugsnag/api/client/releases_spec.rb +184 -0
  38. data/spec/bugsnag/api/client/stability_spec.rb +32 -0
  39. data/spec/bugsnag/api/client_spec.rb +69 -7
  40. data/spec/bugsnag/api_spec.rb +2 -0
  41. data/spec/cassettes/Bugsnag_Api_Client/_get/handles_query_params.yml +13 -21
  42. data/spec/cassettes/Bugsnag_Api_Client/_last_response/caches_the_last_agent_response.yml +13 -21
  43. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/_invitecollaborator/creates_and_returns_a_collaborator.yml +14 -26
  44. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/_invitecollaborator/invites_multiple_collaborators.yml +14 -26
  45. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborator/returns_a_collaborator.yml +29 -53
  46. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborators/returns_a_list_of_all_organization_collaborators.yml +30 -55
  47. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborators/returns_a_list_of_all_project_collaborators.yml +30 -55
  48. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborators/throws_an_argument_error_if_neither_org_id_or_project_id_are_provided.yml +14 -26
  49. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_delete_collaborator/deletes_a_collaborator.yml +14 -26
  50. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_update_collaborator_permissions/updates_and_returns_the_collaborator.yml +29 -53
  51. data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_view_collaborator_projects/returns_a_list_of_projects_belonging_to_the_collaborator.yml +49 -55
  52. data/spec/cassettes/Bugsnag_Api_Client_Comments/_create_comment/creates_a_comment_on_the_error.yml +17 -29
  53. data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_comment/retrieves_the_comment_specified.yml +32 -56
  54. data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_comments/retrieves_all_comments_on_an_error.yml +33 -57
  55. data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_delete_comment/deletes_the_comment_and_returns_true.yml +17 -29
  56. data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_update_comment/updates_the_message_on_a_comment.yml +32 -56
  57. data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_organizations/when_using_auth_token/returns_the_organization_the_auth_token_belongs_to.yml +14 -27
  58. data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_organizations/when_using_user_credentials/returns_users_organizations.yml +17 -31
  59. data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_projects/when_using_auth_token/lists_current_user_s_projects_in_the_organization.yml +34 -28
  60. data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_projects/when_using_user_credentials/lists_current_user_s_projects_in_the_organization.yml +37 -32
  61. data/spec/cassettes/Bugsnag_Api_Client_Errors/_error/returns_a_single_error.yml +14 -28
  62. data/spec/cassettes/Bugsnag_Api_Client_Errors/_errors/returns_errors_on_the_project.yml +16 -30
  63. data/spec/cassettes/Bugsnag_Api_Client_Errors/_update_errors/updates_and_returns_the_updated_errors.yml +13 -25
  64. data/spec/cassettes/Bugsnag_Api_Client_Events/_error_events/lists_all_error_events.yml +19 -30
  65. data/spec/cassettes/Bugsnag_Api_Client_Events/_event/returns_the_specified_event.yml +16 -199
  66. data/spec/cassettes/Bugsnag_Api_Client_Events/_events/returns_the_a_list_of_project_errors.yml +19 -30
  67. data/spec/cassettes/Bugsnag_Api_Client_Events/_latest_event/returns_the_last_event_on_an_error.yml +16 -199
  68. data/spec/cassettes/Bugsnag_Api_Client_Organizations/_create_organization/creates_a_new_organization.yml +17 -30
  69. data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_delete_organization/deletes_the_organization.yml +32 -58
  70. data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_organization/returns_the_requested_organization.yml +35 -61
  71. data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_update_organization/updates_and_returns_the_organization.yml +35 -61
  72. data/spec/cassettes/Bugsnag_Api_Client_Projects/_create_project/creates_a_new_project.yml +14 -26
  73. data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_delete_project/deletes_the_project.yml +26 -50
  74. data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_project/returns_the_requested_project.yml +29 -53
  75. data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_regenerate_api_key/removes_the_current_api_key_and_replaces_it_with_a_new_api_key.yml +29 -53
  76. data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_update_project/updates_and_returns_the_project.yml +29 -53
  77. data/spec/cassettes/Bugsnag_Api_Client_Releases/_release/gets_a_single_release.yml +87 -0
  78. data/spec/cassettes/Bugsnag_Api_Client_Releases/_release_groups/accepts_parameters.yml +90 -0
  79. data/spec/cassettes/Bugsnag_Api_Client_Releases/_release_groups/gets_releases_in_a_release_group.yml +87 -0
  80. data/spec/cassettes/Bugsnag_Api_Client_Releases/_releases/accepts_parameters.yml +92 -0
  81. data/spec/cassettes/Bugsnag_Api_Client_Releases/_releases/gets_as_list_of_releases.yml +91 -0
  82. data/spec/cassettes/Bugsnag_Api_Client_Stability/_stability_trend/gets_the_stability_trend.yml +87 -0
  83. data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_buckets/returns_a_list_of_error_trends_in_bucket_form.yml +14 -26
  84. data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_buckets/returns_a_list_of_project_trends_in_bucket_form.yml +14 -26
  85. data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_resolution/returns_a_list_of_project_trends_in_resolution_form.yml +14 -26
  86. data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_resolution/returns_a_list_of_trends_in_resolution_form.yml +14 -26
  87. data/spec/spec_helper.rb +35 -7
  88. metadata +67 -24
  89. data/.travis.yml +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4616f90142beb5163ce325dee92a393d3b990bac
4
- data.tar.gz: 0e1f46dd0c4543abaf73fd39a6bd63fc9028ab80
2
+ SHA256:
3
+ metadata.gz: 617f27c61db7b75cecc854aeeca930e461ce849c48ce5f9fba4ee072639781c4
4
+ data.tar.gz: 84358e937d507d8abc75aa9971f99e9bba6a350e8292b8a3bf21d8a03d58ad33
5
5
  SHA512:
6
- metadata.gz: c5b44534d8d0b639c054ad67402fcd4d25bb8c2f985e06019135c36868cdddc518d2915a88eefc7fed3e0b5da76dc4cba79473fd92ab68f28ea54b7002362557
7
- data.tar.gz: fd9c7470df57b829520e4deb9609e1e3414da9e6d4f7e261ca8cb2b1253a596e3bef1668621cc2411eae805d4a765379056092423cd94e4dcaeec9763b37536a
6
+ metadata.gz: d0779c59b38cc5735a8074489df90f0ca74f34dea5a3e38e2f957ff4735aa396005e5f607c51905107d3f7f848f5226323b84e01a2e3b564ecd01df8b8151b65
7
+ data.tar.gz: f1db01abc52ef8289b21de312634ecc516214bf0805f4be2063f87deb37ec3fdc70028e435ab93bc9d371e0b84beeff513f4843613c0dc3eb912fc4f9c3e3da6
@@ -0,0 +1,6 @@
1
+ steps:
2
+ - name: ':copyright: License Audit'
3
+ plugins:
4
+ docker-compose#v3.7.0:
5
+ run: license_finder
6
+ command: /bin/bash -lc '/scan/scripts/license_finder.sh'
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: Having trouble getting started?
3
+ about: Please contact us at support@bugsnag.com for assistance with integrating Bugsnag
4
+ into your application.
5
+ title: ''
6
+ labels: ''
7
+ assignees: ''
8
+
9
+ ---
10
+ Please checkout our [documentation](https://docs.bugsnag.com/api/data-access/#ruby-api-toolkit) for guides, references and tutorials.
11
+
12
+ If you have questions about your integration please contact us at [support@bugsnag.com](mailto:support@bugsnag.com).
13
+
14
+ Alternatively, view additional options at [support.md](../SUPPORT.md).
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve the library
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ <!-- Before raising, please check if somebody else has already reported your issue. -->
11
+
12
+ ### Describe the bug
13
+ A clear and concise description of what the bug is.
14
+
15
+ ### Steps to reproduce
16
+ 1. Go to '...'
17
+ 2. Click on '....'
18
+ 3. Scroll down to '....'
19
+ 4. See error
20
+
21
+ ### Environment
22
+ * Ruby version:
23
+
24
+ <!--
25
+ Below are a few approaches you might take to communicate the issue, in
26
+ descending order of awesomeness. Please choose one and feel free to delete
27
+ the others from this template.
28
+ -->
29
+
30
+ ### Example Repo <!-- Option 1 -->
31
+
32
+ - [ ] Create a minimal repository that can reproduce the issue
33
+ - [ ] Link to it here:
34
+
35
+ ### Example code snippet <!-- Option 2 -->
36
+
37
+ ```
38
+ # (Insert code sample to reproduce the problem)
39
+ ```
40
+
41
+ <!-- Error messages, if any -->
42
+ <details><summary>Error messages:</summary>
43
+
44
+ ```
45
+
46
+ ```
47
+ </details>
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ <!-- Before creating, please check if somebody else has already reported your feature request. -->
11
+
12
+ ### Description
13
+ <!-- Is your feature request related to a problem? Please describe.
14
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
15
+ -->
16
+
17
+ **Describe the solution you'd like**
18
+ <!-- A clear and concise description of what you want to happen. -->
19
+
20
+ **Describe alternatives you've considered**
21
+ <!-- A clear and concise description of any alternative solutions or features you've considered. -->
22
+
23
+ **Additional context**
24
+ <!--Add any other context about the feature request here.-->
@@ -0,0 +1,16 @@
1
+ ## Goal
2
+
3
+ <!-- Why is this change necessary? -->
4
+
5
+ ## Design
6
+
7
+ <!-- Why was this approach used? -->
8
+
9
+ ## Changeset
10
+
11
+ <!-- What changed? -->
12
+
13
+ ## Testing
14
+
15
+ <!-- How was it tested? What manual and automated tests were
16
+ run/added? -->
@@ -0,0 +1,19 @@
1
+ ## Are you having trouble getting started?
2
+ If you haven't already, please checkout our [documentation](https://docs.bugsnag.com/api/data-access/#ruby-api-toolkit) for guides, references and tutorials.
3
+
4
+ Or, if you wish you can [contact us directly](mailto:support@bugsnag.com) for assistance on integrating Bugsnag into your application, troubleshooting an issue or a question about our supported features.
5
+
6
+ When contacting support, please include as much information as necessary, including:
7
+
8
+ - example code snippet
9
+ - steps to reproduce
10
+ - expected/actual behaviour
11
+
12
+ * Ruby version:
13
+
14
+ ## Bug or Feature Requests
15
+ If you would like to raise a bug or feature request please do so by creating a [New Issue](https://github.com/bugsnag/bugsnag-api-ruby/issues/new/choose) and selecting bug or feature.
16
+ Please note: we cannot promise that we will fulfil all requests
17
+
18
+ ## Pull Requests
19
+ If you have made a fix and would like to raise a pull request, please read our [CONTRIBUTING.md](../CONTRIBUTING.md) file before creating the pull request.
@@ -0,0 +1,53 @@
1
+ name: Tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ specs:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby-version: ['2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+
16
+ - name: Install Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ bundler-cache: true
21
+
22
+ - run: bundle exec rake spec
23
+
24
+ linting:
25
+ runs-on: ubuntu-latest
26
+
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+
30
+ - name: Install Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: '3.0'
34
+ bundler-cache: true
35
+
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/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Metrics/ClassLength:
4
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,271 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-02-20 14:31:40 +0000 using RuboCop version 0.52.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ Layout/EmptyLines:
12
+ Exclude:
13
+ - 'lib/bugsnag/api.rb'
14
+
15
+ # Offense count: 3
16
+ # Cop supports --auto-correct.
17
+ Layout/EmptyLinesAroundAccessModifier:
18
+ Exclude:
19
+ - 'lib/bugsnag/api.rb'
20
+ - 'lib/bugsnag/api/client.rb'
21
+ - 'lib/bugsnag/api/response/raise_error.rb'
22
+
23
+ # Offense count: 12
24
+ # Cop supports --auto-correct.
25
+ # Configuration parameters: EnforcedStyle.
26
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
27
+ Layout/EmptyLinesAroundClassBody:
28
+ Exclude:
29
+ - 'lib/bugsnag/api/client/collaborators.rb'
30
+ - 'lib/bugsnag/api/client/comments.rb'
31
+ - 'lib/bugsnag/api/client/currentuser.rb'
32
+ - 'lib/bugsnag/api/client/errors.rb'
33
+ - 'lib/bugsnag/api/client/eventfields.rb'
34
+ - 'lib/bugsnag/api/client/events.rb'
35
+ - 'lib/bugsnag/api/client/organizations.rb'
36
+ - 'lib/bugsnag/api/client/pivots.rb'
37
+ - 'lib/bugsnag/api/client/projects.rb'
38
+ - 'lib/bugsnag/api/client/trends.rb'
39
+ - 'lib/bugsnag/api/error.rb'
40
+ - 'lib/bugsnag/api/response/raise_error.rb'
41
+
42
+ # Offense count: 4
43
+ # Cop supports --auto-correct.
44
+ # Configuration parameters: EnforcedStyle.
45
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
46
+ Layout/EmptyLinesAroundModuleBody:
47
+ Exclude:
48
+ - 'lib/bugsnag/api.rb'
49
+ - 'lib/bugsnag/api/client.rb'
50
+ - 'lib/bugsnag/api/configuration.rb'
51
+ - 'lib/bugsnag/api/response/raise_error.rb'
52
+
53
+ # Offense count: 2
54
+ # Cop supports --auto-correct.
55
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
56
+ # SupportedStyles: aligned, indented
57
+ Layout/MultilineOperationIndentation:
58
+ Exclude:
59
+ - 'lib/bugsnag/api/error.rb'
60
+
61
+ # Offense count: 1
62
+ # Cop supports --auto-correct.
63
+ Layout/SpaceAfterComma:
64
+ Exclude:
65
+ - 'lib/bugsnag/api/configuration.rb'
66
+
67
+ # Offense count: 7
68
+ # Cop supports --auto-correct.
69
+ # Configuration parameters: EnforcedStyle.
70
+ # SupportedStyles: space, no_space
71
+ Layout/SpaceAroundEqualsInParameterDefault:
72
+ Exclude:
73
+ - 'lib/bugsnag/api/client/errors.rb'
74
+ - 'lib/bugsnag/api/client/pivots.rb'
75
+ - 'lib/bugsnag/api/client/trends.rb'
76
+ - 'lib/bugsnag/api/error.rb'
77
+
78
+ # Offense count: 1
79
+ # Cop supports --auto-correct.
80
+ # Configuration parameters: EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
81
+ # SupportedStyles: space, no_space
82
+ # SupportedStylesForEmptyBraces: space, no_space
83
+ Layout/SpaceInsideBlockBraces:
84
+ EnforcedStyle: no_space
85
+
86
+ # Offense count: 34
87
+ # Cop supports --auto-correct.
88
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
89
+ # SupportedStyles: space, no_space, compact
90
+ # SupportedStylesForEmptyBraces: space, no_space
91
+ Layout/SpaceInsideHashLiteralBraces:
92
+ Exclude:
93
+ - 'lib/bugsnag/api/client.rb'
94
+ - 'lib/bugsnag/api/client/collaborators.rb'
95
+ - 'lib/bugsnag/api/client/comments.rb'
96
+ - 'lib/bugsnag/api/client/errors.rb'
97
+ - 'lib/bugsnag/api/client/eventfields.rb'
98
+ - 'lib/bugsnag/api/client/organizations.rb'
99
+ - 'lib/bugsnag/api/client/projects.rb'
100
+ - 'lib/bugsnag/api/client/trends.rb'
101
+
102
+ # Offense count: 17
103
+ # Cop supports --auto-correct.
104
+ Layout/TrailingWhitespace:
105
+ Exclude:
106
+ - 'lib/bugsnag/api/client/collaborators.rb'
107
+ - 'lib/bugsnag/api/client/currentuser.rb'
108
+ - 'lib/bugsnag/api/client/errors.rb'
109
+ - 'lib/bugsnag/api/client/eventfields.rb'
110
+ - 'lib/bugsnag/api/client/events.rb'
111
+ - 'lib/bugsnag/api/client/organizations.rb'
112
+ - 'lib/bugsnag/api/client/pivots.rb'
113
+ - 'lib/bugsnag/api/client/projects.rb'
114
+ - 'lib/bugsnag/api/client/trends.rb'
115
+
116
+ # Offense count: 1
117
+ Lint/AmbiguousOperator:
118
+ Exclude:
119
+ - 'lib/bugsnag/api/configuration.rb'
120
+
121
+ # Offense count: 4
122
+ # Configuration parameters: AllowSafeAssignment.
123
+ Lint/AssignmentInCondition:
124
+ Exclude:
125
+ - 'lib/bugsnag/api/client.rb'
126
+ - 'lib/bugsnag/api/error.rb'
127
+ - 'lib/bugsnag/api/response/raise_error.rb'
128
+
129
+ # Offense count: 4
130
+ # Cop supports --auto-correct.
131
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
132
+ Lint/UnusedMethodArgument:
133
+ Exclude:
134
+ - 'lib/bugsnag/api/client.rb'
135
+ - 'lib/bugsnag/api/client/errors.rb'
136
+ - 'lib/bugsnag/api/client/eventfields.rb'
137
+
138
+ # Offense count: 1
139
+ Lint/UriEscapeUnescape:
140
+ Exclude:
141
+ - 'lib/bugsnag/api/client.rb'
142
+
143
+ # Offense count: 2
144
+ Lint/UselessAssignment:
145
+ Exclude:
146
+ - 'lib/bugsnag/api/error.rb'
147
+
148
+ # Offense count: 3
149
+ Metrics/AbcSize:
150
+ Max: 27
151
+
152
+ # Offense count: 1
153
+ # Configuration parameters: CountBlocks.
154
+ Metrics/BlockNesting:
155
+ Max: 4
156
+
157
+ # Offense count: 1
158
+ # Configuration parameters: CountComments.
159
+ Metrics/ClassLength:
160
+ Max: 127
161
+
162
+ # Offense count: 2
163
+ Metrics/CyclomaticComplexity:
164
+ Max: 18
165
+
166
+ # Offense count: 5
167
+ # Configuration parameters: CountComments.
168
+ Metrics/MethodLength:
169
+ Max: 23
170
+
171
+ # Offense count: 2
172
+ Metrics/PerceivedComplexity:
173
+ Max: 10
174
+
175
+ # Offense count: 10
176
+ # Cop supports --auto-correct.
177
+ # Configuration parameters: EnforcedStyle.
178
+ # SupportedStyles: braces, no_braces, context_dependent
179
+ Style/BracesAroundHashParameters:
180
+ Exclude:
181
+ - 'lib/bugsnag/api/client/collaborators.rb'
182
+ - 'lib/bugsnag/api/client/comments.rb'
183
+ - 'lib/bugsnag/api/client/errors.rb'
184
+ - 'lib/bugsnag/api/client/eventfields.rb'
185
+ - 'lib/bugsnag/api/client/organizations.rb'
186
+ - 'lib/bugsnag/api/client/projects.rb'
187
+
188
+ # Offense count: 2
189
+ Style/DoubleNegation:
190
+ Exclude:
191
+ - 'lib/bugsnag/api/client.rb'
192
+
193
+ # Offense count: 1
194
+ # Cop supports --auto-correct.
195
+ # Configuration parameters: EnforcedStyle.
196
+ # SupportedStyles: empty, nil, both
197
+ Style/EmptyElse:
198
+ Exclude:
199
+ - 'lib/bugsnag/api/error.rb'
200
+
201
+ # Offense count: 1
202
+ # Configuration parameters: MinBodyLength.
203
+ Style/GuardClause:
204
+ Exclude:
205
+ - 'lib/bugsnag/api/response/raise_error.rb'
206
+
207
+ # Offense count: 26
208
+ # Cop supports --auto-correct.
209
+ # Configuration parameters: UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
210
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
211
+ Style/HashSyntax:
212
+ EnforcedStyle: hash_rockets
213
+
214
+ # Offense count: 1
215
+ Style/IfInsideElse:
216
+ Exclude:
217
+ - 'lib/bugsnag/api/client.rb'
218
+
219
+ # Offense count: 1
220
+ Style/MethodMissing:
221
+ Exclude:
222
+ - 'lib/bugsnag/api.rb'
223
+
224
+ # Offense count: 4
225
+ # Cop supports --auto-correct.
226
+ Style/MutableConstant:
227
+ Exclude:
228
+ - 'lib/bugsnag/api/configuration.rb'
229
+ - 'lib/bugsnag/api/version.rb'
230
+
231
+ # Offense count: 2
232
+ # Cop supports --auto-correct.
233
+ Style/RedundantSelf:
234
+ Exclude:
235
+ - 'lib/bugsnag/api/configuration.rb'
236
+
237
+ # Offense count: 31
238
+ # Cop supports --auto-correct.
239
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
240
+ # SupportedStyles: single_quotes, double_quotes
241
+ Style/StringLiterals:
242
+ Exclude:
243
+ - 'lib/bugsnag/api.rb'
244
+ - 'lib/bugsnag/api/client.rb'
245
+ - 'lib/bugsnag/api/client/collaborators.rb'
246
+ - 'lib/bugsnag/api/client/currentuser.rb'
247
+ - 'lib/bugsnag/api/client/errors.rb'
248
+ - 'lib/bugsnag/api/client/organizations.rb'
249
+ - 'lib/bugsnag/api/configuration.rb'
250
+ - 'lib/bugsnag/api/error.rb'
251
+ - 'lib/bugsnag/api/response/raise_error.rb'
252
+ - 'lib/bugsnag/api/version.rb'
253
+
254
+ # Offense count: 2
255
+ # Cop supports --auto-correct.
256
+ # Configuration parameters: MinSize.
257
+ # SupportedStyles: percent, brackets
258
+ Style/SymbolArray:
259
+ EnforcedStyle: brackets
260
+
261
+ # Offense count: 1
262
+ # Cop supports --auto-correct.
263
+ Style/UnneededInterpolation:
264
+ Exclude:
265
+ - 'lib/bugsnag/api/error.rb'
266
+
267
+ # Offense count: 80
268
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
269
+ # URISchemes: http, https
270
+ Metrics/LineLength:
271
+ Max: 146
data/CHANGELOG.md CHANGED
@@ -1,6 +1,40 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 2.1.1 (2 November 2021)
5
+
6
+ ### Fixes
7
+
8
+ * Fix Faraday deprecation warning
9
+ | [sambostock](https://github.com/sambostock)
10
+ | [#36](https://github.com/bugsnag/bugsnag-api-ruby/pull/36)
11
+
12
+ ## 2.1.0 (28 July 2021)
13
+
14
+ ### Enhancements
15
+
16
+ * Add stability and release endpoints
17
+ | [#34](https://github.com/bugsnag/bugsnag-api-ruby/pull/34)
18
+
19
+ ## 2.0.3 (11 May 2021)
20
+
21
+ ### Fixes
22
+
23
+ * Fix error handling middleware compatibility with Faraday v1.2.0 and above
24
+ | [askreet](https://github.com/askreet)
25
+ | [#30](https://github.com/bugsnag/bugsnag-api-ruby/pull/30)
26
+
27
+ * Remove call to deprecated `URI.escape`
28
+ | [askreet](https://github.com/askreet)
29
+ | [#28](https://github.com/bugsnag/bugsnag-api-ruby/pull/28)
30
+
31
+ ## 2.0.2 (21 Feb 2018)
32
+
33
+ ### Fixes
34
+
35
+ * Fixes issue with custom query parameters being overridden
36
+ | [#13](https://github.com/bugsnag/bugsnag-api-ruby/pull/13)
37
+
4
38
  ## 2.0.1 (15 Nov 2017)
5
39
 
6
40
  ### Fixes
data/CONTRIBUTING.md CHANGED
@@ -26,7 +26,7 @@ If you're a member of the core team, follow these instructions for releasing bug
26
26
  ### Every time
27
27
 
28
28
  * Update `CHANGELOG.md`
29
- * Update the version number in `bugsnag-api.gemspec`
29
+ * Update the version number in [`lib/bugsnag/api/version.rb`](./lib/bugsnag/api/version.rb)
30
30
  * Update `README.md` if necessary with changes to the interface or configuration
31
31
  * Commit/push your changes
32
32
  * Release to rubygems
data/Gemfile CHANGED
@@ -1,4 +1,13 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ # Any :development dependencies are ignored for license auditing purposes
4
+ group :development do
5
+ end
6
+
7
+ # Any :test dependencies are ignored for license auditing purposes
8
+ group :test do
9
+ end
10
+
3
11
  # Specify your gem's dependencies in bugsnag-api.gemspec
4
12
  gemspec
13
+
data/README.md CHANGED
@@ -20,6 +20,7 @@ This library borrows heavily from the code and philosophies of the fantastic [Oc
20
20
  - [Accessing Related Resources](#accessing-related-resources)
21
21
  - [Authentication](#authentication)
22
22
  - [Pagination](#pagination)
23
+ - [Filtering](#filtering)
23
24
  - [Accessing HTTP responses](#accessing-http-responses)
24
25
  - [API Methods](#api-methods)
25
26
  - [Organizations](#organizations)
@@ -31,6 +32,8 @@ This library borrows heavily from the code and philosophies of the fantastic [Oc
31
32
  - [Pivots](#pivots)
32
33
  - [Projects](#projects)
33
34
  - [Trends](#trends)
35
+ - [Stability](#stability)
36
+ - [Releases](#releases)
34
37
  - [Advanced Configuration](#advanced-configuration)
35
38
 
36
39
 
@@ -162,6 +165,33 @@ until last_response.rels[:next].nil?
162
165
  end
163
166
  ```
164
167
 
168
+ ### Filtering
169
+
170
+ Events and Errors can be filtered to return a subset of data. Any of the filters usable in the Bugsnag dashoard can be used in this API. The filter object is a hash of Event Field keys containing an array of filter values. Each filter value has a `type` and a `value` to filter on. The type determines the type of comparison that will be performed.
171
+
172
+ | `type` | Description | Multiple value combination logic |
173
+ |-|-|-|
174
+ | `eq` | Filter for items that 'match' the value. Some fields require an exact match and some support substring matching. | OR |
175
+ | `ne` | Filter for items that don't match the value. | AND |
176
+
177
+ :warning: Note that the Event Field `search` can not be used more than once in a call.
178
+
179
+ You can see the filterable fields for a project using the following snippet, after setting the `project-id` value.
180
+
181
+ ```ruby
182
+ fields = Bugsnag::Api.event_fields("project-id")
183
+
184
+ puts "List of the searchable fields for this project:"
185
+ fields.each_with_index do |field,idx|
186
+ puts " [#{idx}] #{field.display_id}"
187
+ end
188
+ # => List of the searchable fields for this project:
189
+ # => [0] event
190
+ # => [1] error
191
+ # => [2] search
192
+ # => [3] user.id
193
+ # => ...
194
+ ```
165
195
 
166
196
  ### Accessing HTTP responses
167
197
 
@@ -186,7 +216,7 @@ documentation](http://www.rubydoc.info/gems/bugsnag-api/Bugsnag/Api/Client)
186
216
  orgs = Bugsnag::Api.organizations
187
217
 
188
218
  # Get a single organization
189
- org = Bugsnag::Api.organizations("organization-id")
219
+ org = Bugsnag::Api.organization("organization-id")
190
220
  ```
191
221
 
192
222
  ### Collaborators
@@ -236,7 +266,13 @@ Bugsnag::Api.delete_comment("comment-id")
236
266
 
237
267
  ```ruby
238
268
  # List project errors
239
- errors = Bugsnag::Api.errors("project-id", "project-id")
269
+ errors = Bugsnag::Api.errors("project-id", nil)
270
+
271
+ # List errors with a filter (see Filtering section for more information)
272
+ # Returns errors that match `EXC_BAD_INSTRUCTION`, this could be from the error class, message, context, or stack trace.
273
+ errors = Bugsnag::Api.errors("project-id", nil, direction:"desc", filters: {
274
+ "search": [{ "type":"eq", "value":"EXC_BAD_INSTRUCTION" }]
275
+ })
240
276
 
241
277
  # Get a single error
242
278
  error = Bugsnag::Api.error("project-id", "error-id")
@@ -261,6 +297,15 @@ events = Bugsnag::Api.events("project-id")
261
297
  # List error events
262
298
  events = Bugsnag::Api.error_events("project-id", "error-id")
263
299
 
300
+ # List events with a filter (see Filtering section for more information)
301
+ # Returns events with
302
+ # class `EXC_BAD_INSTRUCTION` OR `EXC_BAD_ACCESS`
303
+ # AND where the device is jailbroken
304
+ events = Bugsnag::Api.events(PROJECT_ID, direction:"desc", filters: {
305
+ "event.class": [{ "type":"eq", "value":"EXC_BAD_INSTRUCTION" }, { "type":"eq", "value":"EXC_BAD_ACCESS" }],
306
+ "device.jailbroken": [{ "type":"eq", "value":"false"}]
307
+ })
308
+
264
309
  # Get the latest event
265
310
  event = Bugsnag::Api.latest_event("project-id", "error-id")
266
311
 
@@ -321,6 +366,36 @@ Bugsnag::Api.pivots("project-id")
321
366
  Bugsnag::Api.pivot_values("project-id", "display id")
322
367
  ```
323
368
 
369
+ ### Trends
370
+
371
+ ```ruby
372
+ # list an error's trends in 5 buckets
373
+ Bugsnag::Api.trends_buckets("project-id", 5, "error-id")
374
+
375
+ # list a project's trends by resolution
376
+ Bugsnag::Api.trends_resolution("project-id", "2h")
377
+ ```
378
+
379
+ ### Stability
380
+
381
+ ```ruby
382
+ # view a project's stability trend
383
+ Bugsnag::Api.stability_trend("project-id")
384
+ ```
385
+
386
+ ### Releases
387
+
388
+ ```ruby
389
+ # list the releases in a project
390
+ Bugsnag::Api.releases("project-id")
391
+
392
+ # view a single release
393
+ Bugsnag::Api.release("project-id", "release-id")
394
+
395
+ # list the releases in a release group
396
+ Bugsnag::Api.releases_in_group("release-group-id")
397
+ ```
398
+
324
399
  ## Advanced Configuration
325
400
 
326
401
  ### Endpoint