geocoder-sgonyea 1.1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/.gitignore +5 -0
  2. data/.travis.yml +23 -0
  3. data/CHANGELOG.md +298 -0
  4. data/LICENSE +20 -0
  5. data/README.md +656 -0
  6. data/Rakefile +25 -0
  7. data/bin/geocode +5 -0
  8. data/examples/autoexpire_cache.rb +28 -0
  9. data/gemfiles/Gemfile.mongoid-2.4.x +15 -0
  10. data/lib/generators/geocoder/config/config_generator.rb +14 -0
  11. data/lib/generators/geocoder/config/templates/initializer.rb +21 -0
  12. data/lib/geocoder.rb +55 -0
  13. data/lib/geocoder/cache.rb +85 -0
  14. data/lib/geocoder/calculations.rb +319 -0
  15. data/lib/geocoder/cli.rb +114 -0
  16. data/lib/geocoder/configuration.rb +130 -0
  17. data/lib/geocoder/configuration_hash.rb +11 -0
  18. data/lib/geocoder/exceptions.rb +21 -0
  19. data/lib/geocoder/lookup.rb +82 -0
  20. data/lib/geocoder/lookups/base.rb +250 -0
  21. data/lib/geocoder/lookups/bing.rb +47 -0
  22. data/lib/geocoder/lookups/freegeoip.rb +47 -0
  23. data/lib/geocoder/lookups/geocoder_ca.rb +54 -0
  24. data/lib/geocoder/lookups/google.rb +62 -0
  25. data/lib/geocoder/lookups/google_premier.rb +47 -0
  26. data/lib/geocoder/lookups/mapquest.rb +43 -0
  27. data/lib/geocoder/lookups/maxmind.rb +88 -0
  28. data/lib/geocoder/lookups/nominatim.rb +45 -0
  29. data/lib/geocoder/lookups/ovi.rb +52 -0
  30. data/lib/geocoder/lookups/test.rb +38 -0
  31. data/lib/geocoder/lookups/yahoo.rb +84 -0
  32. data/lib/geocoder/lookups/yandex.rb +54 -0
  33. data/lib/geocoder/models/active_record.rb +46 -0
  34. data/lib/geocoder/models/base.rb +42 -0
  35. data/lib/geocoder/models/mongo_base.rb +60 -0
  36. data/lib/geocoder/models/mongo_mapper.rb +26 -0
  37. data/lib/geocoder/models/mongoid.rb +32 -0
  38. data/lib/geocoder/query.rb +103 -0
  39. data/lib/geocoder/railtie.rb +26 -0
  40. data/lib/geocoder/request.rb +23 -0
  41. data/lib/geocoder/results/base.rb +67 -0
  42. data/lib/geocoder/results/bing.rb +48 -0
  43. data/lib/geocoder/results/freegeoip.rb +45 -0
  44. data/lib/geocoder/results/geocoder_ca.rb +60 -0
  45. data/lib/geocoder/results/google.rb +106 -0
  46. data/lib/geocoder/results/google_premier.rb +6 -0
  47. data/lib/geocoder/results/mapquest.rb +51 -0
  48. data/lib/geocoder/results/maxmind.rb +136 -0
  49. data/lib/geocoder/results/nominatim.rb +94 -0
  50. data/lib/geocoder/results/ovi.rb +62 -0
  51. data/lib/geocoder/results/test.rb +16 -0
  52. data/lib/geocoder/results/yahoo.rb +55 -0
  53. data/lib/geocoder/results/yandex.rb +80 -0
  54. data/lib/geocoder/sql.rb +106 -0
  55. data/lib/geocoder/stores/active_record.rb +259 -0
  56. data/lib/geocoder/stores/base.rb +120 -0
  57. data/lib/geocoder/stores/mongo_base.rb +85 -0
  58. data/lib/geocoder/stores/mongo_mapper.rb +13 -0
  59. data/lib/geocoder/stores/mongoid.rb +13 -0
  60. data/lib/geocoder/version.rb +3 -0
  61. data/lib/hash_recursive_merge.rb +74 -0
  62. data/lib/oauth_util.rb +112 -0
  63. data/lib/tasks/geocoder.rake +25 -0
  64. data/test/active_record_test.rb +15 -0
  65. data/test/cache_test.rb +19 -0
  66. data/test/calculations_test.rb +195 -0
  67. data/test/configuration_test.rb +78 -0
  68. data/test/custom_block_test.rb +32 -0
  69. data/test/error_handling_test.rb +43 -0
  70. data/test/fixtures/bing_invalid_key +1 -0
  71. data/test/fixtures/bing_madison_square_garden +40 -0
  72. data/test/fixtures/bing_no_results +16 -0
  73. data/test/fixtures/bing_reverse +42 -0
  74. data/test/fixtures/freegeoip_74_200_247_59 +12 -0
  75. data/test/fixtures/freegeoip_no_results +1 -0
  76. data/test/fixtures/geocoder_ca_madison_square_garden +1 -0
  77. data/test/fixtures/geocoder_ca_no_results +1 -0
  78. data/test/fixtures/geocoder_ca_reverse +34 -0
  79. data/test/fixtures/google_garbage +456 -0
  80. data/test/fixtures/google_madison_square_garden +57 -0
  81. data/test/fixtures/google_no_city_data +44 -0
  82. data/test/fixtures/google_no_locality +51 -0
  83. data/test/fixtures/google_no_results +4 -0
  84. data/test/fixtures/mapquest_madison_square_garden +52 -0
  85. data/test/fixtures/mapquest_no_results +7 -0
  86. data/test/fixtures/maxmind_24_24_24_21 +1 -0
  87. data/test/fixtures/maxmind_24_24_24_22 +1 -0
  88. data/test/fixtures/maxmind_24_24_24_23 +1 -0
  89. data/test/fixtures/maxmind_24_24_24_24 +1 -0
  90. data/test/fixtures/maxmind_74_200_247_59 +1 -0
  91. data/test/fixtures/maxmind_invalid_key +1 -0
  92. data/test/fixtures/maxmind_no_results +1 -0
  93. data/test/fixtures/nominatim_madison_square_garden +150 -0
  94. data/test/fixtures/nominatim_no_results +1 -0
  95. data/test/fixtures/ovi_madison_square_garden +72 -0
  96. data/test/fixtures/ovi_no_results +8 -0
  97. data/test/fixtures/yahoo_error +1 -0
  98. data/test/fixtures/yahoo_invalid_key +2 -0
  99. data/test/fixtures/yahoo_madison_square_garden +52 -0
  100. data/test/fixtures/yahoo_no_results +10 -0
  101. data/test/fixtures/yahoo_over_limit +2 -0
  102. data/test/fixtures/yandex_invalid_key +1 -0
  103. data/test/fixtures/yandex_kremlin +48 -0
  104. data/test/fixtures/yandex_no_city_and_town +112 -0
  105. data/test/fixtures/yandex_no_results +16 -0
  106. data/test/geocoder_test.rb +59 -0
  107. data/test/https_test.rb +16 -0
  108. data/test/integration/smoke_test.rb +26 -0
  109. data/test/lookup_test.rb +116 -0
  110. data/test/method_aliases_test.rb +25 -0
  111. data/test/mongoid_test.rb +39 -0
  112. data/test/mongoid_test_helper.rb +43 -0
  113. data/test/near_test.rb +43 -0
  114. data/test/oauth_util_test.rb +30 -0
  115. data/test/proxy_test.rb +23 -0
  116. data/test/query_test.rb +51 -0
  117. data/test/request_test.rb +29 -0
  118. data/test/result_test.rb +42 -0
  119. data/test/services_test.rb +277 -0
  120. data/test/test_helper.rb +279 -0
  121. data/test/test_mode_test.rb +50 -0
  122. metadata +170 -0
@@ -0,0 +1,57 @@
1
+ {
2
+ "status": "OK",
3
+ "results": [ {
4
+ "types": [ "street_address" ],
5
+ "formatted_address": "4 Penn Plaza, New York, NY 10001, USA",
6
+ "address_components": [ {
7
+ "long_name": "4",
8
+ "short_name": "4",
9
+ "types": [ "street_number" ]
10
+ }, {
11
+ "long_name": "Penn Plaza",
12
+ "short_name": "Penn Plaza",
13
+ "types": [ "route" ]
14
+ }, {
15
+ "long_name": "Manhattan",
16
+ "short_name": "Manhattan",
17
+ "types": [ "sublocality", "political" ]
18
+ }, {
19
+ "long_name": "New York",
20
+ "short_name": "New York",
21
+ "types": [ "locality", "political" ]
22
+ }, {
23
+ "long_name": "New York",
24
+ "short_name": "New York",
25
+ "types": [ "administrative_area_level_2", "political" ]
26
+ }, {
27
+ "long_name": "New York",
28
+ "short_name": "NY",
29
+ "types": [ "administrative_area_level_1", "political" ]
30
+ }, {
31
+ "long_name": "United States",
32
+ "short_name": "US",
33
+ "types": [ "country", "political" ]
34
+ }, {
35
+ "long_name": "10001",
36
+ "short_name": "10001",
37
+ "types": [ "postal_code" ]
38
+ } ],
39
+ "geometry": {
40
+ "location": {
41
+ "lat": 40.7503540,
42
+ "lng": -73.9933710
43
+ },
44
+ "location_type": "ROOFTOP",
45
+ "viewport": {
46
+ "southwest": {
47
+ "lat": 40.7473324,
48
+ "lng": -73.9965316
49
+ },
50
+ "northeast": {
51
+ "lat": 40.7536276,
52
+ "lng": -73.9902364
53
+ }
54
+ }
55
+ }
56
+ } ]
57
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "status": "OK",
3
+ "results": [ {
4
+ "types": [ "postal_code" ],
5
+ "formatted_address": "55100, Turkey",
6
+ "address_components": [{
7
+ "long_name": "55100",
8
+ "short_name": "55100",
9
+ "types": ["postal_code"]
10
+ },
11
+ {
12
+ "long_name": "Turkey",
13
+ "short_name": "TR",
14
+ "types": ["country", "political"]
15
+ }],
16
+ "geometry": {
17
+ "location": {
18
+ "lat": 41.3112221,
19
+ "lng": 36.3322118
20
+ },
21
+ "location_type": "APPROXIMATE",
22
+ "viewport": {
23
+ "southwest": {
24
+ "lat": 41.2933411,
25
+ "lng": 36.3066331
26
+ },
27
+ "northeast": {
28
+ "lat": 41.3291031,
29
+ "lng": 36.3577906
30
+ }
31
+ },
32
+ "bounds": {
33
+ "southwest": {
34
+ "lat": 41.2933411,
35
+ "lng": 36.3066331
36
+ },
37
+ "northeast": {
38
+ "lat": 41.3291031,
39
+ "lng": 36.3577906
40
+ }
41
+ }
42
+ }
43
+ } ]
44
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "status": "OK",
3
+ "results": [ {
4
+ "types": [ "route" ],
5
+ "formatted_address": "Al Ahram, Haram, Giza, Egypt",
6
+ "address_components": [ {
7
+ "long_name": "Al Ahram",
8
+ "short_name": "Al Ahram",
9
+ "types": [ "route" ]
10
+ }, {
11
+ "long_name": "Haram",
12
+ "short_name": "Haram",
13
+ "types": [ "administrative_area_level_2", "political" ]
14
+ }, {
15
+ "long_name": "Al Jizah",
16
+ "short_name": "Al Jizah",
17
+ "types": [ "administrative_area_level_1", "political" ]
18
+ }, {
19
+ "long_name": "Egypt",
20
+ "short_name": "EG",
21
+ "types": [ "country", "political" ]
22
+ } ],
23
+ "geometry": {
24
+ "location": {
25
+ "lat": 29.9803527,
26
+ "lng": 31.1330307
27
+ },
28
+ "location_type": "APPROXIMATE",
29
+ "viewport": {
30
+ "southwest": {
31
+ "lat": 29.9768276,
32
+ "lng": 31.1302189
33
+ },
34
+ "northeast": {
35
+ "lat": 29.9831228,
36
+ "lng": 31.1365141
37
+ }
38
+ },
39
+ "bounds": {
40
+ "southwest": {
41
+ "lat": 29.9775337,
42
+ "lng": 31.1327483
43
+ },
44
+ "northeast": {
45
+ "lat": 29.9824167,
46
+ "lng": 31.1339847
47
+ }
48
+ }
49
+ }
50
+ } ]
51
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "status": "ZERO_RESULTS",
3
+ "results": [ ]
4
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "results": [
3
+ {
4
+ "locations": [
5
+ {
6
+ "latLng": {
7
+ "lng": -73.994637,
8
+ "lat": 40.720409
9
+ },
10
+ "adminArea4": "New York County",
11
+ "adminArea5Type": "City",
12
+ "adminArea4Type": "County",
13
+ "adminArea5": "New York",
14
+ "street": "46 West 31st Street",
15
+ "adminArea1": "US",
16
+ "adminArea3": "NY",
17
+ "type": "s",
18
+ "displayLatLng": {
19
+ "lng": -73.994637,
20
+ "lat": 40.720409
21
+ },
22
+ "linkId": 0,
23
+ "postalCode": "10001",
24
+ "sideOfStreet": "N",
25
+ "dragPoint": false,
26
+ "adminArea1Type": "Country",
27
+ "geocodeQuality": "CITY",
28
+ "geocodeQualityCode": "A5XAX",
29
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v3/getmap?type=map&size=225,160&pois=purple-1,40.720409,-73.994637,0,0|&center=40.720409,-73.994637&zoom=9&key=Gmjtd|luua2hu2nd,7x=o5-lz8lg&rand=604519389",
30
+ "adminArea3Type": "State"
31
+ }
32
+ ],
33
+ "providedLocation": {
34
+ "location": "Madison Square Garden, New York, NY"
35
+ }
36
+ }
37
+ ],
38
+ "options": {
39
+ "ignoreLatLngInput": false,
40
+ "maxResults": -1,
41
+ "thumbMaps": true
42
+ },
43
+ "info": {
44
+ "copyright": {
45
+ "text": "© 2012 MapQuest, Inc.",
46
+ "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
47
+ "imageAltText": "© 2012 MapQuest, Inc."
48
+ },
49
+ "statuscode": 0,
50
+ "messages": []
51
+ }
52
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "results": [
3
+ {
4
+ "locations": []
5
+ }
6
+ ]
7
+ }
@@ -0,0 +1 @@
1
+ US
@@ -0,0 +1 @@
1
+ US,NY,Jamaica,40.6915,-73.8057
@@ -0,0 +1 @@
1
+ US,NY,Jamaica,,40.6915,-73.8057,501,718,"Road Runner","Road Runner"
@@ -0,0 +1 @@
1
+ US,"United States",NY,"New York",Jamaica,40.6915,-73.8057,501,718,America/New_York,NA,,"Road Runner","Road Runner",rr.com,"AS11351 Road Runner HoldCo LLC",Cable/DSL,residential,779,99,37,76,35
@@ -0,0 +1 @@
1
+ US,TX,Plano,75093,33.034698,-96.813400,623,972,"Layered Technologies , US","Layered Technologies , US",
@@ -0,0 +1 @@
1
+ ,,,,,,,,,,INVALID_LICENSE_KEY
@@ -0,0 +1 @@
1
+ ,,,,,,,,,,IP_NOT_FOUND
@@ -0,0 +1,150 @@
1
+ [
2
+
3
+ {
4
+ "place_id": "30632629",
5
+ "licence": "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
6
+ "osm_type": "way",
7
+ "osm_id": "24801588",
8
+ "boundingbox": [
9
+ "40.749828338623",
10
+ "40.7511596679688",
11
+ "-73.9943389892578",
12
+ "-73.9926528930664"
13
+ ],
14
+ "polygonpoints": [
15
+ [
16
+ "-73.9943346",
17
+ "40.7503638"
18
+ ],
19
+ [
20
+ "-73.9942745",
21
+ "40.7504158"
22
+ ],
23
+ [
24
+ "-73.9942593",
25
+ "40.750629"
26
+ ],
27
+ [
28
+ "-73.9941343",
29
+ "40.7508432"
30
+ ],
31
+ [
32
+ "-73.9939794",
33
+ "40.7509703"
34
+ ],
35
+ [
36
+ "-73.9938042",
37
+ "40.7510532"
38
+ ],
39
+ [
40
+ "-73.9938025",
41
+ "40.7511311"
42
+ ],
43
+ [
44
+ "-73.9936051",
45
+ "40.7511571"
46
+ ],
47
+ [
48
+ "-73.9935673",
49
+ "40.751105"
50
+ ],
51
+ [
52
+ "-73.9934095",
53
+ "40.7511089"
54
+ ],
55
+ [
56
+ "-73.9931235",
57
+ "40.7510548"
58
+ ],
59
+ [
60
+ "-73.9928863",
61
+ "40.7509311"
62
+ ],
63
+ [
64
+ "-73.9928068",
65
+ "40.750949"
66
+ ],
67
+ [
68
+ "-73.992721",
69
+ "40.7508515"
70
+ ],
71
+ [
72
+ "-73.9927444",
73
+ "40.7507889"
74
+ ],
75
+ [
76
+ "-73.9926693",
77
+ "40.7506457"
78
+ ],
79
+ [
80
+ "-73.9926597",
81
+ "40.7503657"
82
+ ],
83
+ [
84
+ "-73.9928305",
85
+ "40.7500953"
86
+ ],
87
+ [
88
+ "-73.9929757",
89
+ "40.7499911"
90
+ ],
91
+ [
92
+ "-73.9931281",
93
+ "40.7499238"
94
+ ],
95
+ [
96
+ "-73.993133",
97
+ "40.7498631"
98
+ ],
99
+ [
100
+ "-73.9932961",
101
+ "40.7498306"
102
+ ],
103
+ [
104
+ "-73.9933664",
105
+ "40.7498742"
106
+ ],
107
+ [
108
+ "-73.993471",
109
+ "40.7498701"
110
+ ],
111
+ [
112
+ "-73.9938023",
113
+ "40.7499263"
114
+ ],
115
+ [
116
+ "-73.9940703",
117
+ "40.7500756"
118
+ ],
119
+ [
120
+ "-73.9941876",
121
+ "40.7502038"
122
+ ],
123
+ [
124
+ "-73.9942831",
125
+ "40.7502142"
126
+ ],
127
+ [
128
+ "-73.9943346",
129
+ "40.7503638"
130
+ ]
131
+ ],
132
+ "lat": "40.7504928941818",
133
+ "lon": "-73.993466492276",
134
+ "display_name": "Madison Square Garden, West 31st Street, Long Island City, New York City, New York, 10001, United States of America",
135
+ "class": "leisure",
136
+ "type": "stadium",
137
+ "address": {
138
+ "stadium": "Madison Square Garden",
139
+ "road": "West 31st Street",
140
+ "suburb": "Long Island City",
141
+ "city": "New York City",
142
+ "county": "New York",
143
+ "state": "New York",
144
+ "postcode": "10001",
145
+ "country": "United States of America",
146
+ "country_code": "us"
147
+ }
148
+ }
149
+
150
+ ]
@@ -0,0 +1 @@
1
+ [ ]
@@ -0,0 +1,72 @@
1
+ {
2
+ "Response": {
3
+ "MetaInfo": {
4
+ "Timestamp": "2013-02-08T16:26:39.382+0000"
5
+ },
6
+ "View": [
7
+ {
8
+ "_type": "SearchResultsViewType",
9
+ "ViewId": 0,
10
+ "Result": [
11
+ {
12
+ "Relevance": 1.0,
13
+ "MatchLevel": "houseNumber",
14
+ "MatchQuality": {
15
+ "State": 1.0,
16
+ "City": 1.0,
17
+ "Street": [
18
+ 1.0
19
+ ],
20
+ "HouseNumber": 1.0
21
+ },
22
+ "MatchType": "pointAddress",
23
+ "Location": {
24
+ "LocationId": "NT_ArsGdYbpo6dqjPQel9gTID_4",
25
+ "LocationType": "point",
26
+ "DisplayPosition": {
27
+ "Latitude": 40.7504692,
28
+ "Longitude": -73.9933777
29
+ },
30
+ "NavigationPosition": [
31
+ {
32
+ "Latitude": 40.7500305,
33
+ "Longitude": -73.9942398
34
+ }
35
+ ],
36
+ "MapView": {
37
+ "TopLeft": {
38
+ "Latitude": 40.7515934,
39
+ "Longitude": -73.9948616
40
+ },
41
+ "BottomRight": {
42
+ "Latitude": 40.7493451,
43
+ "Longitude": -73.9918938
44
+ }
45
+ },
46
+ "Address": {
47
+ "Label": "4 Penn Plz, New York, NY 10001, United States",
48
+ "Country": "USA",
49
+ "State": "NY",
50
+ "County": "New York",
51
+ "City": "New York",
52
+ "Street": "Penn Plz",
53
+ "HouseNumber": "4",
54
+ "PostalCode": "10001",
55
+ "AdditionalData": [
56
+ {
57
+ "value": "United States",
58
+ "key": "CountryName"
59
+ },
60
+ {
61
+ "value": "New York",
62
+ "key": "StateName"
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ }
68
+ ]
69
+ }
70
+ ]
71
+ }
72
+ }