Skip to content

Commit

Permalink
Add delete method for events (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
degemer authored Aug 23, 2016
1 parent ec8cd90 commit 2faafa0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
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

0 comments on commit 2faafa0

Please sign in to comment.