geocoder 1.1.8 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of geocoder might be problematic. Click here for more details.

Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +4 -0
  3. data/CHANGELOG.md +13 -1
  4. data/README.md +100 -30
  5. data/Rakefile +1 -1
  6. data/examples/autoexpire_cache_dalli.rb +2 -2
  7. data/examples/cache_bypass.rb +48 -0
  8. data/lib/geocoder/calculations.rb +38 -0
  9. data/lib/geocoder/cli.rb +8 -1
  10. data/lib/geocoder/lookup.rb +3 -0
  11. data/lib/geocoder/lookups/baidu.rb +54 -0
  12. data/lib/geocoder/lookups/base.rb +26 -11
  13. data/lib/geocoder/lookups/dstk.rb +20 -0
  14. data/lib/geocoder/lookups/freegeoip.rb +2 -6
  15. data/lib/geocoder/lookups/geocoder_us.rb +39 -0
  16. data/lib/geocoder/lookups/google.rb +5 -0
  17. data/lib/geocoder/lookups/mapquest.rb +21 -5
  18. data/lib/geocoder/lookups/maxmind.rb +1 -1
  19. data/lib/geocoder/lookups/nominatim.rb +0 -1
  20. data/lib/geocoder/lookups/ovi.rb +14 -4
  21. data/lib/geocoder/query.rb +5 -1
  22. data/lib/geocoder/results/baidu.rb +79 -0
  23. data/lib/geocoder/results/dstk.rb +6 -0
  24. data/lib/geocoder/results/geocoder_us.rb +39 -0
  25. data/lib/geocoder/results/yandex.rb +1 -1
  26. data/lib/geocoder/stores/active_record.rb +12 -6
  27. data/lib/geocoder/stores/mongo_base.rb +5 -2
  28. data/lib/geocoder/version.rb +1 -1
  29. data/lib/tasks/geocoder.rake +2 -0
  30. data/test/cache_test.rb +16 -0
  31. data/test/calculations_test.rb +31 -21
  32. data/test/fixtures/baidu_invalid_key +1 -0
  33. data/test/fixtures/baidu_no_results +1 -0
  34. data/test/fixtures/baidu_reverse +1 -0
  35. data/test/fixtures/baidu_shanghai_pearl_tower +12 -0
  36. data/test/fixtures/geocoder_us_madison_square_garden +1 -0
  37. data/test/fixtures/geocoder_us_no_results +1 -0
  38. data/test/fixtures/google_over_limit +4 -0
  39. data/test/fixtures/mapquest_error +16 -0
  40. data/test/fixtures/mapquest_invalid_api_key +16 -0
  41. data/test/fixtures/mapquest_invalid_request +16 -0
  42. data/test/fixtures/mapquest_no_results +10 -1
  43. data/test/mongoid_test.rb +7 -0
  44. data/test/near_test.rb +18 -0
  45. data/test/proxy_test.rb +13 -0
  46. data/test/query_test.rb +5 -0
  47. data/test/services_test.rb +75 -2
  48. data/test/test_helper.rb +16 -6
  49. metadata +24 -9
data/test/test_helper.rb CHANGED
@@ -119,6 +119,13 @@ module Geocoder
119
119
  end
120
120
  end
121
121
 
122
+ class Dstk
123
+ private
124
+ def fixture_prefix
125
+ "google"
126
+ end
127
+ end
128
+
122
129
  class Yandex
123
130
  private
124
131
  def default_fixture_filename
@@ -140,6 +147,15 @@ module Geocoder
140
147
  end
141
148
  end
142
149
 
150
+ class Baidu
151
+ private
152
+ def fixture_prefix
153
+ "baidu"
154
+ end
155
+ def default_fixture_filename
156
+ "baidu_shanghai_pearl_tower"
157
+ end
158
+ end
143
159
  end
144
160
  end
145
161
 
@@ -259,12 +275,6 @@ class Test::Unit::TestCase
259
275
  }[abbrev]
260
276
  end
261
277
 
262
- def is_nan_coordinates?(coordinates)
263
- return false unless coordinates.respond_to? :size # Should be an array
264
- return false unless coordinates.size == 2 # Should have dimension 2
265
- coordinates[0].nan? && coordinates[1].nan? # Both coordinates should be NaN
266
- end
267
-
268
278
  def set_api_key!(lookup_name)
269
279
  lookup = Geocoder::Lookup.get(lookup_name)
270
280
  if lookup.required_api_key_parts.size == 1
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
5
- prerelease:
4
+ version: 1.1.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alex Reisner
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Provides object geocoding (by street or IP address), reverse geocoding
15
14
  (coordinates to street address), distance queries for ActiveRecord and Mongoid,
@@ -31,6 +30,7 @@ files:
31
30
  - bin/geocode
32
31
  - examples/autoexpire_cache_dalli.rb
33
32
  - examples/autoexpire_cache_redis.rb
33
+ - examples/cache_bypass.rb
34
34
  - gemfiles/Gemfile.mongoid-2.4.x
35
35
  - lib/generators/geocoder/config/config_generator.rb
36
36
  - lib/generators/geocoder/config/templates/initializer.rb
@@ -42,11 +42,14 @@ files:
42
42
  - lib/geocoder/configuration_hash.rb
43
43
  - lib/geocoder/exceptions.rb
44
44
  - lib/geocoder/lookup.rb
45
+ - lib/geocoder/lookups/baidu.rb
45
46
  - lib/geocoder/lookups/base.rb
46
47
  - lib/geocoder/lookups/bing.rb
48
+ - lib/geocoder/lookups/dstk.rb
47
49
  - lib/geocoder/lookups/esri.rb
48
50
  - lib/geocoder/lookups/freegeoip.rb
49
51
  - lib/geocoder/lookups/geocoder_ca.rb
52
+ - lib/geocoder/lookups/geocoder_us.rb
50
53
  - lib/geocoder/lookups/google.rb
51
54
  - lib/geocoder/lookups/google_premier.rb
52
55
  - lib/geocoder/lookups/mapquest.rb
@@ -64,11 +67,14 @@ files:
64
67
  - lib/geocoder/query.rb
65
68
  - lib/geocoder/railtie.rb
66
69
  - lib/geocoder/request.rb
70
+ - lib/geocoder/results/baidu.rb
67
71
  - lib/geocoder/results/base.rb
68
72
  - lib/geocoder/results/bing.rb
73
+ - lib/geocoder/results/dstk.rb
69
74
  - lib/geocoder/results/esri.rb
70
75
  - lib/geocoder/results/freegeoip.rb
71
76
  - lib/geocoder/results/geocoder_ca.rb
77
+ - lib/geocoder/results/geocoder_us.rb
72
78
  - lib/geocoder/results/google.rb
73
79
  - lib/geocoder/results/google_premier.rb
74
80
  - lib/geocoder/results/mapquest.rb
@@ -94,6 +100,10 @@ files:
94
100
  - test/configuration_test.rb
95
101
  - test/custom_block_test.rb
96
102
  - test/error_handling_test.rb
103
+ - test/fixtures/baidu_invalid_key
104
+ - test/fixtures/baidu_no_results
105
+ - test/fixtures/baidu_reverse
106
+ - test/fixtures/baidu_shanghai_pearl_tower
97
107
  - test/fixtures/bing_invalid_key
98
108
  - test/fixtures/bing_madison_square_garden
99
109
  - test/fixtures/bing_no_results
@@ -106,11 +116,17 @@ files:
106
116
  - test/fixtures/geocoder_ca_madison_square_garden
107
117
  - test/fixtures/geocoder_ca_no_results
108
118
  - test/fixtures/geocoder_ca_reverse
119
+ - test/fixtures/geocoder_us_madison_square_garden
120
+ - test/fixtures/geocoder_us_no_results
109
121
  - test/fixtures/google_garbage
110
122
  - test/fixtures/google_madison_square_garden
111
123
  - test/fixtures/google_no_city_data
112
124
  - test/fixtures/google_no_locality
113
125
  - test/fixtures/google_no_results
126
+ - test/fixtures/google_over_limit
127
+ - test/fixtures/mapquest_error
128
+ - test/fixtures/mapquest_invalid_api_key
129
+ - test/fixtures/mapquest_invalid_request
114
130
  - test/fixtures/mapquest_madison_square_garden
115
131
  - test/fixtures/mapquest_no_results
116
132
  - test/fixtures/maxmind_24_24_24_21
@@ -151,26 +167,25 @@ files:
151
167
  - test/test_mode_test.rb
152
168
  homepage: http://www.rubygeocoder.com
153
169
  licenses: []
170
+ metadata: {}
154
171
  post_install_message:
155
172
  rdoc_options: []
156
173
  require_paths:
157
174
  - lib
158
175
  required_ruby_version: !ruby/object:Gem::Requirement
159
- none: false
160
176
  requirements:
161
- - - ! '>='
177
+ - - '>='
162
178
  - !ruby/object:Gem::Version
163
179
  version: '0'
164
180
  required_rubygems_version: !ruby/object:Gem::Requirement
165
- none: false
166
181
  requirements:
167
- - - ! '>='
182
+ - - '>='
168
183
  - !ruby/object:Gem::Version
169
184
  version: '0'
170
185
  requirements: []
171
186
  rubyforge_project:
172
- rubygems_version: 1.8.23
187
+ rubygems_version: 2.0.2
173
188
  signing_key:
174
- specification_version: 3
189
+ specification_version: 4
175
190
  summary: Complete geocoding solution for Ruby.
176
191
  test_files: []