Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stve/airbrake-api
Airbrake API Ruby Client
https://github.com/stve/airbrake-api
Last synced: 23 days ago
JSON representation
Airbrake API Ruby Client
- Host: GitHub
- URL: https://github.com/stve/airbrake-api
- Owner: stve
- License: mit
- Created: 2009-02-27T03:00:23.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2016-05-30T06:21:32.000Z (over 8 years ago)
- Last Synced: 2024-04-24T15:45:21.875Z (7 months ago)
- Language: Ruby
- Homepage: https://rubygems.org/gems/airbrake-api
- Size: 557 KB
- Stars: 44
- Watchers: 4
- Forks: 25
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Airbrake API [![Build Status](https://secure.travis-ci.org/stve/airbrake-api.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/stve/airbrake-api.png?travis)][gemnasium]
[travis]: http://travis-ci.org/stve/airbrake-api
[gemnasium]: https://gemnasium.com/stve/airbrake-apiA ruby client for the [Airbrake API](http://help.airbrake.io/kb/api-2/api-overview)
## Changes in 4.0
AirbrakeAPI has been completely rewritten in 4.0. Why the high version number?
This was the first gem I ever wrote and it's wandered a path that started with
ActiveResource, followed by HTTParty, and now Faraday. Along the way, AirbrakeAPI
has lost it's ActiveRecord-like syntax for a more concise and simple API. Instead
of using classes such as `AirbrakeAPI::Error`, the entire API is contained within
`AirbrakeAPI::Client`.The following classes and their methods are now deprecated:
* `AirbrakeAPI::Error`
* `AirbrakeAPI::Notice`
* `AirbrakeAPI::Project`While your code will continue to work using the old API, they will ultimately be removed in favor of `AirbrakeAPI::Client`.
## Configuration
AirbrakeAPI can be configured by passing a hash to the configure method:
AirbrakeAPI.configure(:account => 'anapp', :auth_token => 'abcdefg', :secure => true)
or via a block:
AirbrakeAPI.configure do |config|
config.account = 'anapp'
config.auth_token = 'abcdefg'
config.secure = true
end**Note:** Airbrake's API utilizes a separate 'auth_token' than the API Key that is used to configure the Airbrake tracker. Your 'auth_token' is found on the bottom of the user settings page.
## Finding Errors
Errors are paginated, the API responds with 25 at a time, pass an optional params hash for additional pages:
AirbrakeAPI.errors
AirbrakeAPI.errors(:page => 2)To find an individual error, you can find by ID:
AirbrakeAPI.error(error_id)
## Finding Notices
Find *all* notices of an error:
AirbrakeAPI.notices(error_id)
Notices may be paginated. If you don't want to retrieve all notices and merely want a specific page:
AirbrakeAPI.notices(error_id, :page => 3)
Find an individual notice:
AirbrakeAPI.notice(notice_id, error_id)
To resolve an error via the API:
AirbrakeAPI.update(1696170, :group => { :resolved => true})
Recreate an error:
STDOUT.sync = true
AirbrakeAPI.notices(error_id) do |batch|
batch.each do |notice|
result = system "curl --silent '#{notice.request.url}' > /dev/null"
print (result ? '.' : 'F')
end
end## Projects
To retrieve a list of projects:
AirbrakeAPI.projects
## Deployments
To retrieve a list of deployments:
AirbrakeAPI.deploys(project_id)
## Connecting to more than one account
While module-based configuration will work in most cases, if you'd like to simultaneously connect to more than one account at once, you can create instances of `AirbrakeAPI::Client` to do so:
client = AirbrakeAPI::Client.new(:account => 'myaccount', :auth_token => 'abcdefg', :secure => true)
altclient = AirbrakeAPI::Client.new(:account => 'anotheraccount', :auth_token => '123456789', :secure => false)client.errors
altclient.projects
## Responses
If an error is returned from the API, an AirbrakeError exception will be raised. Successful responses will return a Hashie::Mash object based on the data from the response.
## Contributors
* [Matias Käkelä](https://github.com/massive) - SSL Support
* [Jordan Brough](https://github.com/jordan-brough) - Notices
* [Michael Grosser](https://github.com/grosser) - Numerous performance improvements and bug fixes
* [Brad Greenlee](https://github.com/bgreenlee) - Switch from Hoptoad to Airbrake