bugsnag-api 1.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/.travis.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
module Bugsnag
|
2
|
-
module Api
|
3
|
-
class Client
|
4
|
-
|
5
|
-
# Methods for the Accounts API
|
6
|
-
#
|
7
|
-
# @see https://bugsnag.com/docs/api/accounts
|
8
|
-
module Accounts
|
9
|
-
# List your accounts
|
10
|
-
#
|
11
|
-
# @return [Array<Sawyer::Resource>] List of users
|
12
|
-
# @see https://bugsnag.com/docs/api/accounts#list-your-accounts
|
13
|
-
# @example
|
14
|
-
# Bugsnag::Api.accounts
|
15
|
-
def accounts(options = {})
|
16
|
-
paginate "accounts", options
|
17
|
-
end
|
18
|
-
|
19
|
-
# Get a single account
|
20
|
-
#
|
21
|
-
# @param account [String] Bugsnag account id
|
22
|
-
# @return [Sawyer::Resource]
|
23
|
-
# @see https://bugsnag.com/docs/api/accounts#get-the-authenticated-account
|
24
|
-
# @see https://bugsnag.com/docs/api/accounts#get-account-details
|
25
|
-
# @example
|
26
|
-
# Bugsnag::Api.account("515fb9337c1074f6fd000009")
|
27
|
-
def account(account=nil, options = {})
|
28
|
-
if account.nil? || account.is_a?(Hash)
|
29
|
-
options = account || {}
|
30
|
-
|
31
|
-
raise Bugsnag::Api::AccountCredentialsRequired.new(
|
32
|
-
"Fetching account without an id is only possible when using "\
|
33
|
-
"an account auth token."
|
34
|
-
) unless token_authenticated?
|
35
|
-
|
36
|
-
get "account", options
|
37
|
-
else
|
38
|
-
get "accounts/#{account}", options
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
module Bugsnag
|
2
|
-
module Api
|
3
|
-
class Client
|
4
|
-
|
5
|
-
# Methods for the Users API
|
6
|
-
#
|
7
|
-
# @see https://bugsnag.com/docs/api/users
|
8
|
-
module Users
|
9
|
-
# List account users
|
10
|
-
#
|
11
|
-
# @param account [String] Bugsnag account for which to list users
|
12
|
-
# @return [Array<Sawyer::Resource>] List of users
|
13
|
-
# @see https://bugsnag.com/docs/api/users#list-an-account-s-users
|
14
|
-
def users(account=nil, options = {})
|
15
|
-
if account.nil? || account.is_a?(Hash)
|
16
|
-
options = account || {}
|
17
|
-
|
18
|
-
raise Bugsnag::Api::AccountCredentialsRequired.new(
|
19
|
-
"Fetching users without an account id is only possible when "\
|
20
|
-
"using an account auth token."
|
21
|
-
) unless token_authenticated?
|
22
|
-
|
23
|
-
paginate "account/users", options
|
24
|
-
else
|
25
|
-
paginate "accounts/#{account}/users", options
|
26
|
-
end
|
27
|
-
end
|
28
|
-
alias :account_users :users
|
29
|
-
|
30
|
-
# List project users
|
31
|
-
#
|
32
|
-
# @param account [String] Bugsnag account for which to list users
|
33
|
-
# @return [Array<Sawyer::Resource>] List of users
|
34
|
-
# @see https://bugsnag.com/docs/api/users#list-an-project-s-users
|
35
|
-
def project_users(project, options = {})
|
36
|
-
paginate "projects/#{project}/users", options
|
37
|
-
end
|
38
|
-
|
39
|
-
# Get a single user
|
40
|
-
#
|
41
|
-
# @param user [String] Bugsnag user id.
|
42
|
-
# @return [Sawyer::Resource]
|
43
|
-
# @see https://bugsnag.com/docs/api/users#get-the-authenticated-user
|
44
|
-
# @see https://bugsnag.com/docs/api/users#get-user-details
|
45
|
-
# @example
|
46
|
-
# Bugsnag::Api.user("515fb9337c1074f6fd000007")
|
47
|
-
def user(user=nil, options = {})
|
48
|
-
if user.nil? || user.is_a?(Hash)
|
49
|
-
options = user || {}
|
50
|
-
|
51
|
-
raise Bugsnag::Api::UserCredentialsRequired.new(
|
52
|
-
"Fetching user without an id is only possible when using "\
|
53
|
-
"user auth credentials."
|
54
|
-
) unless basic_authenticated?
|
55
|
-
|
56
|
-
get "user", options
|
57
|
-
else
|
58
|
-
get "users/#{user}", options
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# Invite a user to an account
|
63
|
-
#
|
64
|
-
# @param account [String] Bugsnag account to invite user to.
|
65
|
-
# @option email [String] The email address of the invitee
|
66
|
-
# @option admin [Boolean] Should the invitee be an account admin?
|
67
|
-
# @option project_ids [Array<String>] Array of accessible project ids
|
68
|
-
# @see https://bugsnag.com/docs/api/users#invite-a-user-to-an-account
|
69
|
-
# @example
|
70
|
-
# Bugsnag::Api.invite_user("515fb9337c1074f6fd000009", "james@example.com")
|
71
|
-
def invite_user(account, email, options = {})
|
72
|
-
post "accounts/#{account}/users", options.merge({:email => email})
|
73
|
-
end
|
74
|
-
|
75
|
-
# Update a user's account permissions
|
76
|
-
#
|
77
|
-
# @param account [String] Bugsnag account to update pemissions for
|
78
|
-
# @param user {String} Bugsnag user to update permissions for
|
79
|
-
# @see https://bugsnag.com/docs/api/users#update-a-user-s-account-permissions
|
80
|
-
# @example
|
81
|
-
# Bugsnag::Api.update_user_permissions("515fb9337c1074f6fd000009", "515fb9337c1074f6fd000007", admin: false)
|
82
|
-
def update_user_permissions(account, user, options = {})
|
83
|
-
patch "accounts/#{account}/users/#{user}", options
|
84
|
-
end
|
85
|
-
|
86
|
-
# Remove a user from an account
|
87
|
-
#
|
88
|
-
# @param account [String] Bugsnag account to remove user from
|
89
|
-
# @param user [String] Bugsnag user to remove
|
90
|
-
# @see https://bugsnag.com/docs/api/users#delete-a-user-from-an-account
|
91
|
-
# @example
|
92
|
-
# Bugsnag::Api.remove_user("515fb9337c1074f6fd000009", "515fb9337c1074f6fd000007")
|
93
|
-
def remove_user(account, user, options = {})
|
94
|
-
boolean_from_response :delete, "accounts/#{account}/users/#{user}", options
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Bugsnag::Api::Client::Accounts do
|
4
|
-
before do
|
5
|
-
Bugsnag::Api.reset!
|
6
|
-
@client = basic_auth_client
|
7
|
-
end
|
8
|
-
|
9
|
-
describe ".accounts", :vcr do
|
10
|
-
it "returns all accounts" do
|
11
|
-
accounts = @client.accounts
|
12
|
-
expect(accounts).to be_kind_of(Array)
|
13
|
-
expect(accounts.first.name).not_to be_nil
|
14
|
-
|
15
|
-
assert_requested :get, basic_bugsnag_url("/accounts")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".account", :vcr do
|
20
|
-
context "when using account credentials" do
|
21
|
-
it "returns the account" do
|
22
|
-
client = auth_token_client
|
23
|
-
account = client.account
|
24
|
-
expect(account.name).not_to be_nil
|
25
|
-
|
26
|
-
assert_requested :get, bugsnag_url("/account")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when using user credentials" do
|
31
|
-
it "raises an error" do
|
32
|
-
expect { @client.account }.to raise_error Bugsnag::Api::AccountCredentialsRequired
|
33
|
-
|
34
|
-
assert_not_requested :get, basic_bugsnag_url("/account")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns the requested account" do
|
39
|
-
account = @client.account(test_bugsnag_account)
|
40
|
-
expect(account.id).to eq(test_bugsnag_account)
|
41
|
-
|
42
|
-
assert_requested :get, basic_bugsnag_url("/accounts/#{test_bugsnag_account}")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Bugsnag::Api::Client::Users do
|
4
|
-
before do
|
5
|
-
Bugsnag::Api.reset!
|
6
|
-
@client = basic_auth_client
|
7
|
-
end
|
8
|
-
|
9
|
-
describe ".account_users", :vcr do
|
10
|
-
context "when using account credentials" do
|
11
|
-
it "returns all users" do
|
12
|
-
users = auth_token_client.account_users
|
13
|
-
expect(users).to be_kind_of(Array)
|
14
|
-
expect(users.first.email).not_to be_nil
|
15
|
-
|
16
|
-
assert_requested :get, bugsnag_url("/account/users")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "when using user credentials" do
|
21
|
-
it "raises an error" do
|
22
|
-
expect { @client.account_users }.to raise_error Bugsnag::Api::AccountCredentialsRequired
|
23
|
-
|
24
|
-
assert_not_requested :get, basic_bugsnag_url("/account/users")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it "returns all users on an account" do
|
29
|
-
users = @client.account_users(test_bugsnag_account)
|
30
|
-
expect(users).to be_kind_of(Array)
|
31
|
-
expect(users.first.email).not_to be_nil
|
32
|
-
|
33
|
-
assert_requested :get, basic_bugsnag_url("/accounts/#{test_bugsnag_account}/users")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe ".project_users", :vcr do
|
38
|
-
it "returns all users for a project" do
|
39
|
-
users = @client.project_users(test_bugsnag_project)
|
40
|
-
expect(users).to be_kind_of(Array)
|
41
|
-
expect(users.first.email).not_to be_nil
|
42
|
-
|
43
|
-
assert_requested :get, basic_bugsnag_url("/projects/#{test_bugsnag_project}/users")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe ".invite_user", :vcr do
|
48
|
-
it "invites a user to an account", :beta do
|
49
|
-
user = @client.invite_user(test_bugsnag_account, "example@example.com")
|
50
|
-
expect(user.email).to eq("example@example.com")
|
51
|
-
|
52
|
-
assert_requested :post, basic_bugsnag_url("/accounts/#{test_bugsnag_account}/users")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe ".user", :vcr do
|
57
|
-
context "when using user credentials" do
|
58
|
-
it "returns the authed user" do
|
59
|
-
user = @client.user
|
60
|
-
expect(user.email).not_to be_nil
|
61
|
-
|
62
|
-
assert_requested :get, basic_bugsnag_url("/user")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context "when using account credentials" do
|
67
|
-
it "raises an error" do
|
68
|
-
expect { auth_token_client.user }.to raise_error Bugsnag::Api::UserCredentialsRequired
|
69
|
-
|
70
|
-
assert_not_requested :get, bugsnag_url("/user")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe ".user", :vcr do
|
76
|
-
it "returns a user" do
|
77
|
-
user = @client.user(test_bugsnag_user)
|
78
|
-
expect(user.id).to eq(test_bugsnag_user)
|
79
|
-
|
80
|
-
assert_requested :get, basic_bugsnag_url("/users/#{test_bugsnag_user}")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context "with user", :vcr do
|
85
|
-
before do
|
86
|
-
@user = @client.invite_user(test_bugsnag_account, "example@example.com", :admin => false)
|
87
|
-
end
|
88
|
-
|
89
|
-
describe ".update_user_permissions" do
|
90
|
-
it "updates a users permissions" do
|
91
|
-
updated_user = @client.update_user_permissions(test_bugsnag_account, @user.id, :admin => true)
|
92
|
-
expect(updated_user.account_admin).to eq(true)
|
93
|
-
assert_requested :patch, basic_bugsnag_url("/accounts/#{test_bugsnag_account}/users/#{@user.id}")
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe ".remove_user" do
|
98
|
-
it "removes a user from an account" do
|
99
|
-
response = @client.remove_user(test_bugsnag_account, @user.id)
|
100
|
-
expect(response).to be true
|
101
|
-
assert_requested :delete, basic_bugsnag_url("/accounts/#{test_bugsnag_account}/users/#{@user.id}")
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://<BUGSNAG_LOGIN>:<BUGSNAG_PASSWORD>@api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Bugsnag API Ruby Gem 1.0.0
|
12
|
-
Content-Type:
|
13
|
-
- application/json
|
14
|
-
Accept-Encoding:
|
15
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
-
Accept:
|
17
|
-
- '*/*'
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
X-Frame-Options:
|
24
|
-
- SAMEORIGIN
|
25
|
-
X-Xss-Protection:
|
26
|
-
- 1; mode=block
|
27
|
-
X-Content-Type-Options:
|
28
|
-
- nosniff
|
29
|
-
Content-Type:
|
30
|
-
- application/json; charset=utf-8
|
31
|
-
Etag:
|
32
|
-
- '"136bb571d51e95fd6e6ca40fa15fc208"'
|
33
|
-
Cache-Control:
|
34
|
-
- max-age=0, private, must-revalidate
|
35
|
-
X-Request-Id:
|
36
|
-
- 3e9612da-5cfa-4e25-9e30-b86009293f72
|
37
|
-
X-Runtime:
|
38
|
-
- '0.136797'
|
39
|
-
Date:
|
40
|
-
- Tue, 02 Sep 2014 02:49:32 GMT
|
41
|
-
Connection:
|
42
|
-
- close
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '{"id":"<BUGSNAG_ACCOUNT_ID>","name":"Test Account","created_at":"2014-09-01T20:52:32.048Z","updated_at":"2014-09-02T02:49:28.397Z","url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>","users_url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>/users","projects_url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>/projects","account_creator":{"id":"<BUGSNAG_USER_ID>","email":"<BUGSNAG_EMAIL>","name":"James
|
46
|
-
Smith","gravatar_id":"8cbca651e77dc253a98e545590ed3387","gravatar_url":"https://secure.gravatar.com/avatar/8cbca651e77dc253a98e545590ed3387","url":"https://api.bugsnag.com/users/<BUGSNAG_USER_ID>","projects_url":"https://api.bugsnag.com/users/<BUGSNAG_USER_ID>/projects"},"billing_contact":null}'
|
47
|
-
http_version:
|
48
|
-
recorded_at: Tue, 02 Sep 2014 02:49:32 GMT
|
49
|
-
recorded_with: VCR 2.9.2
|
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://api.bugsnag.com/account
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Bugsnag API Ruby Gem 1.0.0
|
12
|
-
Content-Type:
|
13
|
-
- application/json
|
14
|
-
Authorization:
|
15
|
-
- token <BUGSNAG_AUTH_TOKEN>
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- '*/*'
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: OK
|
24
|
-
headers:
|
25
|
-
X-Frame-Options:
|
26
|
-
- SAMEORIGIN
|
27
|
-
X-Xss-Protection:
|
28
|
-
- 1; mode=block
|
29
|
-
X-Content-Type-Options:
|
30
|
-
- nosniff
|
31
|
-
Content-Type:
|
32
|
-
- application/json; charset=utf-8
|
33
|
-
Etag:
|
34
|
-
- '"c6db01ee327d41c21dbb6512228f7988"'
|
35
|
-
Cache-Control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
X-Request-Id:
|
38
|
-
- 1e44b666-09b0-49bd-992c-c4fc4adfb82d
|
39
|
-
X-Runtime:
|
40
|
-
- '0.072676'
|
41
|
-
Date:
|
42
|
-
- Tue, 02 Sep 2014 02:49:32 GMT
|
43
|
-
Connection:
|
44
|
-
- close
|
45
|
-
body:
|
46
|
-
encoding: UTF-8
|
47
|
-
string: '{"id":"<BUGSNAG_ACCOUNT_ID>","name":"Test Account","created_at":"2014-09-01T20:52:32.048Z","updated_at":"2014-09-02T02:49:28.397Z","url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>","users_url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>/users","projects_url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>/projects","account_creator":{"id":"<BUGSNAG_USER_ID>","email":"<BUGSNAG_EMAIL>","name":"James
|
48
|
-
Smith","gravatar_id":"8cbca651e77dc253a98e545590ed3387","gravatar_url":"https://secure.gravatar.com/avatar/8cbca651e77dc253a98e545590ed3387","account_admin":true,"url":"https://api.bugsnag.com/users/<BUGSNAG_USER_ID>","projects_url":"https://api.bugsnag.com/users/<BUGSNAG_USER_ID>/projects","html_url":"http://bugsnag.dev/accounts/test-account/collaborators/<BUGSNAG_USER_ID>/edit"},"billing_contact":null}'
|
49
|
-
http_version:
|
50
|
-
recorded_at: Tue, 02 Sep 2014 02:49:32 GMT
|
51
|
-
recorded_with: VCR 2.9.2
|
@@ -1,49 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://<BUGSNAG_LOGIN>:<BUGSNAG_PASSWORD>@api.bugsnag.com/accounts
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Bugsnag API Ruby Gem 1.0.0
|
12
|
-
Content-Type:
|
13
|
-
- application/json
|
14
|
-
Accept-Encoding:
|
15
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
-
Accept:
|
17
|
-
- '*/*'
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
X-Frame-Options:
|
24
|
-
- SAMEORIGIN
|
25
|
-
X-Xss-Protection:
|
26
|
-
- 1; mode=block
|
27
|
-
X-Content-Type-Options:
|
28
|
-
- nosniff
|
29
|
-
Content-Type:
|
30
|
-
- application/json; charset=utf-8
|
31
|
-
Etag:
|
32
|
-
- '"facc21368ac38d65f0dd83a86c6a9e79"'
|
33
|
-
Cache-Control:
|
34
|
-
- max-age=0, private, must-revalidate
|
35
|
-
X-Request-Id:
|
36
|
-
- 50bb562e-3faf-4c58-a870-a1db0bce5655
|
37
|
-
X-Runtime:
|
38
|
-
- '0.140110'
|
39
|
-
Date:
|
40
|
-
- Tue, 02 Sep 2014 02:49:32 GMT
|
41
|
-
Connection:
|
42
|
-
- close
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '[{"id":"<BUGSNAG_ACCOUNT_ID>","name":"Test Account","created_at":"2014-09-01T20:52:32.048Z","updated_at":"2014-09-02T02:49:28.397Z","url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>","users_url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>/users","projects_url":"https://api.bugsnag.com/accounts/<BUGSNAG_ACCOUNT_ID>/projects","account_creator":{"id":"<BUGSNAG_USER_ID>","email":"<BUGSNAG_EMAIL>","name":"James
|
46
|
-
Smith","gravatar_id":"8cbca651e77dc253a98e545590ed3387","gravatar_url":"https://secure.gravatar.com/avatar/8cbca651e77dc253a98e545590ed3387","url":"https://api.bugsnag.com/users/<BUGSNAG_USER_ID>","projects_url":"https://api.bugsnag.com/users/<BUGSNAG_USER_ID>/projects"},"billing_contact":null}]'
|
47
|
-
http_version:
|
48
|
-
recorded_at: Tue, 02 Sep 2014 02:49:32 GMT
|
49
|
-
recorded_with: VCR 2.9.2
|