Module: SentryApi::Client::Organizations

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

Instance Method Summary collapse

Instance Method Details

#create_team(options = {}, organization_slug = @default_org_slug) ⇒ SentryApi::ObjectifiedHash

Create a new team bound to an organization

Examples:

SentryApi.create_project('team-slug', {name:'team-name', slug:'team-slug'})

Parameters:

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

    the slug of the organization the team should be created for

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

    A customizable set of options.

Options Hash (options):

  • :name (String)

    the name for the new team.

  • :slug (String)

    optionally a slug for the new team. If it’s not provided a slug is generated from the name.

Returns:



82
83
84
# File 'lib/sentry-api/client/organizations.rb', line 82

def create_team(options={}, organization_slug=@default_org_slug)
  post("/organizations/#{organization_slug}/teams/", body: options)
end

#organization(organization_slug = @default_org_slug) ⇒ SentryApi::ObjectifiedHash

Retrieve an Organization

Examples:

SentryApi.organization
SentryApi.organization('slug')

Parameters:

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

    the slug of the organization the team should be created for.

Returns:



35
36
37
# File 'lib/sentry-api/client/organizations.rb', line 35

def organization(organization_slug=@default_org_slug)
  get("/organizations/#{organization_slug}/")
end

#organization_projects(organization_slug = @default_org_slug) ⇒ Array<SentryApi::ObjectifiedHash>

List an Organization’s Projects

Examples:

SentryApi.organization_projects
SentryApi.organization_projects('slug')

Parameters:

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

    the slug of the organization for which the projects should be listed.

Returns:



23
24
25
# File 'lib/sentry-api/client/organizations.rb', line 23

def organization_projects(organization_slug=@default_org_slug)
  get("/organizations/#{organization_slug}/projects/")
end

#organization_stats(options = {}, organization_slug = @default_org_slug) ⇒ Array<Array>

Retrieve Event Counts for an Organization

Examples:

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

Parameters:

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

    the slug of the organization for which the stats should be retrieved.

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


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

def organization_stats(options={}, organization_slug=@default_org_slug)
  get("/organizations/#{organization_slug}/stats/", query: options)
end

#organization_teams(organization_slug = @default_org_slug) ⇒ Array<SentryApi::ObjectifiedHash>

Return a list of teams bound to a organization.

Examples:

SentryApi.organization_teams('team-slug')

Parameters:

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

    the slug of the organization

Returns:



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

def organization_teams(organization_slug=@default_org_slug)
  get("/organizations/#{organization_slug}/teams/")
end

#organizations(member = false) ⇒ Array<SentryApi::ObjectifiedHash>

List your Organizations.

Examples:

SentryApi.organizations

Parameters:

  • member (Boolean) (defaults to: false)

    Restrict results to organizations which you have membership

Returns:



11
12
13
# File 'lib/sentry-api/client/organizations.rb', line 11

def organizations(member=false)
  get("/organizations/", query: {member: member})
end

#update_organization(options = {}, organization_slug = @default_org_slug) ⇒ SentryApi::ObjectifiedHash

Update an Organization

Examples:

SentryApi.update_organization('slug')
SentryApi.update_organization('slug',{name:'new-name'})
SentryApi.update_organization('slug',{name:'new-name', slug:'new-slug'})

Parameters:

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

    the slug of the organization the team should be created for.

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

    A customizable set of options.

Options Hash (options):

  • :name (String)

    an optional new name for the organization.

  • :slug (String)

    an optional new slug for the organization. Needs to be available and unique.

Returns:



51
52
53
# File 'lib/sentry-api/client/organizations.rb', line 51

def update_organization(options={}, organization_slug=@default_org_slug)
  put("/organizations/#{organization_slug}/", body: options)
end