Talking to Plazes from Ruby

Peter Rukavina
The code described here has been moved into Subversion.

I’ve been experimenting with [[Ruby]] of late, and decided it would be good practice to try and code up a [[Plazes]] “Where Am I?” application to learn more about the languages ins and outs.

The result is PlazesWhereAmIRuby-0.2.tar.gz. This is my first Ruby script (or whatever they’re called), so I can’t claim that this is anywhere near Ruby best practices. But it works. To use the script:

  • Get Ruby (here’s a place to start). Mac OS X users (post-Jaguar) can skip this step; you already have Ruby installed by default.
  • Download PlazesWhereAmIRuby-0.2.tar.gz.
  • tar -xzvf PlazesWhereAmIRuby-0.2.tar.gz
  • Edit the file PlazesWhereAmIRuby.rb and replace the ‘username’ and ‘password’ with your Plazes username and password.
  • ruby PlazesWhereAmIRuby.rb

The result will be something like this:

{“plazestate”=>”Prince Edward Island”, “username”=>”reinvented”, “plazelat”=>46.2361, “plazelon”=>-63.13, “plazecity”=>”Charlottetown”, “plazename”=>”Reinvented Office”, “plazeurl”=>”http://beta.plazes.com/plaze/2dbbe7a819b01317eb2ce58272b95f70/”, “plazecountry”=>”CA”}

…which is simply a dump of the parameters returned from the Plazes server.

Update: I’ve created a more general-purpose module for Ruby that implements not only the WhereAmI API, but also the Launcher API.

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). You can subscribe to an RSS feed of posts, an RSS feed of comments, or receive a daily digests of posts by email.

Search