Created
August 21, 2012 03:07
-
-
Save judismith/3411152 to your computer and use it in GitHub Desktop.
Delete projects through Basecamp Next API from list in file
This file contains hidden or 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 'net/https' | |
require 'uri' | |
require 'rubygems' | |
require 'json/pure' | |
@user = 'username' | |
@pass = 'password' | |
file = File.new("bc_proj.txt", "r") | |
while (@line = file.gets) | |
# replace 9999999 with your instance id | |
@path = '/9999999/api/v1/projects/' + @line.gsub("\n", '') + '.json' | |
puts @path.inspect | |
uri = URI.parse('https://basecamp.com') | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
req = Net::HTTP::Delete.new(@path) | |
req.add_field('User-Agent', 'MyApp ([email protected])') | |
req.basic_auth @user, @pass | |
resp = http.request(req) | |
puts resp.inspect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment