dummy_geocoder 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/dummy_geocoder.rb +121 -0
- data/lib/sample_data.rb +577 -0
- data/lib/version.rb +3 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 559cdb273a27a989274ed64ed12d50b1427d8ac2
|
4
|
+
data.tar.gz: d4799171b18e95715bcd4f51e00fb8bf46c85fbd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 95bde4dba3b5006844c73130e11b49158a310a9b151a5c1c5fba4acae85bb89a7fd020aa79aa55056eaa83f3663b9cea64dfda76d5095fc0d07318aa1e68b68a
|
7
|
+
data.tar.gz: 73c2a001f1614850fb9a706bf671c8fbb5b98743b7ab577bc2f0d8916acc3b713c64170468bbf671b828cbb637606480e00ef1cb830027dcced63d6041a621a2
|
@@ -0,0 +1,121 @@
|
|
1
|
+
##
|
2
|
+
# Mock HTTP request to geocoding service.
|
3
|
+
#
|
4
|
+
require 'sample_data'
|
5
|
+
|
6
|
+
module Geocoder
|
7
|
+
module Lookup
|
8
|
+
class Base
|
9
|
+
private
|
10
|
+
def fixture_exists?(fixture_name)
|
11
|
+
SampleData.respond_to?(fixture_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def read_fixture(fixture_name)
|
15
|
+
s = SampleData.send(fixture_name).strip.gsub(/\n\s*/, "")
|
16
|
+
s.instance_eval do
|
17
|
+
def body; self; end
|
18
|
+
def code; "200"; end
|
19
|
+
end
|
20
|
+
s
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# Fixture to use if none match the given query.
|
25
|
+
#
|
26
|
+
def default_fixture_name
|
27
|
+
"#{fixture_prefix}_madison_square_garden"
|
28
|
+
end
|
29
|
+
|
30
|
+
def fixture_prefix
|
31
|
+
handle
|
32
|
+
end
|
33
|
+
|
34
|
+
def fixture_for_query(query)
|
35
|
+
label = query.reverse_geocode? ? "reverse" : query.text.gsub(/[ \.]/, "_")
|
36
|
+
fixture_name = "#{fixture_prefix}_#{label}"
|
37
|
+
fixture_exists?(fixture_name) ? fixture_name : default_fixture_name
|
38
|
+
end
|
39
|
+
|
40
|
+
remove_method(:make_api_request)
|
41
|
+
|
42
|
+
def make_api_request(query)
|
43
|
+
raise TimeoutError if query.text == "timeout"
|
44
|
+
raise SocketError if query.text == "socket_error"
|
45
|
+
read_fixture fixture_for_query(query)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class GooglePremier
|
50
|
+
private
|
51
|
+
def fixture_prefix
|
52
|
+
"google"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class Dstk
|
57
|
+
private
|
58
|
+
def fixture_prefix
|
59
|
+
"google"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Yandex
|
64
|
+
private
|
65
|
+
def default_fixture_filename
|
66
|
+
"yandex_kremlin"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class Freegeoip
|
71
|
+
private
|
72
|
+
def default_fixture_filename
|
73
|
+
"freegeoip_74_200_247_59"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class Maxmind
|
78
|
+
private
|
79
|
+
def default_fixture_filename
|
80
|
+
"maxmind_74_200_247_59"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class MaxmindLocal
|
85
|
+
private
|
86
|
+
|
87
|
+
#remove_method(:results)
|
88
|
+
|
89
|
+
def results query
|
90
|
+
return [] if query.to_s == "no results"
|
91
|
+
|
92
|
+
if query.to_s == '127.0.0.1'
|
93
|
+
[]
|
94
|
+
else
|
95
|
+
[{:request=>"8.8.8.8", :ip=>"8.8.8.8", :country_code2=>"US", :country_code3=>"USA", :country_name=>"United States", :continent_code=>"NA", :region_name=>"CA", :city_name=>"Mountain View", :postal_code=>"94043", :latitude=>37.41919999999999, :longitude=>-122.0574, :dma_code=>807, :area_code=>650, :timezone=>"America/Los_Angeles"}]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class Baidu
|
101
|
+
private
|
102
|
+
def default_fixture_filename
|
103
|
+
"baidu_shanghai_pearl_tower"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
class BaiduIp
|
108
|
+
private
|
109
|
+
def default_fixture_filename
|
110
|
+
"baidu_ip_202_198_16_3"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
class Geocodio
|
115
|
+
private
|
116
|
+
def default_fixture_filename
|
117
|
+
"geocodio_1101_pennsylvania_ave"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
data/lib/sample_data.rb
ADDED
@@ -0,0 +1,577 @@
|
|
1
|
+
module Geocoder
|
2
|
+
module Lookup
|
3
|
+
class SampleData
|
4
|
+
class << self
|
5
|
+
def baidu_shanghai_pearl_tower
|
6
|
+
'{
|
7
|
+
"status":0,
|
8
|
+
"result":{
|
9
|
+
"location":{
|
10
|
+
"lng":116.30814954222,
|
11
|
+
"lat":40.056885091681
|
12
|
+
},
|
13
|
+
"precise":1,
|
14
|
+
"confidence":80,
|
15
|
+
"level":"\u5546\u52a1\u5927\u53a6"
|
16
|
+
}
|
17
|
+
}'
|
18
|
+
end
|
19
|
+
|
20
|
+
def baidu_ip_202_198_16_3
|
21
|
+
'{
|
22
|
+
"address": "CN|北京|北京|None|CHINANET|1|None",
|
23
|
+
"content": {
|
24
|
+
"address": "北京市",
|
25
|
+
"address_detail": {
|
26
|
+
"city": "北京市",
|
27
|
+
"city_code": 131,
|
28
|
+
"district": "",
|
29
|
+
"province": "北京市",
|
30
|
+
"street": "",
|
31
|
+
"street_number": ""
|
32
|
+
},
|
33
|
+
"point": {
|
34
|
+
"x": "116.39564504",
|
35
|
+
"y": "39.92998578"
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"status": 0
|
39
|
+
}'
|
40
|
+
end
|
41
|
+
|
42
|
+
def bing_madison_quare_garden
|
43
|
+
'{
|
44
|
+
"authenticationResultCode":"ValidCredentials",
|
45
|
+
"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
|
46
|
+
"copyright":"Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
|
47
|
+
"resourceSets":[
|
48
|
+
{
|
49
|
+
"estimatedTotal":1,
|
50
|
+
"resources":[
|
51
|
+
{
|
52
|
+
"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
|
53
|
+
"bbox":[
|
54
|
+
40.744944289326668,
|
55
|
+
-74.002353921532631,
|
56
|
+
40.755675807595253,
|
57
|
+
-73.983625397086143
|
58
|
+
],
|
59
|
+
"name":"Madison Square Garden, NY",
|
60
|
+
"point":{
|
61
|
+
"type":"Point",
|
62
|
+
"coordinates":[
|
63
|
+
40.75031,
|
64
|
+
-73.99299
|
65
|
+
]
|
66
|
+
},
|
67
|
+
"address":{
|
68
|
+
"adminDistrict":"NY",
|
69
|
+
"countryRegion":"United States",
|
70
|
+
"formattedAddress":"Madison Square Garden, NY",
|
71
|
+
"locality":"New York"
|
72
|
+
},
|
73
|
+
"confidence":"High",
|
74
|
+
"entityType":"Stadium"
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"statusCode":200,
|
80
|
+
"statusDescription":"OK",
|
81
|
+
"traceId":"55094ee53c8d45e789794014666328cd|CH1M001466|02.00.82.2800|CH1MSNVM001396, CH1MSNVM001370, CH1MSNVM001397"
|
82
|
+
}'
|
83
|
+
end
|
84
|
+
|
85
|
+
def cloudmake_madison_square_garden
|
86
|
+
'{"found": 2, "bounds": [[40.74983, -73.99433], [40.75116, -73.99266]], "features": [{"id": 32891803,"centroid": {"type":"POINT","coordinates":[40.75111, -73.99345]},"bounds": [[40.74983, -73.99433], [40.75116, -73.99266]],"properties": {"osm_element": "way", "sport": "hockey;basketball;lacrosse", "name": "Madison Square Garden", "leisure": "stadium", "osm_id": "24801588"},"location": {"county": "New York", "country": "United States of America", "postcode": "10119", "road": "West 31st Street", "city": "New York"},"type": "Feature"},{"id": 12977552,"centroid": {"type":"POINT","coordinates":[40.75066, -73.99347]},"bounds": [[40.75066, -73.99347], [40.75066, -73.99347]],"properties": {"building": "yes", "osm_element": "node", "name": "Madison Square Garden Center", "addr:state": "NY", "osm_id": "368045579"},"location": {"county": "New York", "country": "United States of America", "postcode": "10119", "road": "West 33rd Street", "city": "New York"},"type": "Feature"}], "type": "FeatureCollection", "crs": {"type": "EPSG", "properties": {"code": 4326, "coordinate_order": [0, 1]}}}'
|
87
|
+
end
|
88
|
+
|
89
|
+
def esri_madison_square_garder
|
90
|
+
'{
|
91
|
+
"spatialReference": {
|
92
|
+
"wkid": 4326,
|
93
|
+
"latestWkid": 4326
|
94
|
+
},
|
95
|
+
"locations": [
|
96
|
+
{
|
97
|
+
"name": "Madison Square Garden",
|
98
|
+
"extent": {
|
99
|
+
"xmin": -74.000241000000003,
|
100
|
+
"ymin": 40.744050000000001,
|
101
|
+
"xmax": -73.988241000000002,
|
102
|
+
"ymax": 40.756050000000002
|
103
|
+
},
|
104
|
+
"feature": {
|
105
|
+
"geometry": {
|
106
|
+
"x": -73.994238897999651,
|
107
|
+
"y": 40.750049813000487
|
108
|
+
},
|
109
|
+
"attributes": {
|
110
|
+
"Loc_name": "Gaz.WorldGazetteer.POI2",
|
111
|
+
"Score": 100,
|
112
|
+
"Match_addr": "Madison Square Garden",
|
113
|
+
"Addr_type": "POI",
|
114
|
+
"Type": "Sports Complex",
|
115
|
+
"PlaceName": "Madison Square Garden",
|
116
|
+
"Rank": "18",
|
117
|
+
"AddBldg": "",
|
118
|
+
"AddNum": "",
|
119
|
+
"AddNumFrom": "",
|
120
|
+
"AddNumTo": "",
|
121
|
+
"Side": "",
|
122
|
+
"StPreDir": "",
|
123
|
+
"StPreType": "",
|
124
|
+
"StName": "",
|
125
|
+
"StType": "",
|
126
|
+
"StDir": "",
|
127
|
+
"Nbrhd": "",
|
128
|
+
"City": "New York",
|
129
|
+
"Subregion": "New York",
|
130
|
+
"Region": "New York",
|
131
|
+
"Postal": "10001",
|
132
|
+
"PostalExt": "",
|
133
|
+
"Country": "USA",
|
134
|
+
"LangCode": "",
|
135
|
+
"Distance": 0,
|
136
|
+
"X": -73.994240000000005,
|
137
|
+
"Y": 40.750050000000002,
|
138
|
+
"DisplayX": -73.994240000000005,
|
139
|
+
"DisplayY": 40.750050000000002,
|
140
|
+
"Xmin": -74.000241000000003,
|
141
|
+
"Xmax": -73.988241000000002,
|
142
|
+
"Ymin": 40.744050000000001,
|
143
|
+
"Ymax": 40.756050000000002
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
]
|
148
|
+
}'
|
149
|
+
end
|
150
|
+
|
151
|
+
def freegeoip_74_200_247_59
|
152
|
+
'{
|
153
|
+
"city": "Plano",
|
154
|
+
"region_code": "TX",
|
155
|
+
"region_name": "Texas",
|
156
|
+
"metrocode": "623",
|
157
|
+
"zipcode": "75093",
|
158
|
+
"longitude": "-96.8134",
|
159
|
+
"country_name": "United States",
|
160
|
+
"country_code": "US",
|
161
|
+
"ip": "74.200.247.59",
|
162
|
+
"latitude": "33.0347"
|
163
|
+
}'
|
164
|
+
end
|
165
|
+
|
166
|
+
def geocoder_ca_madison_square_garden
|
167
|
+
'test({"longt":"-73.992006","latt":"40.749101"});'
|
168
|
+
end
|
169
|
+
|
170
|
+
def geocoder_us_madison_square_garden
|
171
|
+
'40.678107, -73.897460, 4 Pennsylvania Ave, New York, NY, 11207'
|
172
|
+
end
|
173
|
+
|
174
|
+
def geocodio_1101_pennsylvania_ave
|
175
|
+
'{"input":{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC"},"results":[{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC","zip":"20004"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC, 20004","location":{"lat":38.895019,"lng":-77.028095},"accuracy":1},{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC","zip":"20004"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC, 20004","location":{"lat":38.895016122449,"lng":-77.028084377551},"accuracy":0.8}]}'
|
176
|
+
end
|
177
|
+
|
178
|
+
def google_madison_square_garden
|
179
|
+
'{
|
180
|
+
"status": "OK",
|
181
|
+
"results": [ {
|
182
|
+
"types": [ "street_address" ],
|
183
|
+
"formatted_address": "4 Penn Plaza, New York, NY 10001, USA",
|
184
|
+
"address_components": [ {
|
185
|
+
"long_name": "4",
|
186
|
+
"short_name": "4",
|
187
|
+
"types": [ "street_number" ]
|
188
|
+
}, {
|
189
|
+
"long_name": "Penn Plaza",
|
190
|
+
"short_name": "Penn Plaza",
|
191
|
+
"types": [ "route" ]
|
192
|
+
}, {
|
193
|
+
"long_name": "Manhattan",
|
194
|
+
"short_name": "Manhattan",
|
195
|
+
"types": [ "sublocality", "political" ]
|
196
|
+
}, {
|
197
|
+
"long_name": "New York",
|
198
|
+
"short_name": "New York",
|
199
|
+
"types": [ "locality", "political" ]
|
200
|
+
}, {
|
201
|
+
"long_name": "New York",
|
202
|
+
"short_name": "New York",
|
203
|
+
"types": [ "administrative_area_level_2", "political" ]
|
204
|
+
}, {
|
205
|
+
"long_name": "New York",
|
206
|
+
"short_name": "NY",
|
207
|
+
"types": [ "administrative_area_level_1", "political" ]
|
208
|
+
}, {
|
209
|
+
"long_name": "United States",
|
210
|
+
"short_name": "US",
|
211
|
+
"types": [ "country", "political" ]
|
212
|
+
}, {
|
213
|
+
"long_name": "10001",
|
214
|
+
"short_name": "10001",
|
215
|
+
"types": [ "postal_code" ]
|
216
|
+
} ],
|
217
|
+
"geometry": {
|
218
|
+
"location": {
|
219
|
+
"lat": 40.7503540,
|
220
|
+
"lng": -73.9933710
|
221
|
+
},
|
222
|
+
"location_type": "ROOFTOP",
|
223
|
+
"viewport": {
|
224
|
+
"southwest": {
|
225
|
+
"lat": 40.7473324,
|
226
|
+
"lng": -73.9965316
|
227
|
+
},
|
228
|
+
"northeast": {
|
229
|
+
"lat": 40.7536276,
|
230
|
+
"lng": -73.9902364
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
} ]
|
235
|
+
}'
|
236
|
+
end
|
237
|
+
|
238
|
+
def here_madison_square_garden
|
239
|
+
'{
|
240
|
+
"Response": {
|
241
|
+
"MetaInfo": {
|
242
|
+
"Timestamp": "2013-02-08T16:26:39.382+0000"
|
243
|
+
},
|
244
|
+
"View": [
|
245
|
+
{
|
246
|
+
"_type": "SearchResultsViewType",
|
247
|
+
"ViewId": 0,
|
248
|
+
"Result": [
|
249
|
+
{
|
250
|
+
"Relevance": 1.0,
|
251
|
+
"MatchLevel": "houseNumber",
|
252
|
+
"MatchQuality": {
|
253
|
+
"State": 1.0,
|
254
|
+
"City": 1.0,
|
255
|
+
"Street": [
|
256
|
+
1.0
|
257
|
+
],
|
258
|
+
"HouseNumber": 1.0
|
259
|
+
},
|
260
|
+
"MatchType": "pointAddress",
|
261
|
+
"Location": {
|
262
|
+
"LocationId": "NT_ArsGdYbpo6dqjPQel9gTID_4",
|
263
|
+
"LocationType": "point",
|
264
|
+
"DisplayPosition": {
|
265
|
+
"Latitude": 40.7504692,
|
266
|
+
"Longitude": -73.9933777
|
267
|
+
},
|
268
|
+
"NavigationPosition": [
|
269
|
+
{
|
270
|
+
"Latitude": 40.7500305,
|
271
|
+
"Longitude": -73.9942398
|
272
|
+
}
|
273
|
+
],
|
274
|
+
"MapView": {
|
275
|
+
"TopLeft": {
|
276
|
+
"Latitude": 40.7515934,
|
277
|
+
"Longitude": -73.9948616
|
278
|
+
},
|
279
|
+
"BottomRight": {
|
280
|
+
"Latitude": 40.7493451,
|
281
|
+
"Longitude": -73.9918938
|
282
|
+
}
|
283
|
+
},
|
284
|
+
"Address": {
|
285
|
+
"Label": "4 Penn Plz, New York, NY 10001, United States",
|
286
|
+
"Country": "USA",
|
287
|
+
"State": "NY",
|
288
|
+
"County": "New York",
|
289
|
+
"City": "New York",
|
290
|
+
"Street": "Penn Plz",
|
291
|
+
"HouseNumber": "4",
|
292
|
+
"PostalCode": "10001",
|
293
|
+
"AdditionalData": [
|
294
|
+
{
|
295
|
+
"value": "United States",
|
296
|
+
"key": "CountryName"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
"value": "New York",
|
300
|
+
"key": "StateName"
|
301
|
+
}
|
302
|
+
]
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}
|
306
|
+
]
|
307
|
+
}
|
308
|
+
]
|
309
|
+
}
|
310
|
+
}'
|
311
|
+
end
|
312
|
+
|
313
|
+
def maxmind_74_200_247_59
|
314
|
+
'US,TX,Plano,75093,33.034698,-96.813400,623,972,"Layered Technologies , US","Layered Technologies , US",'
|
315
|
+
end
|
316
|
+
|
317
|
+
def nominatim_madison_square_garden
|
318
|
+
'[
|
319
|
+
{
|
320
|
+
"place_id": "30632629",
|
321
|
+
"licence": "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
|
322
|
+
"osm_type": "way",
|
323
|
+
"osm_id": "24801588",
|
324
|
+
"boundingbox": [
|
325
|
+
"40.749828338623",
|
326
|
+
"40.7511596679688",
|
327
|
+
"-73.9943389892578",
|
328
|
+
"-73.9926528930664"
|
329
|
+
],
|
330
|
+
"polygonpoints": [
|
331
|
+
[
|
332
|
+
"-73.9943346",
|
333
|
+
"40.7503638"
|
334
|
+
],
|
335
|
+
[
|
336
|
+
"-73.9942745",
|
337
|
+
"40.7504158"
|
338
|
+
],
|
339
|
+
[
|
340
|
+
"-73.9942593",
|
341
|
+
"40.750629"
|
342
|
+
],
|
343
|
+
[
|
344
|
+
"-73.9941343",
|
345
|
+
"40.7508432"
|
346
|
+
],
|
347
|
+
[
|
348
|
+
"-73.9939794",
|
349
|
+
"40.7509703"
|
350
|
+
],
|
351
|
+
[
|
352
|
+
"-73.9938042",
|
353
|
+
"40.7510532"
|
354
|
+
],
|
355
|
+
[
|
356
|
+
"-73.9938025",
|
357
|
+
"40.7511311"
|
358
|
+
],
|
359
|
+
[
|
360
|
+
"-73.9936051",
|
361
|
+
"40.7511571"
|
362
|
+
],
|
363
|
+
[
|
364
|
+
"-73.9935673",
|
365
|
+
"40.751105"
|
366
|
+
],
|
367
|
+
[
|
368
|
+
"-73.9934095",
|
369
|
+
"40.7511089"
|
370
|
+
],
|
371
|
+
[
|
372
|
+
"-73.9931235",
|
373
|
+
"40.7510548"
|
374
|
+
],
|
375
|
+
[
|
376
|
+
"-73.9928863",
|
377
|
+
"40.7509311"
|
378
|
+
],
|
379
|
+
[
|
380
|
+
"-73.9928068",
|
381
|
+
"40.750949"
|
382
|
+
],
|
383
|
+
[
|
384
|
+
"-73.992721",
|
385
|
+
"40.7508515"
|
386
|
+
],
|
387
|
+
[
|
388
|
+
"-73.9927444",
|
389
|
+
"40.7507889"
|
390
|
+
],
|
391
|
+
[
|
392
|
+
"-73.9926693",
|
393
|
+
"40.7506457"
|
394
|
+
],
|
395
|
+
[
|
396
|
+
"-73.9926597",
|
397
|
+
"40.7503657"
|
398
|
+
],
|
399
|
+
[
|
400
|
+
"-73.9928305",
|
401
|
+
"40.7500953"
|
402
|
+
],
|
403
|
+
[
|
404
|
+
"-73.9929757",
|
405
|
+
"40.7499911"
|
406
|
+
],
|
407
|
+
[
|
408
|
+
"-73.9931281",
|
409
|
+
"40.7499238"
|
410
|
+
],
|
411
|
+
[
|
412
|
+
"-73.993133",
|
413
|
+
"40.7498631"
|
414
|
+
],
|
415
|
+
[
|
416
|
+
"-73.9932961",
|
417
|
+
"40.7498306"
|
418
|
+
],
|
419
|
+
[
|
420
|
+
"-73.9933664",
|
421
|
+
"40.7498742"
|
422
|
+
],
|
423
|
+
[
|
424
|
+
"-73.993471",
|
425
|
+
"40.7498701"
|
426
|
+
],
|
427
|
+
[
|
428
|
+
"-73.9938023",
|
429
|
+
"40.7499263"
|
430
|
+
],
|
431
|
+
[
|
432
|
+
"-73.9940703",
|
433
|
+
"40.7500756"
|
434
|
+
],
|
435
|
+
[
|
436
|
+
"-73.9941876",
|
437
|
+
"40.7502038"
|
438
|
+
],
|
439
|
+
[
|
440
|
+
"-73.9942831",
|
441
|
+
"40.7502142"
|
442
|
+
],
|
443
|
+
[
|
444
|
+
"-73.9943346",
|
445
|
+
"40.7503638"
|
446
|
+
]
|
447
|
+
],
|
448
|
+
"lat": "40.7504928941818",
|
449
|
+
"lon": "-73.993466492276",
|
450
|
+
"display_name": "Madison Square Garden, West 31st Street, Long Island City, New York City, New York, 10001, United States of America",
|
451
|
+
"class": "leisure",
|
452
|
+
"type": "stadium",
|
453
|
+
"address": {
|
454
|
+
"stadium": "Madison Square Garden",
|
455
|
+
"road": "West 31st Street",
|
456
|
+
"suburb": "Long Island City",
|
457
|
+
"city": "New York City",
|
458
|
+
"county": "New York",
|
459
|
+
"state": "New York",
|
460
|
+
"postcode": "10001",
|
461
|
+
"country": "United States of America",
|
462
|
+
"country_code": "us"
|
463
|
+
}
|
464
|
+
}
|
465
|
+
]'
|
466
|
+
end
|
467
|
+
|
468
|
+
def yahoo_madison_square_garden
|
469
|
+
'{
|
470
|
+
"bossresponse": {
|
471
|
+
"responsecode": "200",
|
472
|
+
"placefinder": {
|
473
|
+
"start": "0",
|
474
|
+
"count": "1",
|
475
|
+
"request": "flags=JXTSR&location=Madison%20Square%20Garden%2C%20NY%2C%20NY&%unsafe%appid=%5B%22dj0yJmk9ZmZ5NXFrNGhNcEthJmQ9WVdrOVFUSlhPV2x1TjJVbWNHbzlORE0wT0RFME9UWXkmcz1jb25zdW1lcnNlY3JldCZ4PTAy%22%2C%20%22b57b1b98eb21f171231f5b441cba505261d6c9bb%22%5D&gflags=AC&locale=en_US",
|
476
|
+
"results": [
|
477
|
+
{
|
478
|
+
"quality": "90",
|
479
|
+
"latitude": "40.750381",
|
480
|
+
"longitude": "-73.993988",
|
481
|
+
"offsetlat": "40.750381",
|
482
|
+
"offsetlon": "-73.993988",
|
483
|
+
"radius": "400",
|
484
|
+
"boundingbox": {
|
485
|
+
"north": "40.750832",
|
486
|
+
"south": "40.749931",
|
487
|
+
"east": "-73.993393",
|
488
|
+
"west": "-73.994591"
|
489
|
+
},
|
490
|
+
"name": "Madison Square Garden",
|
491
|
+
"line1": "Madison Square Garden",
|
492
|
+
"line2": "New York, NY 10001",
|
493
|
+
"line3": "",
|
494
|
+
"line4": "United States",
|
495
|
+
"cross": "",
|
496
|
+
"house": "",
|
497
|
+
"street": "",
|
498
|
+
"xstreet": "",
|
499
|
+
"unittype": "",
|
500
|
+
"unit": "",
|
501
|
+
"postal": "10001",
|
502
|
+
"neighborhood": "Garment District|Midtown|Midtown West|Manhattan",
|
503
|
+
"city": "New York",
|
504
|
+
"county": "New York County",
|
505
|
+
"state": "New York",
|
506
|
+
"country": "United States",
|
507
|
+
"countrycode": "US",
|
508
|
+
"statecode": "NY",
|
509
|
+
"countycode": "",
|
510
|
+
"timezone": "America/New_York",
|
511
|
+
"areacode": "212",
|
512
|
+
"uzip": "10001",
|
513
|
+
"hash": "",
|
514
|
+
"woeid": "23617041",
|
515
|
+
"woetype": "20"
|
516
|
+
}
|
517
|
+
]
|
518
|
+
}
|
519
|
+
}
|
520
|
+
}'
|
521
|
+
|
522
|
+
end
|
523
|
+
|
524
|
+
def yandex_kremlin
|
525
|
+
'{
|
526
|
+
"response": {
|
527
|
+
"GeoObjectCollection": {
|
528
|
+
"metaDataProperty": {
|
529
|
+
"GeocoderResponseMetaData": {
|
530
|
+
"request": "Кремль, Moscow, Russia",
|
531
|
+
"found": "1",
|
532
|
+
"results": "10"
|
533
|
+
}
|
534
|
+
},
|
535
|
+
"featureMember": [
|
536
|
+
{
|
537
|
+
"GeoObject": {
|
538
|
+
"metaDataProperty": {
|
539
|
+
"GeocoderMetaData": {
|
540
|
+
"kind": "vegetation",
|
541
|
+
"text": "Россия, Москва, Московский Кремль",
|
542
|
+
"precision": "other",
|
543
|
+
"AddressDetails": {
|
544
|
+
"Country": {
|
545
|
+
"CountryNameCode": "RU",
|
546
|
+
"CountryName": "Россия",
|
547
|
+
"Locality": {
|
548
|
+
"LocalityName": "Москва",
|
549
|
+
"Premise": {
|
550
|
+
"PremiseName": "Московский Кремль"
|
551
|
+
}
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|
556
|
+
},
|
557
|
+
"name": "Московский Кремль",
|
558
|
+
"boundedBy": {
|
559
|
+
"Envelope": {
|
560
|
+
"lowerCorner": "37.584182 55.733361",
|
561
|
+
"upperCorner": "37.650064 55.770517"
|
562
|
+
}
|
563
|
+
},
|
564
|
+
"Point": {
|
565
|
+
"pos": "37.617123 55.751943"
|
566
|
+
}
|
567
|
+
}
|
568
|
+
}
|
569
|
+
]
|
570
|
+
}
|
571
|
+
}
|
572
|
+
}'
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
576
|
+
end
|
577
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dummy_geocoder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hieu Nguyen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple library for mocking geocoder
|
14
|
+
email: hieu.nguyen@eastagile.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/dummy_geocoder.rb
|
20
|
+
- lib/sample_data.rb
|
21
|
+
- lib/version.rb
|
22
|
+
homepage: https://github.com/hieuk09/dummy_geocoder
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.2.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Dummy Geocoder
|
46
|
+
test_files: []
|