Module: SentryApi::Client::Projects

Included in:
SentryApi::Client
Defined in:
lib/sentry-api/client/projects.rb

Instance Method Summary collapse

Instance Method Details

#client_keys(project_slug) ⇒ Array<SentryApi::ObjectifiedHash>

List a Project’s Client Keys.

Examples:

SentryApi.client_keys('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

Returns:



99
100
101
# File 'lib/sentry-api/client/projects.rb', line 99

def client_keys(project_slug)
  get("/projects/#{@default_org_slug}/#{project_slug}/keys/")
end

#create_client_key(project_slug, options = {}) ⇒ SentryApi::ObjectifiedHash

Create a new Client Key.

Examples:

SentryApi.create_client_key('project-slug','new-name')

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name (String)

    the name for the new key.

Returns:



112
113
114
# File 'lib/sentry-api/client/projects.rb', line 112

def create_client_key(project_slug, options={})
  post("/projects/#{@default_org_slug}/#{project_slug}/keys/", body: options)
end

#delete_client_key(project_slug, key_id) ⇒ Object

Delete a Client Key.

Examples:

SentryApi.delete_client_key('project-slug','87c990582e07446b9907b357fc27730e')

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

  • key_id (String)

    the ID of the key to delete.



123
124
125
# File 'lib/sentry-api/client/projects.rb', line 123

def delete_client_key(project_slug, key_id)
  delete("/projects/#{@default_org_slug}/#{project_slug}/keys/#{key_id}/")
end

#delete_project(project_slug) ⇒ Object

Delete a Project.

Examples:

SentryApi.delete_project('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project to delete.



47
48
49
# File 'lib/sentry-api/client/projects.rb', line 47

def delete_project(project_slug)
  delete("/projects/#{@default_org_slug}/#{project_slug}/")
end

#project(project_slug) ⇒ SentryApi::ObjectifiedHash

Retrieve a Project

Examples:

SentryApi.project('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project to retrieve.

Returns:



21
22
23
# File 'lib/sentry-api/client/projects.rb', line 21

def project(project_slug)
  get("/projects/#{@default_org_slug}/#{project_slug}/")
end

#project_dsym_files(project_slug) ⇒ Array<SentryApi::ObjectifiedHash>

List a Project’s DSym Files.

Examples:

SentryApi.project_dsym_files('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project to list the dsym files of.

Returns:



88
89
90
# File 'lib/sentry-api/client/projects.rb', line 88

def project_dsym_files(project_slug)
  get("/projects/#{@default_org_slug}/#{project_slug}/files/dsyms/")
end

#project_event(project_slug, event_id) ⇒ SentryApi::ObjectifiedHash

Return a list of issues (groups) bound to a project. All parameters are supplied as query string parameters.

Examples:

SentryApi.project_event('project-slug', 'event-id')

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

  • event_id (String)

    the slug of the project the event belongs to.

Returns:



160
161
162
# File 'lib/sentry-api/client/projects.rb', line 160

def project_event(project_slug, event_id)
  get("/projects/#{@default_org_slug}/#{project_slug}/events/#{event_id}/")
end

#project_events(project_slug) ⇒ Array<SentryApi::ObjectifiedHash>

Return a list of sampled events bound to a project.

Examples:

SentryApi.project_events('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

Returns:



148
149
150
# File 'lib/sentry-api/client/projects.rb', line 148

def project_events(project_slug)
  get("/projects/#{@default_org_slug}/#{project_slug}/events/")
end

#project_issues(project_slug, options = {}) ⇒ Array<SentryApi::ObjectifiedHash>

List a Project’s Issues

Examples:

SentryApi.project_issues('project-slug', {'query': 'is:unresolved Build-version:6.5.0'})

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :statsPeriod (String)

    an optional stat period (can be one of “24h”, “14d”, and “”).

  • :query (String)

    an optional Sentry structured search query. If not provided an implied “is:resolved” is assumed.)

Returns:



174
175
176
# File 'lib/sentry-api/client/projects.rb', line 174

def project_issues(project_slug, options={})
  get("/projects/#{@default_org_slug}/#{project_slug}/issues/", query: options)
end

#project_stats(project_slug, options = {}) ⇒ Array<Array>

Retrieve Event Counts for an Project

Examples:

SentryApi.project_stats('slug')
SentryApi.project_stats('slug', {stat:'received', since:'1472158800'})

Parameters:

  • project_slug (String)

    the slug of the project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :stat (String)

    the name of the stat to query (“received”, “rejected”, “blacklisted”)

  • :since (Timestamp)

    a timestamp to set the start of the query in seconds since UNIX epoch.

  • :until (Timestamp)

    a timestamp to set the end of the query in seconds since UNIX epoch.

  • :resolution (String)

    an explicit resolution to search for (eg: 10s). This should not be used unless you are familiar with Sentry’s internals as it’s restricted to pre-defined values.

Returns:

  • (Array<Array>)


64
65
66
# File 'lib/sentry-api/client/projects.rb', line 64

def project_stats(project_slug, options={})
  get("/projects/#{@default_org_slug}/#{project_slug}/stats/", query: options)
end

#projectsArray<SentryApi::ObjectifiedHash>

List your Projects

Examples:

SentryApi.projects

Returns:



10
11
12
# File 'lib/sentry-api/client/projects.rb', line 10

def projects
  get("/projects/")
end

#update_client_key(project_slug, key_id, options = {}) ⇒ Array<SentryApi::ObjectifiedHash>

Update a Client Key

Examples:

SentryApi.update_client_key('project-slug','87c990582e07446b9907b357fc27730e',{name:'new-name'})

Parameters:

  • project_slug (String)

    the slug of the project the client keys belong to.

  • key_id (String)

    the ID of the key to update.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name (String)

    the new name for the client key.

Returns:



137
138
139
# File 'lib/sentry-api/client/projects.rb', line 137

def update_client_key(project_slug, key_id, options={})
  put("/projects/#{@default_org_slug}/#{project_slug}/keys/#{key_id}/", body: options)
end

#update_project(project_slug, options = {}) ⇒ SentryApi::ObjectifiedHash

Update a Project

Examples:

SentryApi.update_project('project-slug', {name:'new-name', slug:'new-slug', is_bookmarked:false})

Parameters:

  • project_slug (String)

    the slug of the project to retrieve.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name (String)

    the new name for the project.

  • :slug (String)

    the new slug for the project.

  • :isBookmarked (String)

    in case this API call is invoked with a user context this allows changing of the bookmark flag.

  • optional (Hash)

    options to override in the project settings.

Returns:



37
38
39
# File 'lib/sentry-api/client/projects.rb', line 37

def update_project(project_slug, options={})
  put("/projects/#{@default_org_slug}/#{project_slug}/", body: options)
end

#upload_dsym_files(project_slug, file_path) ⇒ Array<SentryApi::ObjectifiedHash>

Upload a new dsym file for the given release

Examples:

SentryApi.upload_dsym_files('project-slug','/path/to/file')

Parameters:

  • project_slug (String)

    the slug of the project to list the dsym files of.

  • file_path (String)

    the absolute file path of the dsym file.

  • organization_slug (String)

    the slug of the organization.

Returns:



77
78
79
# File 'lib/sentry-api/client/projects.rb', line 77

def upload_dsym_files(project_slug, file_path)
  upload("/projects/#{@default_org_slug}/#{project_slug}/files/dsyms/", body: {file: File.new(file_path)})
end