lib/bugsnag/api/client/events.rb in bugsnag-api-1.0.3 vs lib/bugsnag/api/client/events.rb in bugsnag-api-2.0.0
- old
+ new
@@ -2,53 +2,59 @@
module Api
class Client
# Methods for the Events API
#
- # @see https://bugsnag.com/docs/api/events
+ # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events
module Events
- # List a project's events
+ # View an Event
#
- # @param project [String] Bugsnag project for which to list events
- # @return [Array<Sawyer::Resource>] List of events
- # @see https://bugsnag.com/docs/api/events#list-a-project-s-events
- # @example
- # Bugsnag::Api.events("50baed119bf39c1431000004")
- def events(project, options = {})
- paginate "projects/#{project}/events", options
+ # @return [Sawyer::Resource] Requested Event
+ # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/view-an-event
+ def event(project_id, id, options = {})
+ get "projects/#{project_id}/events/#{id}", options
end
- alias :project_events :events
- # List an error's events
+ # Delete an Event
#
- # @param error [String] Bugsnag error for which to list events
- # @return [Array<Sawyer::Resource>] List of events
- # @see https://bugsnag.com/docs/api/events#list-an-error-s-events
- # @example
- # Bugsnag::Api.error_events("518031bcd775355c48a1cd4e")
- def error_events(error, options = {})
- paginate "errors/#{error}/events", options
+ # @return
+ # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/delete-an-event
+ def delete_event(project_id, id, options = {})
+ boolean_from_response :delete, "projects/#{project_id}/events/#{id}", options
end
- # Get a single event
+ # List the Events on an Error
#
- # @param event [String] A Bugsnag event id
- # @return [Sawyer::Resource] The event you requested, if it exists
- # @see https://bugsnag.com/docs/api/events#get-event-details
- # @example
- # Bugsnag::Api.event("51f5d152f002c6686d013a22")
- def event(event, options = {})
- get "events/#{event}", options
+ # @option base [String] Only Error Events occuring before this time will be returned
+ # @option sort [String] Which field to sort the results by, one of: last_seen, first_seen, users, events
+ # @option direction [String] Which direction to sort the results by, one of: asc, desc
+ # @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
+ # @return [Array<Sawyer::Resource>] List of Events for the specified Error
+ # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/list-the-events-on-an-error
+ def error_events(project_id, error_id, options = {})
+ paginate "projects/#{project_id}/errors/#{error_id}/events", options
end
- # Delete an event
+ # View the latest Event on an Error
#
- # @param event [String] A Bugsnag event
- # @return [Boolean] `true` if event was deleted
- # @see https://bugsnag.com/docs/api/events#delete-an-event
- def delete_event(event, options = {})
- boolean_from_response :delete, "events/#{event}", options
+ # @return [Sawyer::Resource] Last event reported Event
+ # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/view-the-latest-event-on-an-error
+ def latest_event(error_id, options = {})
+ get "errors/#{error_id}/latest_event", options
end
+
+ # List the Events on a Project
+ #
+ # @option base [String] Only Project Events occuring before this time will be returned
+ # @option sort [String] Which field to sort the results by, one of: last_seen, first_seen, users, events
+ # @option direction [String] Which direction to sort the results by, one of: asc, desc
+ # @option filters [Object] An optional filter object, see http://docs.bugsnagapiv2.apiary.io/#introduction/filtering
+ # @return [Array<Sawyer::Resource>] List of Events for the specified Project
+ # @see http://docs.bugsnagapiv2.apiary.io/#reference/errors/events/list-the-events-on-a-project
+ def events(project_id, options = {})
+ get "projects/#{project_id}/events", options
+ end
end
end
end
end
+
\ No newline at end of file