Articles tagged with api
Good news for the Brits: UK Geocoding Now Available in the Maps API. This means that the Google geocoder in Graticule should now work in the UK. I’m interested to hear how well it works from anyone using it.
Three Graticule related updates:
- I released Graticule 0.2.2 this evening to fix a bug in the Local Search Maps geocoder.
- There is a new homepage for Graticule and acts_as_geocodable over on RubyForge. Nothing fancy, but some basic docs with links to the RDoc
- I set up a mailing list for anyone interested in making Graticule better or needing help. Head over, sign up, and tell me why Graticule sucks (or rocks, or sucks rocks).
The single biggest request that I’ve gotten for Graticule and acts_as_geocodable has been for international support. So, for those outside the US (50% that read this blog according to google analytics), I have a present for you.
Last weekend I committed support for Local Search Maps (thanks to James Stewart), and PostcodeAnywhere, both of which have some international support, at least for Canada and Europe. I also added geocoder.ca.
Most of the international geocoding services seem to require a little more structured parameters, so with Graticule 0.2, all of the geocoders can take a hash (and some require it). As a result of gaining international support, the field names that Graticule uses have been changed to be more international-friendly: street, locality, region, postal_code, and country.
g = Graticule.service(:local_search_maps).new
location = g.locate :street => '48 Leicester Square', :locality => 'London', :country => 'UK'
location.coordinates #=> [51.510036, -0.130427]
Geocoding IP Addresses
Several people mentioned that they would rather use acts_as_geocodable, but chose to use GeoKit, another good geocoding library (but with a little different philosophy), because it had support for geocoding IP addresses. So, with a flick of the wrist and a twitch of the nose, Graticule now supports HostIP for geocoding IP addresses:
g = Graitucle.service(:host_ip).new
location = g.locate "64.233.167.99"
location.coordinates #=> [37.402, -122.078]
location.locality #=> "Mountain View"
location.country #=> "US"
location.region #=> "CA"
Along with this, acts_as_geocodable has a helper method, remote_location:
@nearest_store = Store.find(:nearest, :origin => remote_location) if remote_location
Be careful not to rely too heavily on remote_location because the location of many IP addresses cannot be determined through HostIP.
Feedback
I’m just an ignorant North-American, so I would love some feedback from people using Graticule and acts_as_geocodable outside the US.
Lawrence Oluyede has released Pinder, a Python port of Tinder. Very cool! We’ve been semi-conspiring to try to keep the feature set in sync. It would be cool if we could figure out how to standardize test cases, too.
I’ve committed a first pass at transcript support for Tinder. I don’t really have an immediate need for it, so I’d love to get some feedback on how useful it is, and if there’s other transcript features that are missing.
dates = room.available_transcripts
transcript = room.transcript(dates.first)
transcript.first
#=> {:message=>"foobar!", :user_id=>"99999", :person=>"Brandon", :id=>"18659245"}
Check out the source and let me know what you think.
Daniel Morrison pointed out to me this morning that Tinder has officially attained “unofficial” status from 37Signals.
From the Campfire site:

That’s pretty exciting. I’ll blog in a couple days with more details on the project that I wrote Tinder for.
Thanks Tero Parviainen, Tinder now has SSL support.
campfire = Tinder::Campfire.new("mydomain", :ssl => true)
campfire.login email, password
campfire.ssl?
#=> true
Now you can chat in private.
I just released an update to Tinder, the really unofficial Campfire API, that allows listening in on a room:
campfire = Tinder::Campfire.new 'mysubdomain'
campfire.login 'myemail@example.com', 'mypassword'
room = campfire.find_room_by_name 'Room 1'
messages = room.listen
#=> [{:person=>"Brandon", :message=>"I'm getting very sleepy", :user_id=>"148583", :id=>"16434003"}]
#listen takes an option block, which causes it to poll for new messages every 5 seconds and call the block for each message. It works great for heckling (ok, maybe that’s not the intent):
room.listen do |m|
room.speak "You're dumb!" if m[:person] == 'Brandon'
end
Check out my original post for more information about Tinder. Feedback and patches are welcome!
Thanks to Jesse Newland for the listening code.
update: Tinder can listen
update: Tinder is now available as a gem from rubyforge. Check out http://rubyforge.org/projects/tinder for more information.
For a project that I’m currently working, the client wants to be able provide live chat to its users. So, instead of re-inventing the wheel, we decided to try to use Campfire. The only problem is that I need to be able to create and destroy chat rooms automatically, and Campfire doesn’t have an API.
Caboo.se has done some work on a Campfire bot called Marshmallow but the code repository is unavailable. And, it doesn’t seem to allow you to create and delete rooms.
So, introducing Tinder, an API for interfacing with Campfire:
require 'rubygems'
require 'tinder'
campfire = Tinder::Campfire.new 'mysubdomain'
campfire.login 'myemail@example.com', 'mypassword'
room = campfire.create_room 'New Room', 'My new campfire room to test tinder'
room.speak 'Hello world!'
room.paste File.read("path/to/your/file.txt")
room.destroy
Install
gem install tinder
You can get the source from:
git clone git://github.com/collectiveidea/tinder.git
Tinder can also be installed as a gem or a rails plugin.
script/plugin install git://github.com/collectiveidea/tinder.git
Thanks to Zach Dennis for the name. Feedback and patches are welcome!

image courtesy of Tutorials.com
posted by brandon
| updated June 19th 07:27 PM