Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Created September 29, 2011 20:32
Show Gist options
  • Save chrismatthieu/1251842 to your computer and use it in GitHub Desktop.
Save chrismatthieu/1251842 to your computer and use it in GitHub Desktop.
Nodester Coupon Submissions
curl http://username:password@databasename.couchone.com/coupons/_design/nodecoupons/_view/all
require 'rubygems'
require 'json'
require 'rest_client'
coupons = 'JSON RESULT FROM CURL ABOVE'
table = JSON.parse(coupons)
table["rows"].each do |i|
puts i["value"]["_id"]
RestClient.delete 'http://username:password@databasename.couchone.com/coupons/' + i["value"]["_id"] + '?rev=' + i["value"]["_rev"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment