geokit 1.6.7 → 1.7.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YmMyOTc1ZjczMWU1MzU3YzBjMDEzYzUzNGYxYzliNjYwOGVhNzdmNw==
5
+ data.tar.gz: !binary |-
6
+ NDBjNjIyMWY0YjRhMGVjNWJlZjA0YmI3Yzk4MDMzOWM2N2U4MWM0Ng==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MWE4NjBkMGU2N2U5NGFhYjZmNGUxMTA2NDQ3MDMxODEwYTliYmEwYWNhOWY0
10
+ ZDJmZTkzNDQ1Y2RkMjAzNzE4NGNkYzgwYjViY2YyMDZkYjhlYTllZjg4OGU0
11
+ YmNmZDQ2ZmVhZjMwMjgwYThlODA1MGJlMGRiMTcyYWI4YWEzYzU=
12
+ data.tar.gz: !binary |-
13
+ NmJmZGU0MTJiZDZlNzBiNzUwNzY3N2E4OTY3MzhiY2RhZTMyYzc3ZWQxODkw
14
+ NzRjNDdjYTgwMTY1OTg1MWI3MDNmYTIzZTI1YTA2YmRlOGNkYjhhZTlhYWMw
15
+ ODc5MjhmZDU5M2ZmMTcyMTQzYTliNzkzZDBiYWI3NzA1Nzg4MzA=
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in geokit.gemspec
4
4
  gemspec
5
+
6
+ gem 'coveralls', :require => false
data/README.markdown CHANGED
@@ -17,10 +17,11 @@ The Geokit gem provides:
17
17
  * Rectangular bounds calculations: is a point within a given rectangular bounds?
18
18
  * Heading and midpoint calculations
19
19
 
20
- Combine this gem with the [geokit-rails plugin](http://github.com/geokit/geokit-rails) to get location-based finders for your Rails app.
20
+ Combine this gem with the [geokit-rails plugin](http://github.com/imajes/geokit-rails) to get location-based finders for your Rails app.
21
21
 
22
- * Repository at Github: [http://github.com/geokit/geokit](http://github.com/geokit/geokit).
23
- * RDoc pages: [http://rdoc.info/github/geokit/geokit/master/frames](http://rdoc.info/github/geokit/geokit/master/frames)
22
+ * Geokit main site [http://rubygeokit.org/](http://rubygeokit.org).
23
+ * Repository at Github: [http://github.com/imajes/geokit](http://github.com/imajes/geokit).
24
+ * RDoc pages: [http://rdoc.info/github/imajes/geokit/master/frames](http://rdoc.info/github/imajes/geokit/master/frames)
24
25
  * Follow the Google Group for updates and discussion on Geokit: [http://groups.google.com/group/geokit](http://groups.google.com/group/geokit)
25
26
 
26
27
  ## INSTALL
@@ -125,7 +126,7 @@ If you're using this gem by itself, here are the configuration options:
125
126
  # Geokit::Geocoders::ip_provider_order = [:external,:geo_plugin,:ip]
126
127
  ```
127
128
 
128
- If you're using this gem with the [geokit-rails plugin](http://github.com/geokit/geokit-rails), the plugin
129
+ If you're using this gem with the [geokit-rails plugin](http://github.com/imajes/geokit-rails), the plugin
129
130
  creates a template with these settings and places it in `config/initializers/geokit_config.rb`.
130
131
 
131
132
  ## SUPPORTED GEOCODERS
data/Rakefile CHANGED
@@ -1,8 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require 'rake/testtask'
3
3
 
4
- task :default do
5
- end
4
+ task :default => :test
6
5
 
7
6
  Rake::TestTask.new do |t|
8
7
  t.libs << "test"
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'rubygems/command.rb'
3
+ require 'rubygems/dependency_installer.rb'
4
+ begin
5
+ Gem::Command.build_args = ARGV
6
+ rescue NoMethodError
7
+ end
8
+ inst = Gem::DependencyInstaller.new
9
+ begin
10
+ if RUBY_VERSION < "1.9"
11
+ inst.install "iconv"
12
+ end
13
+ rescue
14
+ exit(1)
15
+ end
data/geokit.gemspec CHANGED
@@ -10,12 +10,13 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["michael+geokit@noack.com.au"]
11
11
  spec.description = %q{Geokit provides geocoding and distance calculation in an easy-to-use API}
12
12
  spec.summary = %q{Geokit: encoding and distance calculation gem}
13
- spec.homepage = "http://github.com/geokit/geokit"
13
+ spec.homepage = "http://geokit.org"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.has_rdoc = true
17
17
  spec.rdoc_options = ["--main", "README.markdown"]
18
18
  spec.extra_rdoc_files = ["README.markdown"]
19
+ spec.extensions = 'ext/mkrf_conf.rb'
19
20
 
20
21
  spec.files = `git ls-files`.split($/)
21
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -28,5 +29,5 @@ Gem::Specification.new do |spec|
28
29
  spec.add_development_dependency "simplecov-rcov"
29
30
  spec.add_development_dependency 'rake'
30
31
  spec.add_development_dependency 'mocha'
31
- spec.add_development_dependency 'coveralls'
32
32
  end
33
+
@@ -237,6 +237,11 @@ module Geokit
237
237
  @lng=lng.to_f if lng
238
238
  end
239
239
 
240
+ def ll=(hash)
241
+ self.lat = hash['lat']
242
+ self.lng = hash['lng']
243
+ end
244
+
240
245
  # Returns the lat and lng attributes as a comma-separated string.
241
246
  def ll
242
247
  "#{lat},#{lng}"
@@ -10,7 +10,7 @@ module Geokit
10
10
  res = self.call_geocoder_service(submit_url)
11
11
  return GeoLoc.new unless (res.is_a?(Net::HTTPSuccess) || res.is_a?(Net::HTTPOK))
12
12
  json = res.body
13
- logger.debug "Google reverse-geocoding. LL: #{latlng}. Result: #{CGI.escape(json)}"
13
+ logger.debug "Google reverse-geocoding. LL: #{latlng}. Result: #{json}"
14
14
  return self.json2GeoLoc(json)
15
15
  end
16
16
 
@@ -48,7 +48,7 @@ module Geokit
48
48
  return GeoLoc.new if !res.is_a?(Net::HTTPSuccess)
49
49
 
50
50
  json = res.body
51
- logger.debug "Google geocoding. Address: #{address}. Result: #{CGI.escape(json)}"
51
+ logger.debug "Google geocoding. Address: #{address}. Result: #{json}"
52
52
 
53
53
  return self.json2GeoLoc(json, address)
54
54
  end
@@ -85,8 +85,7 @@ module Geokit
85
85
  "&region=#{bias.to_s.downcase}"
86
86
  when Bounds
87
87
  # viewport biasing
88
- url_escaped_string = Geokit::Inflector::url_escape("#{bias.sw.to_s}|#{bias.ne.to_s}")
89
- "&bounds=#{url_escaped_string}"
88
+ Geokit::Inflector::url_escape("&bounds=#{bias.sw.to_s}|#{bias.ne.to_s}")
90
89
  end
91
90
  end
92
91
 
@@ -181,17 +180,12 @@ module Geokit
181
180
  res.accuracy = 7
182
181
  end
183
182
 
184
- res.lat=addr['geometry']['location']['lat'].to_f
185
- res.lng=addr['geometry']['location']['lng'].to_f
186
-
187
- ne=Geokit::LatLng.new(
188
- addr['geometry']['viewport']['northeast']['lat'].to_f,
189
- addr['geometry']['viewport']['northeast']['lng'].to_f
190
- )
191
- sw=Geokit::LatLng.new(
192
- addr['geometry']['viewport']['southwest']['lat'].to_f,
193
- addr['geometry']['viewport']['southwest']['lng'].to_f
194
- )
183
+ res.ll = addr['geometry']['location']
184
+
185
+ ne = Geokit::LatLng.new
186
+ ne.ll = addr['geometry']['viewport']['northeast']
187
+ sw = Geokit::LatLng.new
188
+ sw.ll = addr['geometry']['viewport']['southwest']
195
189
  res.suggested_bounds = Geokit::Bounds.new(sw,ne)
196
190
 
197
191
  res
@@ -57,7 +57,7 @@ module Geokit
57
57
  res = GeoLoc.new
58
58
  res.provider = 'hostip'
59
59
  res.city, res.state = yaml['City'].split(', ')
60
- res.country, res.country_code = yaml['Country'].split(' (')
60
+ country, res.country_code = yaml['Country'].split(' (')
61
61
  res.lat = yaml['Latitude']
62
62
  res.lng = yaml['Longitude']
63
63
  res.country_code.chop!
@@ -1,3 +1,3 @@
1
1
  module Geokit
2
- VERSION = '1.6.7'
2
+ VERSION = '1.7.0.rc1'
3
3
  end
data/test/helper.rb CHANGED
@@ -16,6 +16,7 @@ if ENV['COVERAGE']
16
16
  Coveralls.wear!
17
17
 
18
18
  SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
19
+ SimpleCov.start
19
20
  SimpleCov.start do
20
21
  add_filter '/test/'
21
22
  add_group 'lib', 'lib'
@@ -504,16 +504,6 @@ class GoogleGeocoder3Test < BaseGeocoderTest #:nodoc: all
504
504
  assert_equal Geokit::Bounds.new(Geokit::LatLng.new(37.7908019197085, -122.3953489802915), Geokit::LatLng.new(37.7934998802915, -122.3926510197085)), res.suggested_bounds
505
505
  end
506
506
 
507
- def test_google3_suggested_bounds_url
508
- bounds = Geokit::Bounds.new(
509
- Geokit::LatLng.new(33.7036917, -118.6681759),
510
- Geokit::LatLng.new(34.3373061, -118.1552891)
511
- )
512
- url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=Winnetka&bounds=33.7036917%2C-118.6681759%7C34.3373061%2C-118.1552891"
513
- Geokit::Geocoders::GoogleGeocoder3.expects(:call_geocoder_service).with(url)
514
- Geokit::Geocoders::GoogleGeocoder3.geocode('Winnetka', :bias => bounds)
515
- end
516
-
517
507
  def test_service_unavailable
518
508
  response = MockFailure.new
519
509
  url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}"
metadata CHANGED
@@ -1,133 +1,109 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: geokit
3
- version: !ruby/object:Gem::Version
4
- hash: 1
5
- prerelease:
6
- segments:
7
- - 1
8
- - 6
9
- - 7
10
- version: 1.6.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.0.rc1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Michael Noack, James Cox, Andre Lewis & Bill Eisenhauer
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-09-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 31
27
- segments:
28
- - 1
29
- - 3
30
- - 2
31
- version: 1.3.2
11
+ date: 2013-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
32
14
  name: multi_json
33
- prerelease: false
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.2
34
20
  type: :runtime
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ">"
41
- - !ruby/object:Gem::Version
42
- hash: 15
43
- segments:
44
- - 1
45
- - 0
46
- version: "1.0"
47
- name: bundler
48
21
  prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>'
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
49
34
  type: :development
50
- requirement: *id002
51
- - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
61
- name: simplecov
62
35
  prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>'
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
63
48
  type: :development
64
- requirement: *id003
65
- - !ruby/object:Gem::Dependency
66
- version_requirements: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
75
- name: simplecov-rcov
76
49
  prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov-rcov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
77
62
  type: :development
78
- requirement: *id004
79
- - !ruby/object:Gem::Dependency
80
- version_requirements: &id005 !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- name: rake
90
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
91
76
  type: :development
92
- requirement: *id005
93
- - !ruby/object:Gem::Dependency
94
- version_requirements: &id006 !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
103
- name: mocha
104
77
  prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mocha
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
105
90
  type: :development
106
- requirement: *id006
107
- - !ruby/object:Gem::Dependency
108
- version_requirements: &id007 !ruby/object:Gem::Requirement
109
- none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
117
- name: coveralls
118
91
  prerelease: false
119
- type: :development
120
- requirement: *id007
121
- description: Geokit provides geocoding and distance calculation in an easy-to-use API
122
- email:
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Geokit provides geocoding and distance calculation in an easy-to-use
98
+ API
99
+ email:
123
100
  - michael+geokit@noack.com.au
124
101
  executables: []
125
-
126
- extensions: []
127
-
128
- extra_rdoc_files:
102
+ extensions:
103
+ - ext/mkrf_conf.rb
104
+ extra_rdoc_files:
129
105
  - README.markdown
130
- files:
106
+ files:
131
107
  - .gitignore
132
108
  - .travis.yml
133
109
  - CHANGELOG.md
@@ -136,6 +112,7 @@ files:
136
112
  - Manifest.txt
137
113
  - README.markdown
138
114
  - Rakefile
115
+ - ext/mkrf_conf.rb
139
116
  - geokit.gemspec
140
117
  - lib/geokit.rb
141
118
  - lib/geokit/geocoders.rb
@@ -171,41 +148,33 @@ files:
171
148
  - test/test_polygon_contains.rb
172
149
  - test/test_us_geocoder.rb
173
150
  - test/test_yahoo_geocoder.rb
174
- homepage: http://github.com/geokit/geokit
175
- licenses:
151
+ homepage: http://geokit.org
152
+ licenses:
176
153
  - MIT
154
+ metadata: {}
177
155
  post_install_message:
178
- rdoc_options:
156
+ rdoc_options:
179
157
  - --main
180
158
  - README.markdown
181
- require_paths:
159
+ require_paths:
182
160
  - lib
183
- required_ruby_version: !ruby/object:Gem::Requirement
184
- none: false
185
- requirements:
186
- - - ">="
187
- - !ruby/object:Gem::Version
188
- hash: 3
189
- segments:
190
- - 0
191
- version: "0"
192
- required_rubygems_version: !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ! '>'
169
+ - !ruby/object:Gem::Version
170
+ version: 1.3.1
201
171
  requirements: []
202
-
203
172
  rubyforge_project:
204
- rubygems_version: 1.8.25
173
+ rubygems_version: 2.0.3
205
174
  signing_key:
206
- specification_version: 3
207
- summary: "Geokit: encoding and distance calculation gem"
208
- test_files:
175
+ specification_version: 4
176
+ summary: ! 'Geokit: encoding and distance calculation gem'
177
+ test_files:
209
178
  - test/helper.rb
210
179
  - test/test_base_geocoder.rb
211
180
  - test/test_bounds.rb