geokit 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/geokit.gemspec +1 -1
- data/lib/geokit.rb +1 -1
- data/lib/geokit/geocoders.rb +1 -1
- data/test/test_multi_geocoder.rb +10 -0
- metadata +2 -2
data/History.txt
CHANGED
data/geokit.gemspec
CHANGED
data/lib/geokit.rb
CHANGED
data/lib/geokit/geocoders.rb
CHANGED
@@ -564,7 +564,7 @@ module Geokit
|
|
564
564
|
# The failover approach is crucial for production-grade apps, but is rarely used.
|
565
565
|
# 98% of your geocoding calls will be successful with the first call
|
566
566
|
def self.do_geocode(address)
|
567
|
-
geocode_ip =
|
567
|
+
geocode_ip = /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/.match(address)
|
568
568
|
provider_order = geocode_ip ? Geokit::Geocoders::ip_provider_order : Geokit::Geocoders::provider_order
|
569
569
|
|
570
570
|
provider_order.each do |provider|
|
data/test/test_multi_geocoder.rb
CHANGED
@@ -41,4 +41,14 @@ class MultiGeocoderTest < BaseGeocoderTest #:nodoc: all
|
|
41
41
|
Geokit::Geocoders.provider_order = temp
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_blank_address
|
45
|
+
t1, t2 = Geokit::Geocoders.provider_order, Geokit::Geocoders.ip_provider_order # will need to reset after
|
46
|
+
Geokit::Geocoders.provider_order = [:google]
|
47
|
+
Geokit::Geocoders.ip_provider_order = [:geo_plugin]
|
48
|
+
Geokit::Geocoders::GoogleGeocoder.expects(:geocode).with("").returns(@failure)
|
49
|
+
Geokit::Geocoders::GeoPluginGeocoder.expects(:geocode).never
|
50
|
+
assert_equal @failure, Geokit::Geocoders::MultiGeocoder.geocode("")
|
51
|
+
Geokit::Geocoders.provider_order, Geokit::Geocoders.ip_provider_order = t1, t2 # reset to orig values
|
52
|
+
end
|
53
|
+
|
44
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andre Lewis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|