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 CHANGED
@@ -1,3 +1,6 @@
1
+ === 1.3.2 / 2009-05-27
2
+ * Fixed blank address geocoding bug
3
+
1
4
  === 1.3.1 / 2009-05-21
2
5
  * Support for External geocoders file (thanks dreamcat4)
3
6
  * Support multiple ip geocoders, including new setting for ip_provider_order (thanks dreamcat4)
data/geokit.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{geokit}
5
- s.version = "1.3.1"
5
+ s.version = "1.3.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andre Lewis and Bill Eisenhauer"]
data/lib/geokit.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Geokit
2
- VERSION = '1.3.1'
2
+ VERSION = '1.3.2'
3
3
  # These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable
4
4
  @@default_units = :miles
5
5
  @@default_formula = :sphere
@@ -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 = !!/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})?$/.match(address)
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|
@@ -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.1
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-22 00:00:00 -07:00
12
+ date: 2009-05-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency