google_directions 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/google_directions.gemspec +2 -2
- data/lib/google_directions.rb +2 -2
- data/test/unit/google_directions_test.rb +7 -0
- metadata +4 -4
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'rake'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new('google_directions', '0.1.
|
6
|
+
Echoe.new('google_directions', '0.1.3') do |p|
|
7
7
|
p.description = "Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places"
|
8
8
|
p.url = "http://github.com/joshcrews/Google-Directions-Ruby"
|
9
9
|
p.author = "Josh Crews"
|
data/google_directions.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{google_directions}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Josh Crews"]
|
9
|
-
s.date = %q{2010-07-
|
9
|
+
s.date = %q{2010-07-20}
|
10
10
|
s.description = %q{Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places}
|
11
11
|
s.email = %q{josh@joshcrews.com}
|
12
12
|
s.extra_rdoc_files = ["README.textile", "lib/google_directions.rb"]
|
data/lib/google_directions.rb
CHANGED
@@ -31,7 +31,7 @@ class GoogleDirections
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def drive_time_in_minutes
|
34
|
-
if @status
|
34
|
+
if @status != "OK"
|
35
35
|
drive_time = 0
|
36
36
|
else
|
37
37
|
doc = Nokogiri::XML(@xml)
|
@@ -41,7 +41,7 @@ class GoogleDirections
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def distance_in_miles
|
44
|
-
if @status
|
44
|
+
if @status != "OK"
|
45
45
|
distance_in_miles = 0
|
46
46
|
else
|
47
47
|
doc = Nokogiri::XML(@xml)
|
@@ -21,5 +21,12 @@ class GoogleDirectionsTest < Test::Unit::TestCase
|
|
21
21
|
assert_equal("NOT_FOUND", directions.status)
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_zero_results
|
25
|
+
directions = GoogleDirections.new("COMMUNITY SOUTH HOSPITAL 1402 EAST COUNTY LINE ROAD, 46227", "499 Gordonsville Highway, 38563")
|
26
|
+
assert_equal(0, directions.distance_in_miles)
|
27
|
+
assert_equal(0, directions.drive_time_in_minutes)
|
28
|
+
assert_equal("ZERO_RESULTS", directions.status)
|
29
|
+
end
|
30
|
+
|
24
31
|
|
25
32
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_directions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Crews
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-20 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|