|
1 | | -# Sentry |
| 1 | +# Sentry Ruby API |
2 | 2 |
|
3 | | -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sentry`. To experiment with that code, run `bin/console` for an interactive prompt. |
4 | | - |
5 | | -TODO: Delete this and the text above, and describe your gem |
| 3 | +Sentry Ruby API is a Ruby wrapper for the [getsentry/sentry API](https://docs.sentry.io/hosted/api/). **And it still being developed, and not published yet.** |
6 | 4 |
|
7 | 5 | ## Installation |
8 | 6 |
|
9 | | -Add this line to your application's Gemfile: |
| 7 | +add to a Gemfile: |
10 | 8 |
|
11 | 9 | ```ruby |
12 | | -gem 'sentry' |
| 10 | +gem 'sentry', :path => '/path/to/sentry' |
13 | 11 | ``` |
14 | 12 |
|
15 | | -And then execute: |
| 13 | +## Usage |
16 | 14 |
|
17 | | - $ bundle |
| 15 | +Configuration example: |
18 | 16 |
|
19 | | -Or install it yourself as: |
| 17 | +```ruby |
| 18 | +Sentry.configure do |config| |
| 19 | + config.endpoint = 'http://example.com/api/0' |
| 20 | + config.auth_token = 'your_auth_token' |
| 21 | + config.default_org_slug = 'sentry-sc' |
| 22 | +end |
| 23 | +``` |
20 | 24 |
|
21 | | - $ gem install sentry |
| 25 | +(Note: If you are using getsentry.com's hosted service, your endpoint will be `https://app.getsentry.com/api/0`) |
22 | 26 |
|
23 | | -## Usage |
| 27 | +Usage examples: |
24 | 28 |
|
25 | | -TODO: Write usage instructions here |
| 29 | +```ruby |
| 30 | +# set an API endpoint |
| 31 | +Sentry.endpoint = 'http://example.com/api/0' |
| 32 | +# => "http://example.com/api/0" |
26 | 33 |
|
27 | | -## Development |
| 34 | +# set a user private token |
| 35 | +Sentry.auth_token = 'your_auth_token' |
| 36 | +# => "your_auth_token" |
| 37 | + |
| 38 | +# configure a proxy server |
| 39 | +Sentry.http_proxy('proxyhost', 8888) |
| 40 | +# proxy server w/ basic auth |
| 41 | +Sentry.http_proxy('proxyhost', 8888, 'user', 'pass') |
| 42 | + |
| 43 | +# list projects |
| 44 | +Sentry.projects |
28 | 45 |
|
29 | | -After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. |
| 46 | +# initialize a new client |
| 47 | +s = Sentry.client(endpoint: 'https://api.example.com', auth_token: 'your_auth_token', default_org_slug: 'sentry-sc') |
| 48 | + |
| 49 | +# a paginated response |
| 50 | +projects = Sentry.projects |
| 51 | + |
| 52 | +# check existence of the next page |
| 53 | +projects.has_next_page? |
| 54 | + |
| 55 | +# retrieve the next page |
| 56 | +projects.next_page |
| 57 | + |
| 58 | +# iterate all projects |
| 59 | +projects.auto_paginate do |project| |
| 60 | + # do something |
| 61 | +end |
| 62 | + |
| 63 | +# retrieve all projects as an array |
| 64 | +projects.auto_paginate |
| 65 | +``` |
| 66 | + |
| 67 | +## Development |
| 68 | +The basic framework had been finished, meanwhile the APIs of Organizations,Projects and Events had been added, more APIs will be added later. You are welcome to help me with it. |
30 | 69 |
|
31 | | -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). |
| 70 | +After checking out the repo, run `bin/setup` to install dependencies. Then, run |
| 71 | +`rake spec` to run the tests. You can also run `bin/console` for an interactive |
| 72 | +prompt that will allow you to experiment. |
32 | 73 |
|
33 | | -## Contributing |
| 74 | +## License |
34 | 75 |
|
35 | | -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sentry. |
| 76 | +Released under the BSD 2-clause license. See LICENSE.txt for details. |
36 | 77 |
|
| 78 | +## Special Thank |
| 79 | +Thanks to NARKOZ's [gitlab](https://github.com/NARKOZ/gitlab) ruby wrapper which really gives me a lot of inspiration. |
0 commit comments