bugsnag-api 2.0.0 → 2.1.0

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.
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 +42 -7
  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.rb +18 -1
  20. data/lib/bugsnag/api/client/collaborators.rb +1 -2
  21. data/lib/bugsnag/api/client/comments.rb +1 -1
  22. data/lib/bugsnag/api/client/currentuser.rb +0 -1
  23. data/lib/bugsnag/api/client/errors.rb +12 -11
  24. data/lib/bugsnag/api/client/eventfields.rb +1 -2
  25. data/lib/bugsnag/api/client/events.rb +1 -2
  26. data/lib/bugsnag/api/client/organizations.rb +1 -2
  27. data/lib/bugsnag/api/client/pivots.rb +1 -2
  28. data/lib/bugsnag/api/client/projects.rb +2 -3
  29. data/lib/bugsnag/api/client/releases.rb +38 -0
  30. data/lib/bugsnag/api/client/stability.rb +16 -0
  31. data/lib/bugsnag/api/client/trends.rb +8 -5
  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 +14 -5
  88. metadata +66 -37
  89. data/.travis.yml +0 -20
data/CHANGELOG.md CHANGED
@@ -1,6 +1,40 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 2.1.0 (28 July 2021)
5
+
6
+ ### Enhancements
7
+
8
+ * Add stability and release endpoints
9
+ | [#34](https://github.com/bugsnag/bugsnag-api-ruby/pull/34)
10
+
11
+ ## 2.0.3 (11 May 2021)
12
+
13
+ ### Fixes
14
+
15
+ * Fix error handling middleware compatibility with Faraday v1.2.0 and above
16
+ | [askreet](https://github.com/askreet)
17
+ | [#30](https://github.com/bugsnag/bugsnag-api-ruby/pull/30)
18
+
19
+ * Remove call to deprecated `URI.escape`
20
+ | [askreet](https://github.com/askreet)
21
+ | [#28](https://github.com/bugsnag/bugsnag-api-ruby/pull/28)
22
+
23
+ ## 2.0.2 (21 Feb 2018)
24
+
25
+ ### Fixes
26
+
27
+ * Fixes issue with custom query parameters being overridden
28
+ | [#13](https://github.com/bugsnag/bugsnag-api-ruby/pull/13)
29
+
30
+ ## 2.0.1 (15 Nov 2017)
31
+
32
+ ### Fixes
33
+
34
+ * Adds `X-Bugsnag-Api` header so that on-prem clients may use this tool
35
+ | [tremlab](https://github.com/tremlab)
36
+ | [#14](https://github.com/bugsnag/bugsnag-api-ruby/pull/14)
37
+
4
38
  ## 2.0.0 (10 Oct 2017)
5
39
 
6
40
  This release changes the gem to access v2 of the [Bugsnag data-access API](https://docs.bugsnag.com/api/data-access/), with full API documentation found [here](http://docs.bugsnagapiv2.apiary.io/).
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
data/bugsnag-api.gemspec CHANGED
@@ -18,14 +18,49 @@ 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
- spec.add_dependency "sawyer", '~> 0.8.1'
21
+ if RUBY_VERSION < "2.2.0"
22
+ spec.add_dependency "sawyer", '0.8.1'
23
+
24
+ spec.add_development_dependency "rake", "< 12.0.0"
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
22
63
 
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
64
  spec.add_development_dependency "rspec", "~> 3.0"
26
- spec.add_development_dependency "webmock", RUBY_VERSION <= '2.0.0' ? '2.3.2': '>2.3.2'
27
- spec.add_development_dependency "addressable", RUBY_VERSION <= '2.0.0' ? '2.3.6': '>2.3.6'
28
- spec.add_development_dependency "faker", RUBY_VERSION <= '2.0.0' ? '1.3.0' : '>1.7.3'
29
65
  spec.add_development_dependency "vcr", "~> 2.9"
30
- spec.add_development_dependency "json"
31
66
  end
data/config/.gitignore ADDED
@@ -0,0 +1 @@
1
+ global.yml
@@ -0,0 +1,9 @@
1
+ version: '3.6'
2
+ services:
3
+
4
+ license_finder:
5
+ build:
6
+ dockerfile: dockerfiles/Dockerfile.audit
7
+ context: .
8
+ volumes:
9
+ - ./:/scan
@@ -0,0 +1,5 @@
1
+ FROM licensefinder/license_finder
2
+
3
+ WORKDIR /scan
4
+
5
+ CMD /scan/scripts/license_finder.sh
@@ -10,6 +10,8 @@ require "bugsnag/api/client/events"
10
10
  require "bugsnag/api/client/pivots"
11
11
  require "bugsnag/api/client/trends"
12
12
  require "bugsnag/api/client/comments"
13
+ require "bugsnag/api/client/stability"
14
+ require "bugsnag/api/client/releases"
13
15
 
14
16
  module Bugsnag
15
17
  module Api
@@ -28,6 +30,8 @@ module Bugsnag
28
30
  include Bugsnag::Api::Client::Pivots
29
31
  include Bugsnag::Api::Client::Trends
30
32
  include Bugsnag::Api::Client::Comments
33
+ include Bugsnag::Api::Client::Stability
34
+ include Bugsnag::Api::Client::Releases
31
35
 
32
36
  # Header keys that can be passed in options hash to {#get},{#head}
33
37
  CONVENIENCE_HEADERS = Set.new([:accept, :content_type])
@@ -143,12 +147,25 @@ module Bugsnag
143
147
  !!configuration.auth_token
144
148
  end
145
149
 
150
+ # Merges hashes together cleanly, favouring RHS values
151
+ #
152
+ # @return [Hash]
153
+ def deep_merge(l_hash, r_hash)
154
+ l_hash.merge(r_hash) do |_key, l_val, r_val|
155
+ if l_val.is_a?(Hash) && r_val.is_a?(Hash)
156
+ deep_merge(l_val, r_val)
157
+ else
158
+ r_val
159
+ end
160
+ end
161
+ end
146
162
 
147
163
  private
148
164
  def agent
149
165
  @agent ||= Sawyer::Agent.new(configuration.endpoint, sawyer_options) do |http|
150
166
  http.headers[:content_type] = "application/json"
151
167
  http.headers[:'X-Version'] = "2"
168
+ http.headers[:'X-Bugsnag-Api'] = "true"
152
169
  http.headers[:user_agent] = configuration.user_agent
153
170
 
154
171
  if basic_authenticated?
@@ -172,7 +189,7 @@ module Bugsnag
172
189
  end
173
190
  end
174
191
 
175
- @last_response = response = agent.call(method, URI.escape(path.to_s), data, options)
192
+ @last_response = response = agent.call(method, path.to_s, data, options)
176
193
  response.data
177
194
  end
178
195
 
@@ -19,7 +19,7 @@ module Bugsnag
19
19
  # @argument project_id [String] ID of project to get collaborators from (conflicts with org_id)
20
20
  # @argument org_id [String] ID of organization to get collaborators from (conflicts with project_id)
21
21
  #
22
- # @option per_page [Number] Amount of results per-page
22
+ # @option per_page [Number] Amount of results per-page
23
23
  # @return [Array<Sawyer::Resource>] List of Collaborators
24
24
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/collaborators/list-collaborators
25
25
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/collaborators/list-collaborators-on-a-project
@@ -84,4 +84,3 @@ module Bugsnag
84
84
  end
85
85
  end
86
86
  end
87
-
@@ -44,7 +44,7 @@ module Bugsnag
44
44
 
45
45
  # Delete a Comment
46
46
  #
47
- # @return
47
+ # @return
48
48
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/comments/delete-a-comment
49
49
  def delete_comment(id, options = {})
50
50
  boolean_from_response :delete, "comments/#{id}", options
@@ -30,4 +30,3 @@ module Bugsnag
30
30
  end
31
31
  end
32
32
  end
33
-
@@ -8,6 +8,8 @@ module Bugsnag
8
8
  module Errors
9
9
  # List the Errors on a Project
10
10
  #
11
+ # @argument id [String] optional ID of error to retrieve
12
+ #
11
13
  # @option base [String] Only Error Events occuring before this time will be returned
12
14
  # @option sort [String] Which field to sort by, one of: last_seen, first_seen, users, events, unsorted
13
15
  # @option direction [String] Which direction to sort the result by, one of: asc, desc
@@ -15,16 +17,14 @@ module Bugsnag
15
17
  # @return [Array<Sawyer::Resource>] List of Project Errors
16
18
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/errors/list-the-errors-on-a-project
17
19
  def errors(project_id, id=nil, options = {})
18
- paginate "projects/#{project_id}/errors", options
20
+ if id.nil?
21
+ paginate "projects/#{project_id}/errors", options
22
+ else
23
+ get "projects/#{project_id}/errors/#{id}", options
24
+ end
19
25
  end
20
26
 
21
- # View an Error
22
- #
23
- # @return [Sawyer::Resource] Requested Error
24
- # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/errors/view-an-error
25
- def error(project_id, id, options = {})
26
- get "projects/#{project_id}/errors/#{id}", options
27
- end
27
+ alias error errors
28
28
 
29
29
  # Update an Error
30
30
  #
@@ -42,7 +42,9 @@ module Bugsnag
42
42
  when String
43
43
  patch "projects/#{project_id}/errors/#{ids}", options.merge({:operation => operation})
44
44
  when Array
45
- patch "projects/#{project_id}/errors", options.merge({:operation => operation, :query => {:error_ids => ids.join(' ')}})
45
+ defaults = {:operation => operation, :query => {:error_ids => ids.join(' ')}}
46
+ merged_opts = deep_merge(defaults, options)
47
+ patch "projects/#{project_id}/errors", merged_opts
46
48
  else
47
49
  raise ArgumentError, "ids must be a String or an Array"
48
50
  end
@@ -53,7 +55,7 @@ module Bugsnag
53
55
  # @argument error_id [String] ID of error to delete (conflicts with project_id)
54
56
  # @argument project_id [String] Id of project to delete all errors from (conflicts with error_id)
55
57
  #
56
- # @return
58
+ # @return
57
59
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/errors/delete-an-error
58
60
  def delete_errors(project_id, error_id=nil, options = {})
59
61
  if !error_id.nil?
@@ -66,4 +68,3 @@ module Bugsnag
66
68
  end
67
69
  end
68
70
  end
69
-
@@ -38,7 +38,7 @@ module Bugsnag
38
38
 
39
39
  # Delete a custom Event Field
40
40
  #
41
- # @return
41
+ # @return
42
42
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/event-fields/delete-a-custom-event-field
43
43
  def delete_event_field(project_id, display_id, options = {})
44
44
  boolean_from_resposne :delete, "project/#{project_id}/event_fields/#{display_id}", options
@@ -47,4 +47,3 @@ module Bugsnag
47
47
  end
48
48
  end
49
49
  end
50
-
@@ -16,7 +16,7 @@ module Bugsnag
16
16
 
17
17
  # Delete an Event
18
18
  #
19
- # @return
19
+ # @return
20
20
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/delete-an-event
21
21
  def delete_event(project_id, id, options = {})
22
22
  boolean_from_response :delete, "projects/#{project_id}/events/#{id}", options
@@ -57,4 +57,3 @@ module Bugsnag
57
57
  end
58
58
  end
59
59
  end
60
-
@@ -34,7 +34,7 @@ module Bugsnag
34
34
 
35
35
  # Delete an Organization
36
36
  #
37
- # @return
37
+ # @return
38
38
  # @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/organizations/delete-an-organization
39
39
  def delete_organization(id, options = {})
40
40
  boolean_from_response :delete, "organizations/#{id}", options
@@ -43,4 +43,3 @@ module Bugsnag
43
43
  end
44
44
  end
45
45
  end
46
-