Created
October 26, 2009 02:34
-
-
Save alvin2ye/218396 to your computer and use it in GitHub Desktop.
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
Delete a tweet on Twitter | |
copy from http://feeds.dzone.com/~r/snippets/ruby/~3/gdGhzZh5GGs/8233 | |
headers = { | |
"User-Agent" => "Ruby v1.8", | |
"X-Twitter-Client" => "Ruby", | |
"X-Twitter-Client-Version" => "1.8" | |
} | |
path = "http://twitter.com/statuses/destroy/5157931577.xml" | |
url = URI.parse(path) | |
req = Net::HTTP::Post.new(url.path, headers) | |
req.basic_auth('drobertson', 'password') | |
req.delete(path) | |
response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) } | |
Here's another variation: | |
Net::HTTP.start('twitter.com') do |http| | |
req = Net::HTTP::Delete.new(path, headers) | |
req.basic_auth('drobertson', 'password') | |
response = http.request(req) | |
end |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment