Skip to content
Browse files

ZERO_RESULTS error

  • Loading branch information...
1 parent f4d633e commit 8c04d3f1e5a88e0b1b01216c3fba552a51b888e7 Josh Crews committed
Showing with 12 additions and 5 deletions.
  1. +1 −1 Rakefile
  2. +2 −2 google_directions.gemspec
  3. +2 −2 lib/google_directions.rb
  4. +7 −0 test/unit/google_directions_test.rb
View
2 Rakefile
@@ -3,7 +3,7 @@ require 'rubygems'
require 'rake'
require 'echoe'
-Echoe.new('google_directions', '0.1.1') do |p|
+Echoe.new('google_directions', '0.1.2') do |p|
p.description = "Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places"
p.url = "http://github.com/joshcrews/Google-Directions-Ruby"
p.author = "Josh Crews"
View
4 google_directions.gemspec
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{google_directions}
- s.version = "0.1.1"
+ s.version = "0.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Josh Crews"]
- s.date = %q{2010-07-14}
+ s.date = %q{2010-07-15}
s.description = %q{Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places}
s.email = %q{josh@joshcrews.com}
s.extra_rdoc_files = ["README.textile", "lib/google_directions.rb"]
View
4 lib/google_directions.rb
@@ -31,7 +31,7 @@ def xml_call
end
def drive_time_in_minutes
- if @status == "NOT_FOUND" or @status == "OVER_QUERY_LIMIT"
+ if @status != "OK"
drive_time = 0
else
doc = Nokogiri::XML(@xml)
@@ -41,7 +41,7 @@ def drive_time_in_minutes
end
def distance_in_miles
- if @status == "NOT_FOUND" or @status == "OVER_QUERY_LIMIT"
+ if @status != "OK"
distance_in_miles = 0
else
doc = Nokogiri::XML(@xml)
View
7 test/unit/google_directions_test.rb
@@ -21,5 +21,12 @@ def test_directions_not_found
assert_equal("NOT_FOUND", directions.status)
end
+ def test_zero_results
+ directions = GoogleDirections.new("COMMUNITY SOUTH HOSPITAL 1402 EAST COUNTY LINE ROAD, 46227", "499 Gordonsville Highway, 38563")
+ assert_equal(0, directions.distance_in_miles)
+ assert_equal(0, directions.drive_time_in_minutes)
+ assert_equal("ZERO_RESULTS", directions.status)
+ end
+
end

0 comments on commit 8c04d3f

Please sign in to comment.
Something went wrong with that request. Please try again.