Skip to content

thierryxing/sentry-ruby-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentry Ruby API

Build Status Gem Version License

Sentry Ruby API is a Ruby wrapper for the getsentry/sentry API.

Installation

Install it from rubygems:

gem install sentry-api

Or add to a Gemfile:

gem 'sentry-api'

Usage

Configuration example:

SentryApi.configure do |config|
  config.endpoint = 'http://example.com/api/0'
  config.auth_token = 'your_auth_token'
  config.default_org_slug = 'sentry-sc'
end

(Note: If you are using getsentry.com's hosted service, your endpoint will be https://sentry.io/api/0/)

Usage examples:

# set an API endpoint
SentryApi.endpoint = 'http://example.com/api/0'
# => "http://example.com/api/0"

# set a user private token
SentryApi.auth_token = 'your_auth_token'
# => "your_auth_token"

# configure a proxy server
SentryApi.http_proxy('proxyhost', 8888)
# proxy server w/ basic auth
SentryApi.http_proxy('proxyhost', 8888, 'user', 'pass')

# list projects
SentryApi.projects

# initialize a new client
s = SentryApi.client(endpoint: 'https://api.example.com', auth_token: 'your_auth_token', default_org_slug: 'sentry-sc')

# a paginated response
projects = SentryApi.projects

# check existence of the next page
projects.has_next_page?

# retrieve the next page
projects.next_page

# iterate all projects
projects.auto_paginate do |project|
  # do something
end

# retrieve all projects as an array
projects.auto_paginate

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

License

Released under the BSD 2-clause license. See LICENSE.txt for details.

Special Thank

Thanks to NARKOZ's gitlab ruby wrapper which really gives me a lot of inspiration.