geokit 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjliOWQ5MWNlMjNjZjE0MzgwYzg1MDgyMWEyNGM0Y2YzY2YzODU3MA==
4
+ MWVmODZiMjVhMTFlZjYwNGViY2EzYTBjNWQwMjMyNmE0MWRkMTMwZA==
5
5
  data.tar.gz: !binary |-
6
- YzdiYzM4NmYyYTViMzg0MmM4Nzg0NTM1NDI4YzdkMmI1MjM5NmYzMg==
6
+ YTc2ZmM1N2FkOGM0OTM3ODU1ZWE5ZjQ0NjAxMjdhMDRiM2NkZGY3NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmQyNGY3MDM4YTU5OGQ2OTUxMGE4YWFkMzU1ZmUzZTMzMWEzMTkzMjBmNzhj
10
- NTVmY2NmZThjNmJmMmQ5NjhhYTc1MDMyZTEwMWIwZjU0YTkyZGQyZTM2YWU0
11
- Y2FkZmUwNmQ5N2Y1ZmJhZDllODAzMTJhMGU0N2U0NTA4NjViZWQ=
9
+ Njg0YTQwYzRmMTIxZDhiYWVjMDJhZDI0M2UxNjYyNGNjZDc0NzI0NzNhMjcx
10
+ MTJkYjlhMmEyMzc3MDQwODIyZTIxOGE3NTkwOWVkOTgzMmU0YzgzYmU2ZDhi
11
+ Y2UwNDhhODM0NjkyODhjOGFjMTcwMTEyOTgxZDg1YjM4ZGYzN2Y=
12
12
  data.tar.gz: !binary |-
13
- ZDg4N2UwODIxOTFmOGY3NGIzZGVjZGNiZjEwNDA0ZTM1NDA0YjRkODE2ZThi
14
- Njk5NmZkOWUzZWIwZDJlMjcyZDMxYWVmMGUyNzVmNTQ3MmM5M2IzOWM5Y2Vh
15
- ODhjNDY1MjcwZDU5MjYxNWM4OThlZmViYjg2MzUyZmViYzQyY2Q=
13
+ OWYwOGNjZTRmYjJhODg0NzMxMWQ2MDg2Y2UyMGUxMGNlYzU2YmU0YzJjNTk3
14
+ YzdhM2JmMjYwMWIzZGU0ZWE3NDU0YWEyMWI3ZTQ2M2U4ZjRlNGE5NzEzY2M0
15
+ N2Y1NDNiMzA2NjZlOGM3MTg0ZDk5YTM3ZWI0YTQwZjQ4NjFlY2E=
@@ -1,3 +1,7 @@
1
+ ## 1.7.1
2
+
3
+ * Remove geoip require from MaxMind to avoid new dependency issues
4
+
1
5
  ## 1.7.0
2
6
 
3
7
  * Added Yahoo Boss, Yandex, RIPE and MaxMind Support
@@ -11,7 +11,7 @@ Geokit
11
11
 
12
12
  The Geokit gem provides:
13
13
 
14
- * Distance calculations between two points on the earth. Calculate the distance in miles, kilometers, or nautical miles, with all the trigonometry abstracted away by GeoKit.
14
+ * Distance calculations between two points on the earth. Calculate the distance in miles, kilometers, or nautical miles, with all the trigonometry abstracted away by Geokit.
15
15
  * Geocoding from multiple providers. It supports Google, Yahoo, Geocoder.us, and Geocoder.ca geocoders, and others. It provides a uniform response structure from all of them.
16
16
  It also provides a fail-over mechanism, in case your input fails to geocode in one service.
17
17
  * Rectangular bounds calculations: is a point within a given rectangular bounds?
@@ -24,6 +24,3 @@ path = File.expand_path(File.dirname(__FILE__))
24
24
  $:.unshift path unless $:.include?(path)
25
25
  require 'geokit/geocoders'
26
26
  require 'geokit/mappable'
27
-
28
- # make old-style module name "GeoKit" equivalent to new-style "Geokit"
29
- GeoKit=Geokit
@@ -136,10 +136,10 @@ module Geokit
136
136
  req = Net::HTTP::Get.new(url)
137
137
  req.basic_auth(uri.user, uri.password) if uri.userinfo
138
138
  res = Net::HTTP::new(uri.host, uri.port,
139
- GeoKit::Geocoders::proxy_addr,
140
- GeoKit::Geocoders::proxy_port,
141
- GeoKit::Geocoders::proxy_user,
142
- GeoKit::Geocoders::proxy_pass).start { |http| http.request(req) }
139
+ Geokit::Geocoders::proxy_addr,
140
+ Geokit::Geocoders::proxy_port,
141
+ Geokit::Geocoders::proxy_user,
142
+ Geokit::Geocoders::proxy_pass).start { |http| http.request(req) }
143
143
  return res
144
144
  end
145
145
 
@@ -16,7 +16,7 @@ module Geokit
16
16
  # Template method which does the geocode lookup.
17
17
  #
18
18
  # ==== EXAMPLES
19
- # ll=GeoKit::LatLng.new(40, -85)
19
+ # ll=Geokit::LatLng.new(40, -85)
20
20
  # Geokit::Geocoders::FCCGeocoder.geocode(ll) #
21
21
 
22
22
  # JSON result looks like this
@@ -13,8 +13,8 @@ module Geokit
13
13
  address_str.gsub!(/,/, " ")
14
14
  params = "/postalCodeSearch?placename=#{Geokit::Inflector::url_escape(address_str)}&maxRows=10"
15
15
 
16
- if(GeoKit::Geocoders::geonames)
17
- url = "http://ws.geonames.net#{params}&username=#{GeoKit::Geocoders::geonames}"
16
+ if(Geokit::Geocoders::geonames)
17
+ url = "http://ws.geonames.net#{params}&username=#{Geokit::Geocoders::geonames}"
18
18
  else
19
19
  url = "http://ws.geonames.org#{params}"
20
20
  end
@@ -1,5 +1,3 @@
1
- require "geoip"
2
-
3
1
  module Geokit
4
2
  module Geocoders
5
3
 
@@ -10,8 +10,8 @@ module Geokit
10
10
  address_str = address.is_a?(GeoLoc) ? address.to_geocodeable_s : address
11
11
 
12
12
  query = (address_str =~ /^\d{5}(?:-\d{4})?$/ ? "zip" : "address") + "=#{Geokit::Inflector::url_escape(address_str)}"
13
- url = if GeoKit::Geocoders::geocoder_us
14
- "http://#{GeoKit::Geocoders::geocoder_us}@geocoder.us/member/service/csv/geocode"
13
+ url = if Geokit::Geocoders::geocoder_us
14
+ "http://#{Geokit::Geocoders::geocoder_us}@geocoder.us/member/service/csv/geocode"
15
15
  else
16
16
  "http://geocoder.us/service/csv/geocode"
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module Geokit
2
- VERSION = '1.7.0'
2
+ VERSION = '1.7.1'
3
3
  end
@@ -29,8 +29,8 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
29
29
  success = MockSuccess.new
30
30
  success.expects(:body).returns(IP_SUCCESS)
31
31
  url = 'http://www.geoplugin.net/xml.gp?ip=200.150.38.66'
32
- GeoKit::Geocoders::GeoPluginGeocoder.expects(:call_geocoder_service).with(url).returns(success)
33
- location = GeoKit::Geocoders::GeoPluginGeocoder.geocode('200.150.38.66')
32
+ Geokit::Geocoders::GeoPluginGeocoder.expects(:call_geocoder_service).with(url).returns(success)
33
+ location = Geokit::Geocoders::GeoPluginGeocoder.geocode('200.150.38.66')
34
34
  assert_not_nil location
35
35
  assert_equal(-19.916700, location.lat)
36
36
  assert_equal(-43.933300, location.lng)
@@ -42,7 +42,7 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
42
42
  end
43
43
 
44
44
  def test_invalid_ip
45
- location = GeoKit::Geocoders::GeoPluginGeocoder.geocode("pixrum")
45
+ location = Geokit::Geocoders::GeoPluginGeocoder.geocode("pixrum")
46
46
  assert_not_nil location
47
47
  assert !location.success?
48
48
  end
@@ -50,8 +50,8 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
50
50
  def test_service_unavailable
51
51
  failure = MockFailure.new
52
52
  url = 'http://www.geoplugin.net/xml.gp?ip=10.10.10.10'
53
- GeoKit::Geocoders::GeoPluginGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
54
- location = GeoKit::Geocoders::GeoPluginGeocoder.geocode("10.10.10.10")
53
+ Geokit::Geocoders::GeoPluginGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
54
+ location = Geokit::Geocoders::GeoPluginGeocoder.geocode("10.10.10.10")
55
55
  assert_not_nil location
56
56
  assert !location.success?
57
57
  end
@@ -20,7 +20,7 @@ class InflectorTest < Test::Unit::TestCase #:nodoc: all
20
20
  end
21
21
 
22
22
  def test_url_escape
23
- assert_equal '%E4%B8%8A%E6%B5%B7%E5%B8%82%E5%BE%90%E6%B1%87%E5%8C%BA%E6%BC%95%E6%BA%AA%E5%8C%97%E8%B7%AF1111%E5%8F%B7', GeoKit::Inflector.url_escape('上海市徐汇区漕溪北路1111号')
23
+ assert_equal '%E4%B8%8A%E6%B5%B7%E5%B8%82%E5%BE%90%E6%B1%87%E5%8C%BA%E6%BC%95%E6%BA%AA%E5%8C%97%E8%B7%AF1111%E5%8F%B7', Geokit::Inflector.url_escape('上海市徐汇区漕溪北路1111号')
24
24
  assert_equal '%C3%BC%C3%B6%C3%A4', Geokit::Inflector.url_escape('üöä')
25
25
  end
26
26
  end
@@ -52,8 +52,8 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
52
52
  success = MockSuccess.new
53
53
  success.expects(:body).returns(IP_SUCCESS)
54
54
  url = 'http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true'
55
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(success)
56
- location = GeoKit::Geocoders::IpGeocoder.geocode('12.215.42.19')
55
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(success)
56
+ location = Geokit::Geocoders::IpGeocoder.geocode('12.215.42.19')
57
57
  assert_not_nil location
58
58
  assert_equal 41.7696, location.lat
59
59
  assert_equal(-88.4588, location.lng)
@@ -68,8 +68,8 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
68
68
  success = MockSuccess.new
69
69
  success.expects(:body).returns(IP_UNICODED)
70
70
  url = 'http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true'
71
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(success)
72
- location = GeoKit::Geocoders::IpGeocoder.geocode('12.215.42.19')
71
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(success)
72
+ location = Geokit::Geocoders::IpGeocoder.geocode('12.215.42.19')
73
73
  assert_not_nil location
74
74
  assert_equal 57.7167, location.lat
75
75
  assert_equal 12.9167, location.lng
@@ -85,8 +85,8 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
85
85
  success.stubs(:body).returns(IP_LATIN)
86
86
  success.stubs(:[]).with('content-type').returns('text/plain; charset=iso-8859-1')
87
87
  url = 'http://api.hostip.info/get_html.php?ip=201.23.177.144&position=true'
88
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(success)
89
- location = GeoKit::Geocoders::IpGeocoder.geocode('201.23.177.144')
88
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(success)
89
+ location = Geokit::Geocoders::IpGeocoder.geocode('201.23.177.144')
90
90
  assert_not_nil location
91
91
  assert_equal -20.8, location.lat
92
92
  assert_equal -49.3833, location.lng
@@ -101,24 +101,24 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
101
101
  failure = MockSuccess.new
102
102
  failure.expects(:body).returns(IP_FAILURE)
103
103
  url = 'http://api.hostip.info/get_html.php?ip=128.178.0.0&position=true'
104
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
105
- location = GeoKit::Geocoders::IpGeocoder.geocode("128.178.0.0")
104
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
105
+ location = Geokit::Geocoders::IpGeocoder.geocode("128.178.0.0")
106
106
  assert_not_nil location
107
107
  assert !location.success?
108
108
  end
109
109
 
110
110
  def test_private_ips
111
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).never
111
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).never
112
112
  PRIVATE_IPS_TO_TEST.each do |ip|
113
- location = GeoKit::Geocoders::IpGeocoder.geocode(ip)
113
+ location = Geokit::Geocoders::IpGeocoder.geocode(ip)
114
114
  assert_not_nil location
115
115
  assert !location.success?
116
116
  end
117
117
  end
118
118
 
119
119
  def test_invalid_ip
120
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).never
121
- location = GeoKit::Geocoders::IpGeocoder.geocode("blah")
120
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).never
121
+ location = Geokit::Geocoders::IpGeocoder.geocode("blah")
122
122
  assert_not_nil location
123
123
  assert !location.success?
124
124
  end
@@ -126,8 +126,8 @@ class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
126
126
  def test_service_unavailable
127
127
  failure = MockFailure.new
128
128
  url = 'http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true'
129
- GeoKit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
130
- location = GeoKit::Geocoders::IpGeocoder.geocode("12.215.42.19")
129
+ Geokit::Geocoders::IpGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
130
+ location = Geokit::Geocoders::IpGeocoder.geocode("12.215.42.19")
131
131
  assert_not_nil location
132
132
  assert !location.success?
133
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack, James Cox, Andre Lewis & Bill Eisenhauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-24 00:00:00.000000000 Z
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json