Introducing the google_map_directions gem

require 'google_map_directions'

directions = GoogleMapDirections::Directions.new('Soda Hall Berkeley CA', 'Foothill Berkeley CA')

directions.status
#=> "OK" 

directions.path_length
#=> 1 

# Returns the number of steps in the routes

step1 = directions.step(0)

    => #<GoogleMapDirections::Step:0x08496f94 @distance={"text"=>"0.2 mi", "value"=>244}, @duration={"text"=>"1 min", "value"=>56}, @end_location={"lat"=>37.8756405, "lng"=>-122.255948}, @start_location={"lat"=>37.87528229999999, "lng"=>-122.2586908}, @number=0, @HTML_instructions="Head <b>east</b> on <b>Hearst Ave</b> toward <b>Leroy Ave</b><div style=\"font-size:0.9em\">Destination will be on the right</div>

Resources