Basecamp’s writeboards provide a great facility for versioned, collaborative document editing. However, any user of Basecamp will be able to tell you that they don’t fit in as neatly as the other components of the system. Going to a writeboard takes you to an interim “loading” page before displaying the writeboard outside the regular interface of Basecamp.
To the developer, the difference between writeboards and the rest of Basecamp is highlighted further because writeboards are the only part of the app without an API. The enterprising Ruby developer, however, sees this as no barrier! So without further ado, I bring you writeboard-rb, a little Ruby class that allows you to access the contents of a writeboard programatically:
wb = Basecamp::Writeboard.new(
:url => 'http://bigcorp.updatelog.com/W1234567',
:username => 'user',
:password => 'pass',
:cookie_jar => '/tmp/foo',
:use_ssl => true
)
puts wb.contentsBehind the scenes, no fewer than five calls to the curl command line utility are made, along with a wee bit of Hpricot screen scraping to facilitate a form post otherwise made with JavaScript during the normal writeboard loading page. Using curl is necessary here because we need to preserve session cookies for both the Basecamp and Writeboard domains during the process of fetching the writeboard’s contents.
Anyway, please go check out the code on github, and feel free to fork it to make any improvements or extensions! I hope it can come in handy for you. It was a fun little challenge to take it this far.
Archived Comments
That's really cool. I want to use this on Heroku, which unfortunately has a read-only filesystem (and probably no curl available), I wonder if there's any way to use httparty or something to handle the cookies, and get rid of curl.
Hi Tobin, thanks for getting in touch. Shame you ran into problems on heroku. There's an alternative library that you could try: http://github.com/mhennemeyer/rwriteboard. I don't believe this calls out to system commands like mine, so you could be in luck.