Module: Bugsnag::Api::Client::Collaborators
- Included in:
- Bugsnag::Api::Client
- Defined in:
- lib/bugsnag/api/client/collaborators.rb
Overview
Methods for the Organizations Collaborators API
Instance Method Summary collapse
-
#collaborator(org_id, collaborator_id, options = {}) ⇒ Sawyer::Resource
View a Collaborator.
-
#collaborators(org_id = nil, project_id = nil, options = {}) ⇒ Array<Sawyer::Resource>
List Collaborators.
-
#delete_collaborator(org_id, id, options = {}) ⇒ Object
Delete a Collaborator.
-
#invite_collaborators(org_id, emails, options = {}) ⇒ Array<Sawyer::Resource>
Invite Collaborators.
-
#update_collaborator_permissions(org_id, id, options = {}) ⇒ Sawyer::Resource
Update a Collaborator's permissions.
-
#view_collaborator_projects(org_id, id, options = {}) ⇒ Array<Sawyer::Resource>
View Projects a Collaborator has access to.
Instance Method Details
#collaborator(org_id, collaborator_id, options = {}) ⇒ Sawyer::Resource
View a Collaborator
13 14 15 |
# File 'lib/bugsnag/api/client/collaborators.rb', line 13 def collaborator(org_id, collaborator_id, = {}) get "organizations/#{org_id}/collaborators/#{collaborator_id}", end |
#collaborators(org_id = nil, project_id = nil, options = {}) ⇒ Array<Sawyer::Resource>
List Collaborators
26 27 28 29 30 31 32 33 34 |
# File 'lib/bugsnag/api/client/collaborators.rb', line 26 def collaborators(org_id = nil, project_id = nil, = {}) if !org_id.nil? paginate "organizations/#{org_id}/collaborators", elsif !project_id.nil? paginate "projects/#{project_id}/collaborators", else raise ArgumentError, "Must supply either an org_id or a project_id" end end |
#delete_collaborator(org_id, id, options = {}) ⇒ Object
Delete a Collaborator
69 70 71 |
# File 'lib/bugsnag/api/client/collaborators.rb', line 69 def delete_collaborator(org_id, id, = {}) boolean_from_response :delete, "organizations/#{org_id}/collaborators/#{id}", end |
#invite_collaborators(org_id, emails, options = {}) ⇒ Array<Sawyer::Resource>
Invite Collaborators
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/bugsnag/api/client/collaborators.rb', line 44 def invite_collaborators(org_id, emails, = {}) case emails when String post "organizations/#{org_id}/collaborators", .merge({:email => emails}) when Array post "organizations/#{org_id}/collaborators/bulk_invite", .merge({:emails => emails}) else raise ArgumentError, "Emails must be a String or an Array" end end |
#update_collaborator_permissions(org_id, id, options = {}) ⇒ Sawyer::Resource
Update a Collaborator's permissions
61 62 63 |
# File 'lib/bugsnag/api/client/collaborators.rb', line 61 def (org_id, id, = {}) patch "organizations/#{org_id}/collaborators/#{id}", end |
#view_collaborator_projects(org_id, id, options = {}) ⇒ Array<Sawyer::Resource>
View Projects a Collaborator has access to
80 81 82 |
# File 'lib/bugsnag/api/client/collaborators.rb', line 80 def view_collaborator_projects(org_id, id, = {}) paginate "organizations/#{org_id}/collaborators/#{id}/projects", end |