Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete method for events #109

Merged
merged 1 commit into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/dogapi/facade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def get_event(id)
@event_svc.get(id)
end

# Delete an event
#
# +id+ of the event to delete
def delete_event(id)
@event_svc.delete(id)
end

# Get an optionally filtered event stream
#
# +start+ is a Time object for when to start the stream
Expand Down
4 changes: 4 additions & 0 deletions lib/dogapi/v1/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def get(id)
request(Net::HTTP::Get, '/api/' + API_VERSION + '/events/' + id.to_s, nil, nil, false)
end

def delete(id)
request(Net::HTTP::Delete, '/api/' + API_VERSION + '/events/' + id.to_s, nil, nil, false)
end

def stream(start, stop, options= {})
defaults = {
:priority => nil,
Expand Down
6 changes: 6 additions & 0 deletions spec/integration/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
:get, "/events/#{EVENT_ID}"
end

describe '#delete_event' do
it_behaves_like 'an api method',
:delete_event, [EVENT_ID],
:delete, "/events/#{EVENT_ID}"
end

describe '#stream' do
it 'queries the api with params' do
url = api_url + '/events'
Expand Down