keenlabs/keen-gem — pull request #12 by cbartlett (2013-05-27 01:44:28+00:00)
Title: Support event deletion

This adds support for event collection deletion and for the required initialization of a client with a master key. You can delete whole collections or use a filter to delete only certain records.

The return value is just true of it succeeds since there is no response body with these. It will properly filter up invalid collection names, etc.

BONUS! Event publishing now supports symbols for event names.

```
# Publish one event now, one in the past
$ Keen.publish(:testing, { your: :mom })
=> {"created"=>true}
$ Keen.publish(:testing, { old: :data, keen: { timestamp: Time.now - 60*60*24*3 } })
=> {"created"=>true}

# Yep, they are both there
$ Keen.count(:testing)
=> 2

# Query for just the one we want to axe
$ Keen.count(:testing, filters: [{ property_name: 'keen.timestamp', operator: 'lt', property_value: Time.now - 60*60*24*2 }])
=> 1

# Delete just that one
$ Keen.delete(:testing, filters: [{ property_name: 'keen.timestamp', operator: 'lt', property_value: Time.now - 60*60*24*2 }])
=> true

# Look, it's gone!
$ Keen.count(:testing, filters: [{ property_name: 'keen.timestamp', operator: 'lt', property_value: Time.now - 60*60*24*2 }])
=> 0

# Other one is still there
$ Keen.count(:testing)
=> 1

# We can delete them all simply:
$ Keen.delete(:testing)
=> true
```