GoogleDistanceRuby

Ruby client for The Google Distance Matrix API.

Get the distance between two points with one line ruby command.

It is necessary to have a Google Distance Matrix API Key. If you don't have one you can get at https://code.google.com/apis/console.

Examples (one line command)

GoogleDistanceRuby.new("{your_key}").distance("Vinhedo/SP", "Campinas/SP")

returns {:origin=>"Vinhedo - São Paulo, Brazil", :destination=>"Campinas - São Paulo, Brazil", :distance=>24034}


GoogleDistanceRuby.new("{your_key}").distance("Miami-FL", "Orlando-FL")

returns {:origin=>"Miami, FL, USA", :destination=>"Orlando, FL, USA", :distance=>376515}

Installation

Add this line to your application's Gemfile:

gem 'google_distance_ruby'

And then execute:

$ bundle install

Or install it as:

$ gem install google_distance_ruby

Dependencies

Add to your Gemfile:

gem "httparty"