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, organization_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.

  • organization_slug (String) (defaults to: "")

    the slug of the organization the client keys belong to.

Returns:



105
106
107
108
# File 'lib/sentry-api/client/projects.rb', line 105

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

#create_client_key(project_slug, options = {}, organization_slug = @default_org_slug) ⇒ 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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the client keys belong to.

Options Hash (options):

  • :name (String)

    the name for the new key.

Returns:



120
121
122
# File 'lib/sentry-api/client/projects.rb', line 120

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

#delete_client_key(project_slug, key_id, organization_slug = @default_org_slug) ⇒ 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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the client keys belong to.



132
133
134
# File 'lib/sentry-api/client/projects.rb', line 132

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

#delete_project(project_slug, organization_slug = @default_org_slug) ⇒ Object

Delete a Project.

Examples:

SentryApi.delete_project('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project to delete.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the project belong to.



50
51
52
# File 'lib/sentry-api/client/projects.rb', line 50

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

#project(project_slug, organization_slug = @default_org_slug) ⇒ SentryApi::ObjectifiedHash

Retrieve a Project

Examples:

SentryApi.project('project-slug')

Parameters:

  • project_slug (String)

    the slug of the project to retrieve.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the project belong to.

Returns:



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

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

#project_dsym_files(project_slug, organization_slug = @default_org_slug) ⇒ Array<SentryApi::ObjectifiedHash>

List a Project’s DSym Files.

Examples:

SentryApi.project_dsym_files('project-slug')

Parameters:

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization.

  • project_slug (String)

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

Returns:



93
94
95
# File 'lib/sentry-api/client/projects.rb', line 93

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

#project_event(project_slug, event_id, organization_slug = @default_org_slug) ⇒ SentryApi::ObjectifiedHash

Retrieve an Event for a Project

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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the client keys belong to.

Returns:



172
173
174
# File 'lib/sentry-api/client/projects.rb', line 172

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

#project_events(project_slug, organization_slug = @default_org_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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the client keys belong to.

Returns:



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

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

#project_issues(project_slug, organization_slug = @default_org_slug) ⇒ Array<SentryApi::ObjectifiedHash>

Return a list of aggregates bound to a project

Examples:

SentryApi.project_issues('project-slug')

Returns:



182
183
184
# File 'lib/sentry-api/client/projects.rb', line 182

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

#project_stats(project_slug, options = {}, organization_slug = @default_org_slug) ⇒ 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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the project belong to.

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>)


68
69
70
# File 'lib/sentry-api/client/projects.rb', line 68

def project_stats(project_slug, options={}, organization_slug=@default_org_slug)
  get("/projects/#{organization_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 = {}, organization_slug = @default_org_slug) ⇒ 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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the client keys belong to.

Options Hash (options):

  • :name (String)

    the new name for the client key.

Returns:



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

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

#update_project(project_slug, options = {}, organization_slug = @default_org_slug) ⇒ 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.

  • organization_slug (String) (defaults to: @default_org_slug)

    the slug of the organization the project belong to.

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:



39
40
41
# File 'lib/sentry-api/client/projects.rb', line 39

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

#upload_dsym_files(project_slug, file_path, organization_slug = @default_org_slug) ⇒ 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) (defaults to: @default_org_slug)

    the slug of the organization.

Returns:



81
82
83
# File 'lib/sentry-api/client/projects.rb', line 81

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