Created
September 29, 2011 20:32
-
-
Save chrismatthieu/1251842 to your computer and use it in GitHub Desktop.
Nodester Coupon Submissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://username:password@databasename.couchone.com/coupons/_design/nodecoupons/_view/all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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