Module: SentryApi::Client::Organizations

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

Instance Method Summary collapse

Instance Method Details

#organization(organization_slug = "") ⇒ SentryApi::ObjectifiedHash

Retrieve an Organization

Examples:

SentryApi.organization
SentryApi.organization('slug')

Parameters:

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

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

Returns:



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

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

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

List an Organization’s Projects

Examples:

SentryApi.organization_projects
SentryApi.organization_projects('slug')

Parameters:

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

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

Returns:



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

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

#organization_stats(organization_slug, options = {}) ⇒ 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)

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


70
71
72
# File 'lib/sentry-api/client/organizations.rb', line 70

def organization_stats(organization_slug, options={})
  get("/organizations/#{organization_slug}/stats/", query: options)
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(organization_slug, options = {}) ⇒ 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)

    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:



53
54
55
# File 'lib/sentry-api/client/organizations.rb', line 53

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