Class: Airbrake::API
- Inherits:
-
Object
- Object
- Airbrake::API
- Defined in:
- lib/campfire/polling_bot/plugins/airbrake/airbrake/api.rb
Instance Method Summary collapse
- #error_url(error) ⇒ Object
- #errors(show_resolved = false) ⇒ Object
-
#initialize(domain, auth_token) ⇒ API
constructor
A new instance of API.
- #resolve_error(error_id, resolved = true) ⇒ Object
Constructor Details
#initialize(domain, auth_token) ⇒ API
Returns a new instance of API.
6 7 8 9 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/api.rb', line 6 def initialize(domain, auth_token) @host = "#{domain}.airbrakeapp.com" @auth_token = auth_token end |
Instance Method Details
#error_url(error) ⇒ Object
20 21 22 23 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/api.rb', line 20 def error_url(error) error_id = error.is_a?(Airbrake::Error) ? error.error_id : error "https://#{@host}/errors/#{error_id}" end |
#errors(show_resolved = false) ⇒ Object
15 16 17 18 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/api.rb', line 15 def errors(show_resolved=false) doc = Nokogiri::XML(api_get("/errors.xml", :show_resolved => show_resolved)) doc.xpath("/groups/group").map {|node| Airbrake::Error.from_xml(node) } end |
#resolve_error(error_id, resolved = true) ⇒ Object
11 12 13 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/api.rb', line 11 def resolve_error(error_id, resolved=true) api_put("/errors/#{error_id}", {}, :group => {:resolved => resolved}) end |