geocoder 1.2.6 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +266 -1
- data/LICENSE +1 -1
- data/README.md +530 -804
- data/bin/console +13 -0
- data/examples/app_defined_lookup_services.rb +22 -0
- data/examples/reverse_geocode_job.rb +40 -0
- data/lib/easting_northing.rb +171 -0
- data/lib/generators/geocoder/config/templates/initializer.rb +22 -16
- data/lib/generators/geocoder/maxmind/geolite_city_generator.rb +2 -0
- data/lib/generators/geocoder/maxmind/geolite_country_generator.rb +2 -0
- data/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb +1 -1
- data/lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb +1 -1
- data/lib/generators/geocoder/migration_version.rb +15 -0
- data/lib/geocoder/cache.rb +20 -33
- data/lib/geocoder/cache_stores/base.rb +40 -0
- data/lib/geocoder/cache_stores/generic.rb +35 -0
- data/lib/geocoder/cache_stores/redis.rb +34 -0
- data/lib/geocoder/calculations.rb +30 -38
- data/lib/geocoder/cli.rb +2 -2
- data/lib/geocoder/configuration.rb +36 -9
- data/lib/geocoder/configuration_hash.rb +4 -4
- data/lib/geocoder/esri_token.rb +38 -0
- data/lib/geocoder/exceptions.rb +19 -0
- data/lib/geocoder/ip_address.rb +26 -11
- data/lib/geocoder/kernel_logger.rb +25 -0
- data/lib/geocoder/logger.rb +47 -0
- data/lib/geocoder/lookup.rb +63 -13
- data/lib/geocoder/lookups/abstract_api.rb +46 -0
- data/lib/geocoder/lookups/amap.rb +63 -0
- data/lib/geocoder/lookups/amazon_location_service.rb +55 -0
- data/lib/geocoder/lookups/baidu.rb +17 -9
- data/lib/geocoder/lookups/baidu_ip.rb +7 -31
- data/lib/geocoder/lookups/ban_data_gouv_fr.rb +143 -0
- data/lib/geocoder/lookups/base.rb +75 -26
- data/lib/geocoder/lookups/bing.rb +38 -15
- data/lib/geocoder/lookups/db_ip_com.rb +52 -0
- data/lib/geocoder/lookups/dstk.rb +4 -2
- data/lib/geocoder/lookups/esri.rb +78 -12
- data/lib/geocoder/lookups/freegeoip.rb +22 -7
- data/lib/geocoder/lookups/geoapify.rb +78 -0
- data/lib/geocoder/lookups/geocoder_ca.rb +5 -6
- data/lib/geocoder/lookups/geocodio.rb +8 -8
- data/lib/geocoder/lookups/geoip2.rb +13 -4
- data/lib/geocoder/lookups/geoportail_lu.rb +65 -0
- data/lib/geocoder/lookups/google.rb +44 -11
- data/lib/geocoder/lookups/google_places_details.rb +31 -17
- data/lib/geocoder/lookups/google_places_search.rb +76 -0
- data/lib/geocoder/lookups/google_premier.rb +15 -1
- data/lib/geocoder/lookups/here.rb +38 -27
- data/lib/geocoder/lookups/ip2location.rb +71 -0
- data/lib/geocoder/lookups/ipapi_com.rb +82 -0
- data/lib/geocoder/lookups/ipbase.rb +49 -0
- data/lib/geocoder/lookups/ipdata_co.rb +62 -0
- data/lib/geocoder/lookups/ipgeolocation.rb +51 -0
- data/lib/geocoder/lookups/ipinfo_io.rb +44 -0
- data/lib/geocoder/lookups/ipqualityscore.rb +50 -0
- data/lib/geocoder/lookups/ipregistry.rb +68 -0
- data/lib/geocoder/lookups/ipstack.rb +63 -0
- data/lib/geocoder/lookups/latlon.rb +58 -0
- data/lib/geocoder/lookups/location_iq.rb +54 -0
- data/lib/geocoder/lookups/mapbox.rb +59 -0
- data/lib/geocoder/lookups/mapquest.rb +7 -9
- data/lib/geocoder/lookups/maxmind.rb +7 -7
- data/lib/geocoder/lookups/maxmind_geoip2.rb +70 -0
- data/lib/geocoder/lookups/maxmind_local.rb +16 -3
- data/lib/geocoder/lookups/melissa_street.rb +41 -0
- data/lib/geocoder/lookups/nationaal_georegister_nl.rb +38 -0
- data/lib/geocoder/lookups/nominatim.rb +18 -6
- data/lib/geocoder/lookups/opencagedata.rb +16 -9
- data/lib/geocoder/lookups/osmnames.rb +57 -0
- data/lib/geocoder/lookups/pc_miler.rb +85 -0
- data/lib/geocoder/lookups/pelias.rb +63 -0
- data/lib/geocoder/lookups/photon.rb +89 -0
- data/lib/geocoder/lookups/pickpoint.rb +41 -0
- data/lib/geocoder/lookups/pointpin.rb +14 -13
- data/lib/geocoder/lookups/postcode_anywhere_uk.rb +7 -8
- data/lib/geocoder/lookups/postcodes_io.rb +31 -0
- data/lib/geocoder/lookups/smarty_streets.rb +29 -6
- data/lib/geocoder/lookups/telize.rb +42 -7
- data/lib/geocoder/lookups/tencent.rb +59 -0
- data/lib/geocoder/lookups/test.rb +5 -0
- data/lib/geocoder/lookups/twogis.rb +58 -0
- data/lib/geocoder/lookups/uk_ordnance_survey_names.rb +59 -0
- data/lib/geocoder/lookups/yandex.rb +20 -13
- data/lib/geocoder/models/active_record.rb +4 -3
- data/lib/geocoder/models/mongo_base.rb +0 -2
- data/lib/geocoder/query.rb +15 -1
- data/lib/geocoder/railtie.rb +1 -1
- data/lib/geocoder/request.rb +103 -14
- data/lib/geocoder/results/abstract_api.rb +146 -0
- data/lib/geocoder/results/amap.rb +87 -0
- data/lib/geocoder/results/amazon_location_service.rb +57 -0
- data/lib/geocoder/results/baidu.rb +10 -14
- data/lib/geocoder/results/ban_data_gouv_fr.rb +282 -0
- data/lib/geocoder/results/base.rb +13 -1
- data/lib/geocoder/results/bing.rb +5 -1
- data/lib/geocoder/results/db_ip_com.rb +58 -0
- data/lib/geocoder/results/esri.rb +35 -8
- data/lib/geocoder/results/freegeoip.rb +2 -7
- data/lib/geocoder/results/geoapify.rb +179 -0
- data/lib/geocoder/results/geocoder_ca.rb +3 -3
- data/lib/geocoder/results/geocodio.rb +15 -3
- data/lib/geocoder/results/geoip2.rb +37 -25
- data/lib/geocoder/results/geoportail_lu.rb +71 -0
- data/lib/geocoder/results/google.rb +26 -0
- data/lib/geocoder/results/google_places_details.rb +4 -0
- data/lib/geocoder/results/google_places_search.rb +52 -0
- data/lib/geocoder/results/here.rb +30 -15
- data/lib/geocoder/results/ip2location.rb +22 -0
- data/lib/geocoder/results/ipapi_com.rb +45 -0
- data/lib/geocoder/results/ipbase.rb +40 -0
- data/lib/geocoder/results/ipdata_co.rb +40 -0
- data/lib/geocoder/results/ipgeolocation.rb +59 -0
- data/lib/geocoder/results/ipinfo_io.rb +48 -0
- data/lib/geocoder/results/ipqualityscore.rb +54 -0
- data/lib/geocoder/results/ipregistry.rb +304 -0
- data/lib/geocoder/results/ipstack.rb +60 -0
- data/lib/geocoder/results/latlon.rb +71 -0
- data/lib/geocoder/results/location_iq.rb +6 -0
- data/lib/geocoder/results/mapbox.rb +63 -0
- data/lib/geocoder/results/mapquest.rb +5 -8
- data/lib/geocoder/results/maxmind.rb +0 -5
- data/lib/geocoder/results/maxmind_geoip2.rb +9 -0
- data/lib/geocoder/results/maxmind_local.rb +0 -5
- data/lib/geocoder/results/melissa_street.rb +46 -0
- data/lib/geocoder/results/nationaal_georegister_nl.rb +62 -0
- data/lib/geocoder/results/nominatim.rb +41 -14
- data/lib/geocoder/results/opencagedata.rb +20 -2
- data/lib/geocoder/results/osmnames.rb +56 -0
- data/lib/geocoder/results/pc_miler.rb +98 -0
- data/lib/geocoder/results/pelias.rb +58 -0
- data/lib/geocoder/results/photon.rb +119 -0
- data/lib/geocoder/results/pickpoint.rb +6 -0
- data/lib/geocoder/results/pointpin.rb +0 -4
- data/lib/geocoder/results/postcodes_io.rb +40 -0
- data/lib/geocoder/results/smarty_streets.rb +55 -19
- data/lib/geocoder/results/telize.rb +0 -5
- data/lib/geocoder/results/tencent.rb +72 -0
- data/lib/geocoder/results/test.rb +1 -1
- data/lib/geocoder/results/twogis.rb +76 -0
- data/lib/geocoder/results/uk_ordnance_survey_names.rb +59 -0
- data/lib/geocoder/results/yandex.rb +240 -32
- data/lib/geocoder/sql.rb +9 -6
- data/lib/geocoder/stores/active_record.rb +49 -10
- data/lib/geocoder/stores/base.rb +2 -14
- data/lib/geocoder/stores/mongo_base.rb +0 -31
- data/lib/geocoder/util.rb +29 -0
- data/lib/geocoder/version.rb +1 -1
- data/lib/geocoder.rb +2 -1
- data/lib/maxmind_database.rb +9 -9
- data/lib/tasks/geocoder.rake +29 -4
- data/lib/tasks/maxmind.rake +1 -1
- metadata +91 -169
- data/.gitignore +0 -6
- data/.travis.yml +0 -31
- data/Rakefile +0 -25
- data/examples/autoexpire_cache_dalli.rb +0 -62
- data/examples/autoexpire_cache_redis.rb +0 -28
- data/gemfiles/Gemfile.mongoid-2.4.x +0 -16
- data/lib/geocoder/lookups/geocoder_us.rb +0 -39
- data/lib/geocoder/lookups/okf.rb +0 -43
- data/lib/geocoder/lookups/ovi.rb +0 -62
- data/lib/geocoder/lookups/yahoo.rb +0 -88
- data/lib/geocoder/results/geocoder_us.rb +0 -39
- data/lib/geocoder/results/okf.rb +0 -106
- data/lib/geocoder/results/ovi.rb +0 -62
- data/lib/geocoder/results/yahoo.rb +0 -55
- data/lib/hash_recursive_merge.rb +0 -74
- data/lib/oauth_util.rb +0 -112
- data/test/fixtures/baidu_invalid_key +0 -1
- data/test/fixtures/baidu_ip_202_198_16_3 +0 -19
- data/test/fixtures/baidu_ip_invalid_key +0 -1
- data/test/fixtures/baidu_ip_no_results +0 -1
- data/test/fixtures/baidu_no_results +0 -1
- data/test/fixtures/baidu_reverse +0 -1
- data/test/fixtures/baidu_shanghai_pearl_tower +0 -12
- data/test/fixtures/bing_invalid_key +0 -1
- data/test/fixtures/bing_madison_square_garden +0 -40
- data/test/fixtures/bing_no_results +0 -16
- data/test/fixtures/bing_reverse +0 -42
- data/test/fixtures/cloudmade_invalid_key +0 -1
- data/test/fixtures/cloudmade_madison_square_garden +0 -1
- data/test/fixtures/cloudmade_no_results +0 -1
- data/test/fixtures/esri_madison_square_garden +0 -59
- data/test/fixtures/esri_no_results +0 -8
- data/test/fixtures/esri_reverse +0 -21
- data/test/fixtures/freegeoip_74_200_247_59 +0 -12
- data/test/fixtures/freegeoip_no_results +0 -1
- data/test/fixtures/geocoder_ca_madison_square_garden +0 -1
- data/test/fixtures/geocoder_ca_no_results +0 -1
- data/test/fixtures/geocoder_ca_reverse +0 -34
- data/test/fixtures/geocoder_us_madison_square_garden +0 -1
- data/test/fixtures/geocoder_us_no_results +0 -1
- data/test/fixtures/geocodio_1101_pennsylvania_ave +0 -1
- data/test/fixtures/geocodio_bad_api_key +0 -3
- data/test/fixtures/geocodio_invalid +0 -4
- data/test/fixtures/geocodio_no_results +0 -1
- data/test/fixtures/geocodio_over_query_limit +0 -4
- data/test/fixtures/google_garbage +0 -456
- data/test/fixtures/google_madison_square_garden +0 -57
- data/test/fixtures/google_no_city_data +0 -44
- data/test/fixtures/google_no_locality +0 -51
- data/test/fixtures/google_no_results +0 -4
- data/test/fixtures/google_over_limit +0 -4
- data/test/fixtures/google_places_details_invalid_request +0 -4
- data/test/fixtures/google_places_details_madison_square_garden +0 -120
- data/test/fixtures/google_places_details_no_results +0 -4
- data/test/fixtures/google_places_details_no_reviews +0 -60
- data/test/fixtures/google_places_details_no_types +0 -66
- data/test/fixtures/here_madison_square_garden +0 -72
- data/test/fixtures/here_no_results +0 -8
- data/test/fixtures/mapquest_error +0 -16
- data/test/fixtures/mapquest_invalid_api_key +0 -16
- data/test/fixtures/mapquest_invalid_request +0 -16
- data/test/fixtures/mapquest_madison_square_garden +0 -52
- data/test/fixtures/mapquest_no_results +0 -16
- data/test/fixtures/maxmind_24_24_24_21 +0 -1
- data/test/fixtures/maxmind_24_24_24_22 +0 -1
- data/test/fixtures/maxmind_24_24_24_23 +0 -1
- data/test/fixtures/maxmind_24_24_24_24 +0 -1
- data/test/fixtures/maxmind_74_200_247_59 +0 -1
- data/test/fixtures/maxmind_invalid_key +0 -1
- data/test/fixtures/maxmind_no_results +0 -1
- data/test/fixtures/nominatim_madison_square_garden +0 -150
- data/test/fixtures/nominatim_no_results +0 -1
- data/test/fixtures/nominatim_over_limit +0 -1
- data/test/fixtures/okf_kirstinmaki +0 -67
- data/test/fixtures/okf_no_results +0 -4
- data/test/fixtures/opencagedata_invalid_api_key +0 -25
- data/test/fixtures/opencagedata_invalid_request +0 -26
- data/test/fixtures/opencagedata_madison_square_garden +0 -73
- data/test/fixtures/opencagedata_no_results +0 -29
- data/test/fixtures/opencagedata_over_limit +0 -31
- data/test/fixtures/ovi_madison_square_garden +0 -72
- data/test/fixtures/ovi_no_results +0 -8
- data/test/fixtures/pointpin_10_10_10_10 +0 -1
- data/test/fixtures/pointpin_555_555_555_555 +0 -1
- data/test/fixtures/pointpin_80_111_555_555 +0 -1
- data/test/fixtures/pointpin_no_results +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_WR26NJ +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_generic_error +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_hampshire +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_key_limit_exceeded +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_no_results +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_romsey +0 -1
- data/test/fixtures/postcode_anywhere_uk_geocode_v2_00_unknown_key +0 -1
- data/test/fixtures/smarty_streets_11211 +0 -1
- data/test/fixtures/smarty_streets_madison_square_garden +0 -47
- data/test/fixtures/smarty_streets_no_results +0 -1
- data/test/fixtures/telize_10_10_10_10 +0 -1
- data/test/fixtures/telize_555_555_555_555 +0 -4
- data/test/fixtures/telize_74_200_247_59 +0 -1
- data/test/fixtures/telize_no_results +0 -1
- data/test/fixtures/yahoo_error +0 -1
- data/test/fixtures/yahoo_invalid_key +0 -2
- data/test/fixtures/yahoo_madison_square_garden +0 -52
- data/test/fixtures/yahoo_no_results +0 -10
- data/test/fixtures/yahoo_over_limit +0 -2
- data/test/fixtures/yandex_canada_rue_dupuis_14 +0 -446
- data/test/fixtures/yandex_invalid_key +0 -1
- data/test/fixtures/yandex_kremlin +0 -48
- data/test/fixtures/yandex_new_york +0 -1
- data/test/fixtures/yandex_no_city_and_town +0 -112
- data/test/fixtures/yandex_no_results +0 -16
- data/test/integration/http_client_test.rb +0 -31
- data/test/mongoid_test_helper.rb +0 -43
- data/test/test_helper.rb +0 -416
- data/test/unit/active_record_test.rb +0 -16
- data/test/unit/cache_test.rb +0 -37
- data/test/unit/calculations_test.rb +0 -220
- data/test/unit/configuration_test.rb +0 -55
- data/test/unit/error_handling_test.rb +0 -56
- data/test/unit/geocoder_test.rb +0 -78
- data/test/unit/https_test.rb +0 -17
- data/test/unit/ip_address_test.rb +0 -27
- data/test/unit/lookup_test.rb +0 -153
- data/test/unit/lookups/bing_test.rb +0 -68
- data/test/unit/lookups/dstk_test.rb +0 -26
- data/test/unit/lookups/esri_test.rb +0 -48
- data/test/unit/lookups/freegeoip_test.rb +0 -27
- data/test/unit/lookups/geocoder_ca_test.rb +0 -17
- data/test/unit/lookups/geocodio_test.rb +0 -55
- data/test/unit/lookups/geoip2_test.rb +0 -27
- data/test/unit/lookups/google_places_details_test.rb +0 -122
- data/test/unit/lookups/google_premier_test.rb +0 -22
- data/test/unit/lookups/google_test.rb +0 -84
- data/test/unit/lookups/mapquest_test.rb +0 -60
- data/test/unit/lookups/maxmind_local_test.rb +0 -28
- data/test/unit/lookups/maxmind_test.rb +0 -63
- data/test/unit/lookups/nominatim_test.rb +0 -31
- data/test/unit/lookups/okf_test.rb +0 -38
- data/test/unit/lookups/opencagedata_test.rb +0 -64
- data/test/unit/lookups/pointpin_test.rb +0 -30
- data/test/unit/lookups/postcode_anywhere_uk_test.rb +0 -70
- data/test/unit/lookups/smarty_streets_test.rb +0 -71
- data/test/unit/lookups/telize_test.rb +0 -36
- data/test/unit/lookups/yahoo_test.rb +0 -35
- data/test/unit/method_aliases_test.rb +0 -26
- data/test/unit/model_test.rb +0 -38
- data/test/unit/mongoid_test.rb +0 -47
- data/test/unit/near_test.rb +0 -87
- data/test/unit/oauth_util_test.rb +0 -31
- data/test/unit/proxy_test.rb +0 -37
- data/test/unit/query_test.rb +0 -52
- data/test/unit/rake_task_test.rb +0 -21
- data/test/unit/request_test.rb +0 -35
- data/test/unit/result_test.rb +0 -72
- data/test/unit/test_mode_test.rb +0 -70
metadata
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geocoder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2
|
|
4
|
+
version: 1.8.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Reisner
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
frameworks too.
|
|
13
|
+
description: Object geocoding (by street or IP address), reverse geocoding (coordinates
|
|
14
|
+
to street address), distance queries for ActiveRecord and Mongoid, result caching,
|
|
15
|
+
and more. Designed for Rails but works with Sinatra and other Rack frameworks too.
|
|
17
16
|
email:
|
|
18
17
|
- alex@alexreisner.com
|
|
19
18
|
executables:
|
|
@@ -21,60 +20,93 @@ executables:
|
|
|
21
20
|
extensions: []
|
|
22
21
|
extra_rdoc_files: []
|
|
23
22
|
files:
|
|
24
|
-
- ".gitignore"
|
|
25
|
-
- ".travis.yml"
|
|
26
23
|
- CHANGELOG.md
|
|
27
24
|
- LICENSE
|
|
28
25
|
- README.md
|
|
29
|
-
-
|
|
26
|
+
- bin/console
|
|
30
27
|
- bin/geocode
|
|
31
|
-
- examples/
|
|
32
|
-
- examples/autoexpire_cache_redis.rb
|
|
28
|
+
- examples/app_defined_lookup_services.rb
|
|
33
29
|
- examples/cache_bypass.rb
|
|
34
|
-
-
|
|
30
|
+
- examples/reverse_geocode_job.rb
|
|
31
|
+
- lib/easting_northing.rb
|
|
35
32
|
- lib/generators/geocoder/config/config_generator.rb
|
|
36
33
|
- lib/generators/geocoder/config/templates/initializer.rb
|
|
37
34
|
- lib/generators/geocoder/maxmind/geolite_city_generator.rb
|
|
38
35
|
- lib/generators/geocoder/maxmind/geolite_country_generator.rb
|
|
39
36
|
- lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb
|
|
40
37
|
- lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb
|
|
38
|
+
- lib/generators/geocoder/migration_version.rb
|
|
41
39
|
- lib/geocoder.rb
|
|
42
40
|
- lib/geocoder/cache.rb
|
|
41
|
+
- lib/geocoder/cache_stores/base.rb
|
|
42
|
+
- lib/geocoder/cache_stores/generic.rb
|
|
43
|
+
- lib/geocoder/cache_stores/redis.rb
|
|
43
44
|
- lib/geocoder/calculations.rb
|
|
44
45
|
- lib/geocoder/cli.rb
|
|
45
46
|
- lib/geocoder/configuration.rb
|
|
46
47
|
- lib/geocoder/configuration_hash.rb
|
|
48
|
+
- lib/geocoder/esri_token.rb
|
|
47
49
|
- lib/geocoder/exceptions.rb
|
|
48
50
|
- lib/geocoder/ip_address.rb
|
|
51
|
+
- lib/geocoder/kernel_logger.rb
|
|
52
|
+
- lib/geocoder/logger.rb
|
|
49
53
|
- lib/geocoder/lookup.rb
|
|
54
|
+
- lib/geocoder/lookups/abstract_api.rb
|
|
55
|
+
- lib/geocoder/lookups/amap.rb
|
|
56
|
+
- lib/geocoder/lookups/amazon_location_service.rb
|
|
50
57
|
- lib/geocoder/lookups/baidu.rb
|
|
51
58
|
- lib/geocoder/lookups/baidu_ip.rb
|
|
59
|
+
- lib/geocoder/lookups/ban_data_gouv_fr.rb
|
|
52
60
|
- lib/geocoder/lookups/base.rb
|
|
53
61
|
- lib/geocoder/lookups/bing.rb
|
|
62
|
+
- lib/geocoder/lookups/db_ip_com.rb
|
|
54
63
|
- lib/geocoder/lookups/dstk.rb
|
|
55
64
|
- lib/geocoder/lookups/esri.rb
|
|
56
65
|
- lib/geocoder/lookups/freegeoip.rb
|
|
66
|
+
- lib/geocoder/lookups/geoapify.rb
|
|
57
67
|
- lib/geocoder/lookups/geocoder_ca.rb
|
|
58
|
-
- lib/geocoder/lookups/geocoder_us.rb
|
|
59
68
|
- lib/geocoder/lookups/geocodio.rb
|
|
60
69
|
- lib/geocoder/lookups/geoip2.rb
|
|
70
|
+
- lib/geocoder/lookups/geoportail_lu.rb
|
|
61
71
|
- lib/geocoder/lookups/google.rb
|
|
62
72
|
- lib/geocoder/lookups/google_places_details.rb
|
|
73
|
+
- lib/geocoder/lookups/google_places_search.rb
|
|
63
74
|
- lib/geocoder/lookups/google_premier.rb
|
|
64
75
|
- lib/geocoder/lookups/here.rb
|
|
76
|
+
- lib/geocoder/lookups/ip2location.rb
|
|
77
|
+
- lib/geocoder/lookups/ipapi_com.rb
|
|
78
|
+
- lib/geocoder/lookups/ipbase.rb
|
|
79
|
+
- lib/geocoder/lookups/ipdata_co.rb
|
|
80
|
+
- lib/geocoder/lookups/ipgeolocation.rb
|
|
81
|
+
- lib/geocoder/lookups/ipinfo_io.rb
|
|
82
|
+
- lib/geocoder/lookups/ipqualityscore.rb
|
|
83
|
+
- lib/geocoder/lookups/ipregistry.rb
|
|
84
|
+
- lib/geocoder/lookups/ipstack.rb
|
|
85
|
+
- lib/geocoder/lookups/latlon.rb
|
|
86
|
+
- lib/geocoder/lookups/location_iq.rb
|
|
87
|
+
- lib/geocoder/lookups/mapbox.rb
|
|
65
88
|
- lib/geocoder/lookups/mapquest.rb
|
|
66
89
|
- lib/geocoder/lookups/maxmind.rb
|
|
90
|
+
- lib/geocoder/lookups/maxmind_geoip2.rb
|
|
67
91
|
- lib/geocoder/lookups/maxmind_local.rb
|
|
92
|
+
- lib/geocoder/lookups/melissa_street.rb
|
|
93
|
+
- lib/geocoder/lookups/nationaal_georegister_nl.rb
|
|
68
94
|
- lib/geocoder/lookups/nominatim.rb
|
|
69
|
-
- lib/geocoder/lookups/okf.rb
|
|
70
95
|
- lib/geocoder/lookups/opencagedata.rb
|
|
71
|
-
- lib/geocoder/lookups/
|
|
96
|
+
- lib/geocoder/lookups/osmnames.rb
|
|
97
|
+
- lib/geocoder/lookups/pc_miler.rb
|
|
98
|
+
- lib/geocoder/lookups/pelias.rb
|
|
99
|
+
- lib/geocoder/lookups/photon.rb
|
|
100
|
+
- lib/geocoder/lookups/pickpoint.rb
|
|
72
101
|
- lib/geocoder/lookups/pointpin.rb
|
|
73
102
|
- lib/geocoder/lookups/postcode_anywhere_uk.rb
|
|
103
|
+
- lib/geocoder/lookups/postcodes_io.rb
|
|
74
104
|
- lib/geocoder/lookups/smarty_streets.rb
|
|
75
105
|
- lib/geocoder/lookups/telize.rb
|
|
106
|
+
- lib/geocoder/lookups/tencent.rb
|
|
76
107
|
- lib/geocoder/lookups/test.rb
|
|
77
|
-
- lib/geocoder/lookups/
|
|
108
|
+
- lib/geocoder/lookups/twogis.rb
|
|
109
|
+
- lib/geocoder/lookups/uk_ordnance_survey_names.rb
|
|
78
110
|
- lib/geocoder/lookups/yandex.rb
|
|
79
111
|
- lib/geocoder/models/active_record.rb
|
|
80
112
|
- lib/geocoder/models/base.rb
|
|
@@ -84,34 +116,62 @@ files:
|
|
|
84
116
|
- lib/geocoder/query.rb
|
|
85
117
|
- lib/geocoder/railtie.rb
|
|
86
118
|
- lib/geocoder/request.rb
|
|
119
|
+
- lib/geocoder/results/abstract_api.rb
|
|
120
|
+
- lib/geocoder/results/amap.rb
|
|
121
|
+
- lib/geocoder/results/amazon_location_service.rb
|
|
87
122
|
- lib/geocoder/results/baidu.rb
|
|
88
123
|
- lib/geocoder/results/baidu_ip.rb
|
|
124
|
+
- lib/geocoder/results/ban_data_gouv_fr.rb
|
|
89
125
|
- lib/geocoder/results/base.rb
|
|
90
126
|
- lib/geocoder/results/bing.rb
|
|
127
|
+
- lib/geocoder/results/db_ip_com.rb
|
|
91
128
|
- lib/geocoder/results/dstk.rb
|
|
92
129
|
- lib/geocoder/results/esri.rb
|
|
93
130
|
- lib/geocoder/results/freegeoip.rb
|
|
131
|
+
- lib/geocoder/results/geoapify.rb
|
|
94
132
|
- lib/geocoder/results/geocoder_ca.rb
|
|
95
|
-
- lib/geocoder/results/geocoder_us.rb
|
|
96
133
|
- lib/geocoder/results/geocodio.rb
|
|
97
134
|
- lib/geocoder/results/geoip2.rb
|
|
135
|
+
- lib/geocoder/results/geoportail_lu.rb
|
|
98
136
|
- lib/geocoder/results/google.rb
|
|
99
137
|
- lib/geocoder/results/google_places_details.rb
|
|
138
|
+
- lib/geocoder/results/google_places_search.rb
|
|
100
139
|
- lib/geocoder/results/google_premier.rb
|
|
101
140
|
- lib/geocoder/results/here.rb
|
|
141
|
+
- lib/geocoder/results/ip2location.rb
|
|
142
|
+
- lib/geocoder/results/ipapi_com.rb
|
|
143
|
+
- lib/geocoder/results/ipbase.rb
|
|
144
|
+
- lib/geocoder/results/ipdata_co.rb
|
|
145
|
+
- lib/geocoder/results/ipgeolocation.rb
|
|
146
|
+
- lib/geocoder/results/ipinfo_io.rb
|
|
147
|
+
- lib/geocoder/results/ipqualityscore.rb
|
|
148
|
+
- lib/geocoder/results/ipregistry.rb
|
|
149
|
+
- lib/geocoder/results/ipstack.rb
|
|
150
|
+
- lib/geocoder/results/latlon.rb
|
|
151
|
+
- lib/geocoder/results/location_iq.rb
|
|
152
|
+
- lib/geocoder/results/mapbox.rb
|
|
102
153
|
- lib/geocoder/results/mapquest.rb
|
|
103
154
|
- lib/geocoder/results/maxmind.rb
|
|
155
|
+
- lib/geocoder/results/maxmind_geoip2.rb
|
|
104
156
|
- lib/geocoder/results/maxmind_local.rb
|
|
157
|
+
- lib/geocoder/results/melissa_street.rb
|
|
158
|
+
- lib/geocoder/results/nationaal_georegister_nl.rb
|
|
105
159
|
- lib/geocoder/results/nominatim.rb
|
|
106
|
-
- lib/geocoder/results/okf.rb
|
|
107
160
|
- lib/geocoder/results/opencagedata.rb
|
|
108
|
-
- lib/geocoder/results/
|
|
161
|
+
- lib/geocoder/results/osmnames.rb
|
|
162
|
+
- lib/geocoder/results/pc_miler.rb
|
|
163
|
+
- lib/geocoder/results/pelias.rb
|
|
164
|
+
- lib/geocoder/results/photon.rb
|
|
165
|
+
- lib/geocoder/results/pickpoint.rb
|
|
109
166
|
- lib/geocoder/results/pointpin.rb
|
|
110
167
|
- lib/geocoder/results/postcode_anywhere_uk.rb
|
|
168
|
+
- lib/geocoder/results/postcodes_io.rb
|
|
111
169
|
- lib/geocoder/results/smarty_streets.rb
|
|
112
170
|
- lib/geocoder/results/telize.rb
|
|
171
|
+
- lib/geocoder/results/tencent.rb
|
|
113
172
|
- lib/geocoder/results/test.rb
|
|
114
|
-
- lib/geocoder/results/
|
|
173
|
+
- lib/geocoder/results/twogis.rb
|
|
174
|
+
- lib/geocoder/results/uk_ordnance_survey_names.rb
|
|
115
175
|
- lib/geocoder/results/yandex.rb
|
|
116
176
|
- lib/geocoder/sql.rb
|
|
117
177
|
- lib/geocoder/stores/active_record.rb
|
|
@@ -119,155 +179,18 @@ files:
|
|
|
119
179
|
- lib/geocoder/stores/mongo_base.rb
|
|
120
180
|
- lib/geocoder/stores/mongo_mapper.rb
|
|
121
181
|
- lib/geocoder/stores/mongoid.rb
|
|
182
|
+
- lib/geocoder/util.rb
|
|
122
183
|
- lib/geocoder/version.rb
|
|
123
|
-
- lib/hash_recursive_merge.rb
|
|
124
184
|
- lib/maxmind_database.rb
|
|
125
|
-
- lib/oauth_util.rb
|
|
126
185
|
- lib/tasks/geocoder.rake
|
|
127
186
|
- lib/tasks/maxmind.rake
|
|
128
|
-
- test/fixtures/baidu_invalid_key
|
|
129
|
-
- test/fixtures/baidu_ip_202_198_16_3
|
|
130
|
-
- test/fixtures/baidu_ip_invalid_key
|
|
131
|
-
- test/fixtures/baidu_ip_no_results
|
|
132
|
-
- test/fixtures/baidu_no_results
|
|
133
|
-
- test/fixtures/baidu_reverse
|
|
134
|
-
- test/fixtures/baidu_shanghai_pearl_tower
|
|
135
|
-
- test/fixtures/bing_invalid_key
|
|
136
|
-
- test/fixtures/bing_madison_square_garden
|
|
137
|
-
- test/fixtures/bing_no_results
|
|
138
|
-
- test/fixtures/bing_reverse
|
|
139
|
-
- test/fixtures/cloudmade_invalid_key
|
|
140
|
-
- test/fixtures/cloudmade_madison_square_garden
|
|
141
|
-
- test/fixtures/cloudmade_no_results
|
|
142
|
-
- test/fixtures/esri_madison_square_garden
|
|
143
|
-
- test/fixtures/esri_no_results
|
|
144
|
-
- test/fixtures/esri_reverse
|
|
145
|
-
- test/fixtures/freegeoip_74_200_247_59
|
|
146
|
-
- test/fixtures/freegeoip_no_results
|
|
147
|
-
- test/fixtures/geocoder_ca_madison_square_garden
|
|
148
|
-
- test/fixtures/geocoder_ca_no_results
|
|
149
|
-
- test/fixtures/geocoder_ca_reverse
|
|
150
|
-
- test/fixtures/geocoder_us_madison_square_garden
|
|
151
|
-
- test/fixtures/geocoder_us_no_results
|
|
152
|
-
- test/fixtures/geocodio_1101_pennsylvania_ave
|
|
153
|
-
- test/fixtures/geocodio_bad_api_key
|
|
154
|
-
- test/fixtures/geocodio_invalid
|
|
155
|
-
- test/fixtures/geocodio_no_results
|
|
156
|
-
- test/fixtures/geocodio_over_query_limit
|
|
157
|
-
- test/fixtures/google_garbage
|
|
158
|
-
- test/fixtures/google_madison_square_garden
|
|
159
|
-
- test/fixtures/google_no_city_data
|
|
160
|
-
- test/fixtures/google_no_locality
|
|
161
|
-
- test/fixtures/google_no_results
|
|
162
|
-
- test/fixtures/google_over_limit
|
|
163
|
-
- test/fixtures/google_places_details_invalid_request
|
|
164
|
-
- test/fixtures/google_places_details_madison_square_garden
|
|
165
|
-
- test/fixtures/google_places_details_no_results
|
|
166
|
-
- test/fixtures/google_places_details_no_reviews
|
|
167
|
-
- test/fixtures/google_places_details_no_types
|
|
168
|
-
- test/fixtures/here_madison_square_garden
|
|
169
|
-
- test/fixtures/here_no_results
|
|
170
|
-
- test/fixtures/mapquest_error
|
|
171
|
-
- test/fixtures/mapquest_invalid_api_key
|
|
172
|
-
- test/fixtures/mapquest_invalid_request
|
|
173
|
-
- test/fixtures/mapquest_madison_square_garden
|
|
174
|
-
- test/fixtures/mapquest_no_results
|
|
175
|
-
- test/fixtures/maxmind_24_24_24_21
|
|
176
|
-
- test/fixtures/maxmind_24_24_24_22
|
|
177
|
-
- test/fixtures/maxmind_24_24_24_23
|
|
178
|
-
- test/fixtures/maxmind_24_24_24_24
|
|
179
|
-
- test/fixtures/maxmind_74_200_247_59
|
|
180
|
-
- test/fixtures/maxmind_invalid_key
|
|
181
|
-
- test/fixtures/maxmind_no_results
|
|
182
|
-
- test/fixtures/nominatim_madison_square_garden
|
|
183
|
-
- test/fixtures/nominatim_no_results
|
|
184
|
-
- test/fixtures/nominatim_over_limit
|
|
185
|
-
- test/fixtures/okf_kirstinmaki
|
|
186
|
-
- test/fixtures/okf_no_results
|
|
187
|
-
- test/fixtures/opencagedata_invalid_api_key
|
|
188
|
-
- test/fixtures/opencagedata_invalid_request
|
|
189
|
-
- test/fixtures/opencagedata_madison_square_garden
|
|
190
|
-
- test/fixtures/opencagedata_no_results
|
|
191
|
-
- test/fixtures/opencagedata_over_limit
|
|
192
|
-
- test/fixtures/ovi_madison_square_garden
|
|
193
|
-
- test/fixtures/ovi_no_results
|
|
194
|
-
- test/fixtures/pointpin_10_10_10_10
|
|
195
|
-
- test/fixtures/pointpin_555_555_555_555
|
|
196
|
-
- test/fixtures/pointpin_80_111_555_555
|
|
197
|
-
- test/fixtures/pointpin_no_results
|
|
198
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_WR26NJ
|
|
199
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_generic_error
|
|
200
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_hampshire
|
|
201
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_key_limit_exceeded
|
|
202
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_no_results
|
|
203
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_romsey
|
|
204
|
-
- test/fixtures/postcode_anywhere_uk_geocode_v2_00_unknown_key
|
|
205
|
-
- test/fixtures/smarty_streets_11211
|
|
206
|
-
- test/fixtures/smarty_streets_madison_square_garden
|
|
207
|
-
- test/fixtures/smarty_streets_no_results
|
|
208
|
-
- test/fixtures/telize_10_10_10_10
|
|
209
|
-
- test/fixtures/telize_555_555_555_555
|
|
210
|
-
- test/fixtures/telize_74_200_247_59
|
|
211
|
-
- test/fixtures/telize_no_results
|
|
212
|
-
- test/fixtures/yahoo_error
|
|
213
|
-
- test/fixtures/yahoo_invalid_key
|
|
214
|
-
- test/fixtures/yahoo_madison_square_garden
|
|
215
|
-
- test/fixtures/yahoo_no_results
|
|
216
|
-
- test/fixtures/yahoo_over_limit
|
|
217
|
-
- test/fixtures/yandex_canada_rue_dupuis_14
|
|
218
|
-
- test/fixtures/yandex_invalid_key
|
|
219
|
-
- test/fixtures/yandex_kremlin
|
|
220
|
-
- test/fixtures/yandex_new_york
|
|
221
|
-
- test/fixtures/yandex_no_city_and_town
|
|
222
|
-
- test/fixtures/yandex_no_results
|
|
223
|
-
- test/integration/http_client_test.rb
|
|
224
|
-
- test/mongoid_test_helper.rb
|
|
225
|
-
- test/test_helper.rb
|
|
226
|
-
- test/unit/active_record_test.rb
|
|
227
|
-
- test/unit/cache_test.rb
|
|
228
|
-
- test/unit/calculations_test.rb
|
|
229
|
-
- test/unit/configuration_test.rb
|
|
230
|
-
- test/unit/error_handling_test.rb
|
|
231
|
-
- test/unit/geocoder_test.rb
|
|
232
|
-
- test/unit/https_test.rb
|
|
233
|
-
- test/unit/ip_address_test.rb
|
|
234
|
-
- test/unit/lookup_test.rb
|
|
235
|
-
- test/unit/lookups/bing_test.rb
|
|
236
|
-
- test/unit/lookups/dstk_test.rb
|
|
237
|
-
- test/unit/lookups/esri_test.rb
|
|
238
|
-
- test/unit/lookups/freegeoip_test.rb
|
|
239
|
-
- test/unit/lookups/geocoder_ca_test.rb
|
|
240
|
-
- test/unit/lookups/geocodio_test.rb
|
|
241
|
-
- test/unit/lookups/geoip2_test.rb
|
|
242
|
-
- test/unit/lookups/google_places_details_test.rb
|
|
243
|
-
- test/unit/lookups/google_premier_test.rb
|
|
244
|
-
- test/unit/lookups/google_test.rb
|
|
245
|
-
- test/unit/lookups/mapquest_test.rb
|
|
246
|
-
- test/unit/lookups/maxmind_local_test.rb
|
|
247
|
-
- test/unit/lookups/maxmind_test.rb
|
|
248
|
-
- test/unit/lookups/nominatim_test.rb
|
|
249
|
-
- test/unit/lookups/okf_test.rb
|
|
250
|
-
- test/unit/lookups/opencagedata_test.rb
|
|
251
|
-
- test/unit/lookups/pointpin_test.rb
|
|
252
|
-
- test/unit/lookups/postcode_anywhere_uk_test.rb
|
|
253
|
-
- test/unit/lookups/smarty_streets_test.rb
|
|
254
|
-
- test/unit/lookups/telize_test.rb
|
|
255
|
-
- test/unit/lookups/yahoo_test.rb
|
|
256
|
-
- test/unit/method_aliases_test.rb
|
|
257
|
-
- test/unit/model_test.rb
|
|
258
|
-
- test/unit/mongoid_test.rb
|
|
259
|
-
- test/unit/near_test.rb
|
|
260
|
-
- test/unit/oauth_util_test.rb
|
|
261
|
-
- test/unit/proxy_test.rb
|
|
262
|
-
- test/unit/query_test.rb
|
|
263
|
-
- test/unit/rake_task_test.rb
|
|
264
|
-
- test/unit/request_test.rb
|
|
265
|
-
- test/unit/result_test.rb
|
|
266
|
-
- test/unit/test_mode_test.rb
|
|
267
187
|
homepage: http://www.rubygeocoder.com
|
|
268
|
-
licenses:
|
|
269
|
-
|
|
270
|
-
|
|
188
|
+
licenses:
|
|
189
|
+
- MIT
|
|
190
|
+
metadata:
|
|
191
|
+
source_code_uri: https://github.com/alexreisner/geocoder
|
|
192
|
+
changelog_uri: https://github.com/alexreisner/geocoder/blob/master/CHANGELOG.md
|
|
193
|
+
post_install_message:
|
|
271
194
|
rdoc_options: []
|
|
272
195
|
require_paths:
|
|
273
196
|
- lib
|
|
@@ -275,16 +198,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
275
198
|
requirements:
|
|
276
199
|
- - ">="
|
|
277
200
|
- !ruby/object:Gem::Version
|
|
278
|
-
version:
|
|
201
|
+
version: 2.0.0
|
|
279
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
203
|
requirements:
|
|
281
204
|
- - ">="
|
|
282
205
|
- !ruby/object:Gem::Version
|
|
283
206
|
version: '0'
|
|
284
207
|
requirements: []
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
signing_key:
|
|
208
|
+
rubygems_version: 3.3.26
|
|
209
|
+
signing_key:
|
|
288
210
|
specification_version: 4
|
|
289
211
|
summary: Complete geocoding solution for Ruby.
|
|
290
212
|
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
rvm:
|
|
2
|
-
- 1.9.2
|
|
3
|
-
- 1.9.3
|
|
4
|
-
- 2.0.0
|
|
5
|
-
- 2.1.2
|
|
6
|
-
- jruby-19mode
|
|
7
|
-
- rbx-2
|
|
8
|
-
gemfile:
|
|
9
|
-
- Gemfile
|
|
10
|
-
- gemfiles/Gemfile.mongoid-2.4.x
|
|
11
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
|
12
|
-
matrix:
|
|
13
|
-
exclude:
|
|
14
|
-
- rvm: 1.9.2
|
|
15
|
-
gemfile: Gemfile
|
|
16
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
|
17
|
-
- rvm: 1.9.3
|
|
18
|
-
gemfile: gemfiles/Gemfile.mongoid-2.4.x
|
|
19
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
|
20
|
-
- rvm: 2.0.0
|
|
21
|
-
gemfile: gemfiles/Gemfile.mongoid-2.4.x
|
|
22
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
|
23
|
-
- rvm: 2.1.2
|
|
24
|
-
gemfile: gemfiles/Gemfile.mongoid-2.4.x
|
|
25
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
|
26
|
-
- rvm: jruby-19mode
|
|
27
|
-
gemfile: gemfiles/Gemfile.mongoid-2.4.x
|
|
28
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
|
29
|
-
- rvm: rbx-2
|
|
30
|
-
gemfile: gemfiles/Gemfile.mongoid-2.4.x
|
|
31
|
-
env: SSL_CERT_DIR=/etc/ssl/certs
|
data/Rakefile
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'bundler'
|
|
2
|
-
Bundler::GemHelper.install_tasks
|
|
3
|
-
|
|
4
|
-
require 'rake/testtask'
|
|
5
|
-
Rake::TestTask.new(:test) do |test|
|
|
6
|
-
test.libs << 'lib' << 'test'
|
|
7
|
-
test.pattern = 'test/unit/**/*_test.rb'
|
|
8
|
-
test.verbose = true
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
Rake::TestTask.new(:integration) do |test|
|
|
12
|
-
test.libs << 'lib' << 'test'
|
|
13
|
-
test.pattern = 'test/integration/*_test.rb'
|
|
14
|
-
test.verbose = true
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
task :default => [:test]
|
|
18
|
-
|
|
19
|
-
require 'rdoc/task'
|
|
20
|
-
Rake::RDocTask.new do |rdoc|
|
|
21
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
22
|
-
rdoc.title = "Geocoder #{Geocoder::VERSION}"
|
|
23
|
-
rdoc.rdoc_files.include('*.rdoc')
|
|
24
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
25
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# This class implements a cache with simple delegation to the the Dalli Memcached client
|
|
2
|
-
# https://github.com/mperham/dalli
|
|
3
|
-
#
|
|
4
|
-
# A TTL is set on initialization
|
|
5
|
-
|
|
6
|
-
class AutoexpireCacheDalli
|
|
7
|
-
def initialize(store, ttl = 86400)
|
|
8
|
-
@store = store
|
|
9
|
-
@keys = 'GeocoderDalliClientKeys'
|
|
10
|
-
@ttl = ttl
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def [](url)
|
|
14
|
-
res = @store.get(url)
|
|
15
|
-
res = YAML::load(res) if res.present?
|
|
16
|
-
res
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def []=(url, value)
|
|
20
|
-
if value.nil?
|
|
21
|
-
del(url)
|
|
22
|
-
else
|
|
23
|
-
key_cache_add(url) if @store.add(url, YAML::dump(value), @ttl)
|
|
24
|
-
end
|
|
25
|
-
value
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def keys
|
|
29
|
-
key_cache
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def del(url)
|
|
33
|
-
key_cache_delete(url) if @store.delete(url)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def key_cache
|
|
39
|
-
the_keys = @store.get(@keys)
|
|
40
|
-
if the_keys.nil?
|
|
41
|
-
@store.add(@keys, YAML::dump([]))
|
|
42
|
-
[]
|
|
43
|
-
else
|
|
44
|
-
YAML::load(the_keys)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def key_cache_add(key)
|
|
49
|
-
@store.replace(@keys, YAML::dump(key_cache << key))
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def key_cache_delete(key)
|
|
53
|
-
tmp = key_cache
|
|
54
|
-
tmp.delete(key)
|
|
55
|
-
@store.replace(@keys, YAML::dump(tmp))
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Here Dalli is set up as on Heroku using the Memcachier gem.
|
|
60
|
-
# https://devcenter.heroku.com/articles/memcachier#ruby
|
|
61
|
-
# On other setups you might have to specify your Memcached server in Dalli::Client.new
|
|
62
|
-
Geocoder.configure(:cache => AutoexpireCacheDalli.new(Dalli::Client.new))
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# This class implements a cache with simple delegation to the Redis store, but
|
|
2
|
-
# when it creates a key/value pair, it also sends an EXPIRE command with a TTL.
|
|
3
|
-
# It should be fairly simple to do the same thing with Memcached.
|
|
4
|
-
class AutoexpireCacheRedis
|
|
5
|
-
def initialize(store, ttl = 86400)
|
|
6
|
-
@store = store
|
|
7
|
-
@ttl = ttl
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def [](url)
|
|
11
|
-
@store.[](url)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def []=(url, value)
|
|
15
|
-
@store.[]=(url, value)
|
|
16
|
-
@store.expire(url, @ttl)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def keys
|
|
20
|
-
@store.keys
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def del(url)
|
|
24
|
-
@store.del(url)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
Geocoder.configure(:cache => AutoexpireCacheRedis.new(Redis.new))
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
source "http://rubygems.org"
|
|
2
|
-
|
|
3
|
-
gemspec :path => '..'
|
|
4
|
-
|
|
5
|
-
group :development, :test do
|
|
6
|
-
gem 'rake'
|
|
7
|
-
gem 'mongoid', '2.4.11'
|
|
8
|
-
gem 'bson_ext', :platforms => :ruby
|
|
9
|
-
gem 'geoip'
|
|
10
|
-
|
|
11
|
-
gem 'rails'
|
|
12
|
-
|
|
13
|
-
platforms :jruby do
|
|
14
|
-
gem 'jruby-openssl'
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require 'geocoder/lookups/base'
|
|
2
|
-
require "geocoder/results/geocoder_us"
|
|
3
|
-
|
|
4
|
-
module Geocoder::Lookup
|
|
5
|
-
class GeocoderUs < Base
|
|
6
|
-
|
|
7
|
-
def name
|
|
8
|
-
"Geocoder.us"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def query_url(query)
|
|
12
|
-
if configuration.api_key
|
|
13
|
-
"http://#{configuration.api_key}@geocoder.us/member/service/csv/geocode?" + url_query_string(query)
|
|
14
|
-
else
|
|
15
|
-
"http://geocoder.us/service/csv/geocode?" + url_query_string(query)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
def results(query)
|
|
22
|
-
return [] unless doc = fetch_data(query)
|
|
23
|
-
if doc[0].to_s =~ /^(\d+)\:/
|
|
24
|
-
return []
|
|
25
|
-
else
|
|
26
|
-
return [doc.size == 5 ? ((doc[0..1] << nil) + doc[2..4]) : doc]
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def query_url_params(query)
|
|
31
|
-
(query.text =~ /^\d{5}(?:-\d{4})?$/ ? {:zip => query} : {:address => query.sanitized_text}).merge(super)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def parse_raw_data(raw_data)
|
|
35
|
-
raw_data.chomp.split(',')
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
data/lib/geocoder/lookups/okf.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require 'geocoder/lookups/base'
|
|
2
|
-
require "geocoder/results/okf"
|
|
3
|
-
|
|
4
|
-
module Geocoder::Lookup
|
|
5
|
-
class Okf < Base
|
|
6
|
-
|
|
7
|
-
def name
|
|
8
|
-
"Okf"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def query_url(query)
|
|
12
|
-
"#{protocol}://data.okf.fi/gis/1/geocode/json?" + url_query_string(query)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
private # ---------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
def valid_response?(response)
|
|
18
|
-
status = parse_json(response.body)["status"]
|
|
19
|
-
super(response) and ['OK', 'ZERO_RESULTS'].include?(status)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def results(query)
|
|
23
|
-
return [] unless doc = fetch_data(query)
|
|
24
|
-
case doc['status']; when "OK" # OK status implies >0 results
|
|
25
|
-
return doc['results']
|
|
26
|
-
end
|
|
27
|
-
return []
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def query_url_okf_params(query)
|
|
31
|
-
params = {
|
|
32
|
-
(query.reverse_geocode? ? :latlng : :address) => query.sanitized_text,
|
|
33
|
-
:sensor => "false",
|
|
34
|
-
:language => (query.language || configuration.language)
|
|
35
|
-
}
|
|
36
|
-
params
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def query_url_params(query)
|
|
40
|
-
query_url_okf_params(query).merge(super)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|