bugsnag-api 1.0.2 → 2.0.3
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.
- checksums.yaml +5 -5
- data/.buildkite/pipeline.yml +6 -0
- data/.github/ISSUE_TEMPLATE/A.md +14 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- data/.github/support.md +19 -0
- data/.github/workflows/tests.yml +53 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +271 -0
- data/CHANGELOG.md +59 -0
- data/CONTRIBUTING.md +40 -0
- data/Gemfile +9 -0
- data/README.md +178 -109
- data/bugsnag-api.gemspec +42 -6
- data/config/.gitignore +1 -0
- data/docker-compose.yml +9 -0
- data/dockerfiles/Dockerfile.audit +5 -0
- data/lib/bugsnag/api/client.rb +32 -10
- data/lib/bugsnag/api/client/collaborators.rb +86 -0
- data/lib/bugsnag/api/client/comments.rb +31 -40
- data/lib/bugsnag/api/client/currentuser.rb +32 -0
- data/lib/bugsnag/api/client/errors.rb +48 -53
- data/lib/bugsnag/api/client/eventfields.rb +49 -0
- data/lib/bugsnag/api/client/events.rb +37 -32
- data/lib/bugsnag/api/client/organizations.rb +45 -0
- data/lib/bugsnag/api/client/pivots.rb +42 -0
- data/lib/bugsnag/api/client/projects.rb +36 -63
- data/lib/bugsnag/api/client/trends.rb +41 -0
- data/lib/bugsnag/api/configuration.rb +1 -1
- data/lib/bugsnag/api/error.rb +5 -1
- data/lib/bugsnag/api/response/raise_error.rb +0 -2
- data/lib/bugsnag/api/version.rb +1 -1
- data/scripts/license_finder.sh +4 -0
- data/spec/bugsnag/api/client/collaborators_spec.rb +101 -0
- data/spec/bugsnag/api/client/comments_spec.rb +42 -30
- data/spec/bugsnag/api/client/currentuser_spec.rb +57 -0
- data/spec/bugsnag/api/client/errors_spec.rb +44 -41
- data/spec/bugsnag/api/client/eventfields_spec.rb +56 -0
- data/spec/bugsnag/api/client/events_spec.rb +41 -29
- data/spec/bugsnag/api/client/organizations_spec.rb +53 -0
- data/spec/bugsnag/api/client/pivots_spec.rb +49 -0
- data/spec/bugsnag/api/client/projects_spec.rb +35 -59
- data/spec/bugsnag/api/client/trends_spec.rb +44 -0
- data/spec/bugsnag/api/client_spec.rb +76 -9
- data/spec/bugsnag/api_spec.rb +2 -0
- data/spec/cassettes/Bugsnag_Api_Client/_get/handles_query_params.yml +36 -26
- data/spec/cassettes/Bugsnag_Api_Client/_last_response/caches_the_last_agent_response.yml +36 -26
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/_invitecollaborator/creates_and_returns_a_collaborator.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/_invitecollaborator/invites_multiple_collaborators.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborator/returns_a_collaborator.yml +133 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborators/returns_a_list_of_all_organization_collaborators.yml +135 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_collaborators/returns_a_list_of_all_project_collaborators.yml +135 -0
- 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 +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_delete_collaborator/deletes_a_collaborator.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_update_collaborator_permissions/updates_and_returns_the_collaborator.yml +133 -0
- data/spec/cassettes/Bugsnag_Api_Client_Collaborators/given_a_collaborator_exists/_view_collaborator_projects/returns_a_list_of_projects_belonging_to_the_collaborator.yml +153 -0
- data/spec/cassettes/Bugsnag_Api_Client_Comments/_create_comment/creates_a_comment_on_the_error.yml +70 -0
- data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_comment/retrieves_the_comment_specified.yml +135 -0
- data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_comments/retrieves_all_comments_on_an_error.yml +137 -0
- data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_delete_comment/deletes_the_comment_and_returns_true.yml +70 -0
- data/spec/cassettes/Bugsnag_Api_Client_Comments/given_a_comment_has_been_created/_update_comment/updates_the_message_on_a_comment.yml +135 -0
- data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_organizations/when_using_auth_token/returns_the_organization_the_auth_token_belongs_to.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_organizations/when_using_user_credentials/returns_users_organizations.yml +71 -0
- data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_projects/when_using_auth_token/lists_current_user_s_projects_in_the_organization.yml +88 -0
- data/spec/cassettes/Bugsnag_Api_Client_CurrentUser/_list_projects/when_using_user_credentials/lists_current_user_s_projects_in_the_organization.yml +91 -0
- data/spec/cassettes/Bugsnag_Api_Client_Errors/_error/returns_a_single_error.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Errors/_errors/returns_errors_on_the_project.yml +70 -0
- data/spec/cassettes/Bugsnag_Api_Client_Errors/_update_errors/updates_and_returns_the_updated_errors.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Events/_error_events/lists_all_error_events.yml +73 -0
- data/spec/cassettes/Bugsnag_Api_Client_Events/_event/returns_the_specified_event.yml +70 -0
- data/spec/cassettes/Bugsnag_Api_Client_Events/_events/returns_the_a_list_of_project_errors.yml +73 -0
- data/spec/cassettes/Bugsnag_Api_Client_Events/_latest_event/returns_the_last_event_on_an_error.yml +70 -0
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/_create_organization/creates_a_new_organization.yml +71 -0
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_delete_organization/deletes_the_organization.yml +133 -0
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_organization/returns_the_requested_organization.yml +139 -0
- data/spec/cassettes/Bugsnag_Api_Client_Organizations/with_organization/_update_organization/updates_and_returns_the_organization.yml +139 -0
- data/spec/cassettes/Bugsnag_Api_Client_Projects/_create_project/creates_a_new_project.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_delete_project/deletes_the_project.yml +127 -0
- data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_project/returns_the_requested_project.yml +133 -0
- 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 +133 -0
- data/spec/cassettes/Bugsnag_Api_Client_Projects/given_a_project/_update_project/updates_and_returns_the_project.yml +133 -0
- data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_buckets/returns_a_list_of_error_trends_in_bucket_form.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_buckets/returns_a_list_of_project_trends_in_bucket_form.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_resolution/returns_a_list_of_project_trends_in_resolution_form.yml +68 -0
- data/spec/cassettes/Bugsnag_Api_Client_Trends/_trends_resolution/returns_a_list_of_trends_in_resolution_form.yml +68 -0
- data/spec/spec_helper.rb +32 -30
- metadata +167 -115
- data/.travis.yml +0 -9
- data/lib/bugsnag/api/client/accounts.rb +0 -44
- data/lib/bugsnag/api/client/users.rb +0 -99
- data/spec/bugsnag/api/client/accounts_spec.rb +0 -45
- data/spec/bugsnag/api/client/users_spec.rb +0 -105
- data/spec/cassettes/Bugsnag_Api_Client_Accounts/_account/returns_the_requested_account.yml +0 -49
- data/spec/cassettes/Bugsnag_Api_Client_Accounts/_account/when_using_account_credentials/returns_the_account.yml +0 -51
- data/spec/cassettes/Bugsnag_Api_Client_Accounts/_accounts/returns_all_accounts.yml +0 -49
- data/spec/cassettes/Bugsnag_Api_Client_Comments/_comments/returns_all_comments_on_an_error.yml +0 -107
- data/spec/cassettes/Bugsnag_Api_Client_Comments/_create_comment/created_a_comment.yml +0 -51
- data/spec/cassettes/Bugsnag_Api_Client_Comments/with_comment/_comment/returns_a_comment.yml +0 -97
- data/spec/cassettes/Bugsnag_Api_Client_Comments/with_comment/_delete_comment/deletes_an_existing_comment.yml +0 -92
- data/spec/cassettes/Bugsnag_Api_Client_Comments/with_comment/_update_comment/updates_an_existing_comment.yml +0 -97
- data/spec/cassettes/Bugsnag_Api_Client_Errors/_errors/returns_all_errors_on_an_project.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Errors/with_error/_error/returns_an_error.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Errors/with_error/_reopen_error/reopens_the_error.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Errors/with_error/_resolve_error/resolves_the_error.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Errors/with_error/_update_error/updates_the_error.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Events/_error_events/returns_all_events_on_an_error.yml +0 -64
- data/spec/cassettes/Bugsnag_Api_Client_Events/_project_events/returns_all_events_on_a_project.yml +0 -64
- data/spec/cassettes/Bugsnag_Api_Client_Events/with_event/_event/returns_an_event.yml +0 -56
- data/spec/cassettes/Bugsnag_Api_Client_Projects/_account_projects/returns_all_projects_on_an_account.yml +0 -61
- data/spec/cassettes/Bugsnag_Api_Client_Projects/_account_projects/when_using_account_credentials/returns_all_projects.yml +0 -63
- data/spec/cassettes/Bugsnag_Api_Client_Projects/_create_project/creates_a_project_on_an_account.yml +0 -50
- data/spec/cassettes/Bugsnag_Api_Client_Projects/_user_projects/returns_all_projects_for_a_user.yml +0 -61
- data/spec/cassettes/Bugsnag_Api_Client_Projects/with_project/_delete_project/deletes_an_existing_project.yml +0 -91
- data/spec/cassettes/Bugsnag_Api_Client_Projects/with_project/_project/returns_a_project.yml +0 -95
- data/spec/cassettes/Bugsnag_Api_Client_Projects/with_project/_update_project/updates_an_existing_project.yml +0 -95
- data/spec/cassettes/Bugsnag_Api_Client_Users/_account_users/returns_all_users_on_an_account.yml +0 -49
- data/spec/cassettes/Bugsnag_Api_Client_Users/_account_users/when_using_account_credentials/returns_all_users.yml +0 -51
- data/spec/cassettes/Bugsnag_Api_Client_Users/_invite_user/invites_a_user_to_an_account.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Users/_project_users/returns_all_users_for_a_project.yml +0 -49
- data/spec/cassettes/Bugsnag_Api_Client_Users/_user/returns_a_user.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Users/_user/when_using_user_credentials/returns_the_authed_user.yml +0 -48
- data/spec/cassettes/Bugsnag_Api_Client_Users/with_user/_remove_user/removes_a_user_from_an_account.yml +0 -89
- data/spec/cassettes/Bugsnag_Api_Client_Users/with_user/_update_user_permissions/updates_a_users_permissions.yml +0 -93
@@ -0,0 +1,49 @@
|
|
1
|
+
module Bugsnag
|
2
|
+
module Api
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Methods for the Project Event Fields API
|
6
|
+
#
|
7
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/event-fields
|
8
|
+
module EventFields
|
9
|
+
# List the Event Fields for a Project
|
10
|
+
#
|
11
|
+
# @option per_page []Number] Number of results required per page
|
12
|
+
# @return [Array<Sawyer::Resource>] List of event fields
|
13
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/event-fields/list-the-event-fields-for-a-project
|
14
|
+
def event_fields(project_id, options = {})
|
15
|
+
paginate "projects/#{project_id}/event_fields", options
|
16
|
+
end
|
17
|
+
|
18
|
+
# Create a custom Event Field
|
19
|
+
#
|
20
|
+
# @option reindex [Boolean] Whether to reindex historical events
|
21
|
+
# @option pivot_options [Object] Configuration for how this field will appear in pivots
|
22
|
+
# @return [Sawyer::Resource] New Event Field
|
23
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/event-fields/create-a-custom-event-field
|
24
|
+
def create_event_field(project_id, display_id, path, filter_options, options = {})
|
25
|
+
post "projects/#{project_id}/event_fields", options.merge({:display_id => display_id, :path => path, :filter_options => filter_options})
|
26
|
+
end
|
27
|
+
|
28
|
+
# Update a custom Event Field
|
29
|
+
#
|
30
|
+
# @option reindex [Boolean] Whether to reindex historical events
|
31
|
+
# @option filter_options [Object] Configuration for how the field will appear in the Filter Bar
|
32
|
+
# @option pivot_options [Object] Configuration for how this field will appear in pivots
|
33
|
+
# @return [Sawyer::Resource] Updated Event Field
|
34
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/event-fields/update-a-custom-event-field
|
35
|
+
def update_event_field(project_id, display_id, path, options = {})
|
36
|
+
patch "projects/#{id}/event_fields/#{display_id}", options.merge({:display_id => display_id, :path => path})
|
37
|
+
end
|
38
|
+
|
39
|
+
# Delete a custom Event Field
|
40
|
+
#
|
41
|
+
# @return
|
42
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/event-fields/delete-a-custom-event-field
|
43
|
+
def delete_event_field(project_id, display_id, options = {})
|
44
|
+
boolean_from_resposne :delete, "project/#{project_id}/event_fields/#{display_id}", options
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -4,49 +4,54 @@ module Bugsnag
|
|
4
4
|
|
5
5
|
# Methods for the Events API
|
6
6
|
#
|
7
|
-
# @see
|
7
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events
|
8
8
|
module Events
|
9
|
-
#
|
9
|
+
# View an Event
|
10
10
|
#
|
11
|
-
# @
|
12
|
-
# @
|
13
|
-
|
14
|
-
|
15
|
-
# Bugsnag::Api.events("50baed119bf39c1431000004")
|
16
|
-
def events(project, options = {})
|
17
|
-
paginate "projects/#{project}/events", options
|
11
|
+
# @return [Sawyer::Resource] Requested Event
|
12
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/view-an-event
|
13
|
+
def event(project_id, id, options = {})
|
14
|
+
get "projects/#{project_id}/events/#{id}", options
|
18
15
|
end
|
19
|
-
alias :project_events :events
|
20
16
|
|
21
|
-
#
|
17
|
+
# Delete an Event
|
22
18
|
#
|
23
|
-
# @
|
24
|
-
# @
|
25
|
-
|
26
|
-
|
27
|
-
# Bugsnag::Api.error_events("518031bcd775355c48a1cd4e")
|
28
|
-
def error_events(error, options = {})
|
29
|
-
paginate "errors/#{error}/events", options
|
19
|
+
# @return
|
20
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/delete-an-event
|
21
|
+
def delete_event(project_id, id, options = {})
|
22
|
+
boolean_from_response :delete, "projects/#{project_id}/events/#{id}", options
|
30
23
|
end
|
31
24
|
|
32
|
-
#
|
25
|
+
# List the Events on an Error
|
33
26
|
#
|
34
|
-
# @
|
35
|
-
# @
|
36
|
-
# @
|
37
|
-
# @
|
38
|
-
#
|
39
|
-
|
40
|
-
|
27
|
+
# @option base [String] Only Error Events occuring before this time will be returned
|
28
|
+
# @option sort [String] Which field to sort the results by, one of: last_seen, first_seen, users, events
|
29
|
+
# @option direction [String] Which direction to sort the results by, one of: asc, desc
|
30
|
+
# @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
|
31
|
+
# @return [Array<Sawyer::Resource>] List of Events for the specified Error
|
32
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/list-the-events-on-an-error
|
33
|
+
def error_events(project_id, error_id, options = {})
|
34
|
+
paginate "projects/#{project_id}/errors/#{error_id}/events", options
|
41
35
|
end
|
42
36
|
|
43
|
-
#
|
37
|
+
# View the latest Event on an Error
|
44
38
|
#
|
45
|
-
# @
|
46
|
-
# @
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
# @return [Sawyer::Resource] Last event reported Event
|
40
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/view-the-latest-event-on-an-error
|
41
|
+
def latest_event(error_id, options = {})
|
42
|
+
get "errors/#{error_id}/latest_event", options
|
43
|
+
end
|
44
|
+
|
45
|
+
# List the Events on a Project
|
46
|
+
#
|
47
|
+
# @option base [String] Only Project Events occuring before this time will be returned
|
48
|
+
# @option sort [String] Which field to sort the results by, one of: last_seen, first_seen, users, events
|
49
|
+
# @option direction [String] Which direction to sort the results by, one of: asc, desc
|
50
|
+
# @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
|
51
|
+
# @return [Array<Sawyer::Resource>] List of Events for the specified Project
|
52
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/list-the-events-on-a-project
|
53
|
+
def events(project_id, options = {})
|
54
|
+
get "projects/#{project_id}/events", options
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Bugsnag
|
2
|
+
module Api
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Methods for the Organizations API
|
6
|
+
#
|
7
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations
|
8
|
+
module Organizations
|
9
|
+
# Create an Organization
|
10
|
+
#
|
11
|
+
# @return [Sawyer::Resource] New Organization
|
12
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/organizations/create-an-organization
|
13
|
+
def create_organization(name, options = {})
|
14
|
+
post "organizations", options.merge({:name => name})
|
15
|
+
end
|
16
|
+
|
17
|
+
# View an Organization
|
18
|
+
#
|
19
|
+
# @return [Sawyer::Resource] Requested Organization
|
20
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/organizations/view-an-organization
|
21
|
+
def organization(id, options = {})
|
22
|
+
get "organizations/#{id}", options
|
23
|
+
end
|
24
|
+
|
25
|
+
# Update an Organization
|
26
|
+
#
|
27
|
+
# @option invoice_address [String] Additional information to print on your invoice
|
28
|
+
# @option billing_emails [Array<String>] List of billing emails
|
29
|
+
# @return [Sawyer::Resource] Updated Organization
|
30
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/organizations/update-an-organization
|
31
|
+
def update_organization(id, name, auto_upgrade, options = {})
|
32
|
+
patch "organizations/#{id}", options.merge({:name => name, :auto_upgrade => auto_upgrade})
|
33
|
+
end
|
34
|
+
|
35
|
+
# Delete an Organization
|
36
|
+
#
|
37
|
+
# @return
|
38
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/organizations/delete-an-organization
|
39
|
+
def delete_organization(id, options = {})
|
40
|
+
boolean_from_response :delete, "organizations/#{id}", options
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Bugsnag
|
2
|
+
module Api
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Methods for the Pivots API
|
6
|
+
#
|
7
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/pivots
|
8
|
+
module Pivots
|
9
|
+
# List Pivots on an Error
|
10
|
+
#
|
11
|
+
# @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
|
12
|
+
# @option summary_size [Number] The number of elements to include in the list
|
13
|
+
# @option pivots [Array] EventField display_ids to identify pivots to return
|
14
|
+
# @option per_page [Number] Number of results to be returned per page
|
15
|
+
# @return [Array<Sawyer::Resource>] List of Pivots for the Error specified
|
16
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/pivots/list-pivots-on-an-error
|
17
|
+
def pivots(project_id, error_id=nil, options = {})
|
18
|
+
if error_id.nil?
|
19
|
+
get "projects/#{project_id}/pivots", options
|
20
|
+
else
|
21
|
+
paginate "projects/#{project_id}/errors/#{error_id}/pivots", options
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# List values of a Pivot on an Error
|
26
|
+
#
|
27
|
+
# @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
|
28
|
+
# @option sort [String] Sorting method
|
29
|
+
# @option base [String] Only Events occuring before this time will be used
|
30
|
+
# @return [Array<Sawyer::Resource>] List of values for the Pivots requested
|
31
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/pivots/list-values-of-a-pivot-on-an-error
|
32
|
+
def pivot_values(project_id, ef_display_id, error_id=nil, options = {})
|
33
|
+
if error_id.nil?
|
34
|
+
paginate "projects/#{project_id}/pivots/#{ef_display_id}/values", options
|
35
|
+
else
|
36
|
+
paginate "projects/#{project_id}/errors/#{error_id}/pivots/#{ef_display_id}/values", options
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -4,83 +4,56 @@ module Bugsnag
|
|
4
4
|
|
5
5
|
# Methods for the Projects API
|
6
6
|
#
|
7
|
-
# @see
|
7
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects
|
8
8
|
module Projects
|
9
|
-
#
|
9
|
+
# Create a Project in an Organization
|
10
10
|
#
|
11
|
-
# @
|
12
|
-
# @
|
13
|
-
|
14
|
-
|
15
|
-
# Bugsnag::Api.projects("515fb9337c1074f6fd000009")
|
16
|
-
def projects(account=nil, options = {})
|
17
|
-
if account.nil? || account.is_a?(Hash)
|
18
|
-
options = account || {}
|
19
|
-
|
20
|
-
raise Bugsnag::Api::AccountCredentialsRequired.new(
|
21
|
-
"Fetching projects without an account id is only possible when "\
|
22
|
-
"using an account auth token."
|
23
|
-
) unless token_authenticated?
|
24
|
-
|
25
|
-
paginate "account/projects", options
|
26
|
-
else
|
27
|
-
paginate "accounts/#{account}/projects", options
|
28
|
-
end
|
29
|
-
end
|
30
|
-
alias :account_projects :projects
|
31
|
-
|
32
|
-
# List user projects
|
33
|
-
#
|
34
|
-
# @param account [String] Bugsnag user for which to list projects
|
35
|
-
# @return [Array<Sawyer::Resource>] List of projects
|
36
|
-
# @see https://bugsnag.com/docs/api/projects#list-a-user-s-projects
|
37
|
-
# @example
|
38
|
-
# Bugsnag::Api.user_projects("515fb9337c1074f6fd000007")
|
39
|
-
def user_projects(user, options = {})
|
40
|
-
paginate "users/#{user}/projects", options
|
11
|
+
# @return [Sawyer::Resource] New Project
|
12
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/projects/create-a-project-in-an-organization
|
13
|
+
def create_project(org_id, name, type, options = {})
|
14
|
+
post "organizations/#{org_id}/projects", options.merge({:name => name, :type => type})
|
41
15
|
end
|
42
16
|
|
43
|
-
#
|
17
|
+
# View a Project
|
44
18
|
#
|
45
|
-
# @
|
46
|
-
# @
|
47
|
-
|
48
|
-
|
49
|
-
# Bugsnag::Api.project("50baed119bf39c1431000004")
|
50
|
-
def project(project, options = {})
|
51
|
-
get "projects/#{project}", options
|
19
|
+
# @return [Sawyer::Resource] Requested Project
|
20
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/projects/view-a-project
|
21
|
+
def project(id, options = {})
|
22
|
+
get "projects/#{id}", options
|
52
23
|
end
|
53
24
|
|
54
|
-
#
|
25
|
+
# Update a Project
|
55
26
|
#
|
56
|
-
# @
|
57
|
-
# @option
|
58
|
-
# @option
|
59
|
-
# @
|
60
|
-
# @
|
61
|
-
#
|
62
|
-
|
63
|
-
|
27
|
+
# @option name [String] A name for the project
|
28
|
+
# @option global_grouping [Array<String>] A list of error classes, which will be grouped by class
|
29
|
+
# @option location_grouping [Array<String>] A list of error classes, which will be grouped by context
|
30
|
+
# @option discarded_app_versions [Array<String>] A list of app versions whose events will be ignored
|
31
|
+
# @option discarded_errors [Array<String>] A list of error classes that will be ignored
|
32
|
+
# @option url_whitelist [Array<String>] If configured only errors from whitelisted URLs will be processed
|
33
|
+
# @option ignore_old_browsers [Boolean] Set to ignore events from old web browsers
|
34
|
+
# @option ignored_browser_versions [Object] A mapping of browser name to ignored versions
|
35
|
+
# @option resolve_on_deploy [Boolean] Set all errors to resolved once a new deployment has been notified
|
36
|
+
# @option collaborator_ids [Array<String>] Update the collaborators in the project to only these ids
|
37
|
+
# @return [Sawyer::Resource] Updated Project
|
38
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/projects/update-a-project
|
39
|
+
def update_project(id, options = {})
|
40
|
+
patch "projects/#{id}", options
|
64
41
|
end
|
65
42
|
|
66
|
-
#
|
43
|
+
# Regenerate a Project's notifier API key
|
67
44
|
#
|
68
|
-
# @
|
69
|
-
# @
|
70
|
-
|
71
|
-
|
72
|
-
# Bugsnag::Api.update_project("50baed119bf39c1431000004", name: "Dashboard")
|
73
|
-
def update_project(project, options = {})
|
74
|
-
patch "projects/#{project}", options
|
45
|
+
# @return
|
46
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/projects/projects/regenerate-a-project's-notifier-api-key
|
47
|
+
def regenerate_api_key(id, options = {})
|
48
|
+
delete "projects/#{id}/api_key", options
|
75
49
|
end
|
76
50
|
|
77
|
-
# Delete a
|
51
|
+
# Delete a Project
|
78
52
|
#
|
79
|
-
# @
|
80
|
-
# @
|
81
|
-
|
82
|
-
|
83
|
-
boolean_from_response :delete, "projects/#{project}", options
|
53
|
+
# @return
|
54
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/organizations/organizations/delete-an-organization
|
55
|
+
def delete_project(id, options = {})
|
56
|
+
boolean_from_response :delete, "projects/#{id}", options
|
84
57
|
end
|
85
58
|
end
|
86
59
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Bugsnag
|
2
|
+
module Api
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Methods for the Pivots API
|
6
|
+
#
|
7
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/trends
|
8
|
+
module Trends
|
9
|
+
# List Trends for an Error in bucket form
|
10
|
+
#
|
11
|
+
# @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
|
12
|
+
# @return [Array<Sawyer::Resource>] List of Trends as requested
|
13
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/trends/list-the-trends-for-an-error-(buckets)
|
14
|
+
def trends_buckets(project_id, buckets_count, error_id=nil, options = {})
|
15
|
+
defaults = {:query => {:buckets_count => buckets_count}}
|
16
|
+
merged_opts = deep_merge(defaults, options)
|
17
|
+
if !error_id.nil?
|
18
|
+
get "projects/#{project_id}/errors/#{error_id}/trend", merged_opts
|
19
|
+
else
|
20
|
+
get "projects/#{project_id}/trend", merged_opts
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# List Trends for an Error in resolution form
|
25
|
+
#
|
26
|
+
# @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
|
27
|
+
# @return [Array<Sawyer::Resource>] List of Trends as requested
|
28
|
+
# @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/trends/list-the-trends-for-an-error-(buckets)
|
29
|
+
def trends_resolution(project_id, resolution, error_id=nil, options = {})
|
30
|
+
defaults = {:query => {:resolution => resolution}}
|
31
|
+
merged_opts = deep_merge(defaults, options)
|
32
|
+
if !error_id.nil?
|
33
|
+
get "projects/#{project_id}/errors/#{error_id}/trend", merged_opts
|
34
|
+
else
|
35
|
+
get "projects/#{project_id}/trend", merged_opts
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -45,7 +45,7 @@ module Bugsnag
|
|
45
45
|
|
46
46
|
# Load configuration from hash
|
47
47
|
def load(options = {})
|
48
|
-
options.each {|k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") && !v.nil?}
|
48
|
+
options.each { |k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") && !v.nil?}
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/lib/bugsnag/api/error.rb
CHANGED
@@ -3,7 +3,7 @@ module Bugsnag
|
|
3
3
|
# Custom error class for rescuing from all Bugsnag API errors
|
4
4
|
class Error < StandardError
|
5
5
|
|
6
|
-
# Returns the appropriate
|
6
|
+
# Returns the appropriate Bugsnag::Api::Error subclass based
|
7
7
|
# on status and response message
|
8
8
|
#
|
9
9
|
# @param [Hash] response HTTP response
|
@@ -23,6 +23,7 @@ module Bugsnag
|
|
23
23
|
when 409 then Bugsnag::Api::Conflict
|
24
24
|
when 415 then Bugsnag::Api::UnsupportedMediaType
|
25
25
|
when 422 then Bugsnag::Api::UnprocessableEntity
|
26
|
+
when 429 then Bugsnag::Api::RateLimitExceeded
|
26
27
|
when 400..499 then Bugsnag::Api::ClientError
|
27
28
|
when 500 then Bugsnag::Api::InternalServerError
|
28
29
|
when 501 then Bugsnag::Api::NotImplemented
|
@@ -102,6 +103,9 @@ module Bugsnag
|
|
102
103
|
# Raised when Bugsnag returns a 422 HTTP status code
|
103
104
|
class UnprocessableEntity < ClientError; end
|
104
105
|
|
106
|
+
# Raised when the api limit has been exceeded
|
107
|
+
class RateLimitExceeded < ClientError; end
|
108
|
+
|
105
109
|
# Raised on errors in the 500-599 range
|
106
110
|
class ServerError < Error; end
|
107
111
|
|
@@ -9,8 +9,6 @@ module Bugsnag
|
|
9
9
|
# This class raises an Bugsnag-flavored exception based
|
10
10
|
# HTTP status codes returned by the API
|
11
11
|
class RaiseError < Faraday::Response::Middleware
|
12
|
-
|
13
|
-
private
|
14
12
|
def on_complete(response)
|
15
13
|
if error = Bugsnag::Api::Error.from_response(response)
|
16
14
|
raise error
|
data/lib/bugsnag/api/version.rb
CHANGED