Back in 2009 I wrote this little Ruby script I run Mondays to grab the last week’s tweets and publish them into the Short-form Fragments stream here on the blog, because who knows when Twitter might make my history vanish? It broke today and I fixed it and had another instructive OAuth experience.
The error message was a 404 on something called
user_timeline.xml; a bit of poking around produced contradictory
evidence, but some of it was that this had been deprecated in favor of a JSON
version. I was a little irritated but not too much; I’d been using XPath
probes to pull the interesting bits out of the XML, and tweets aren’t
document-like at all, so JSON should be a better fit.
It was even easier than I expected; the Twitter Ruby Gem has grown up. As for the OAuth part, you need to do the following:
Twitter.configure do |config| config.consumer_key = YOUR_CONSUMER_KEY config.consumer_secret = YOUR_CONSUMER_SECRET config.oauth_token = YOUR_OAUTH_TOKEN config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET end
Then it all Just Works. And since it’s all going server-to-server over TLS, it’s Pretty Damn Secure. This is what Internet Identity should be like.
Thanks to John Nunemaker, Wynn Netherland, Erik Michaels-Ober, and Steve Richert.