mapquest 0.0.1 → 0.0.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.
@@ -0,0 +1 @@
1
+ {"route":{},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":403,"messages":["This is not a valid key. Please check that you have entered this correctly. If you do not have a key, you can obtain a free key by registering at http://developer.mapquest.com."]}}
@@ -0,0 +1 @@
1
+ {"route":{},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":400,"messages":["Error processing route request","Invalid value 'false' for parameter 'units'. Valid options are: [m, k, wmin, dmin, dm, dk]"]}}
@@ -0,0 +1 @@
1
+ {"route":{"hasTollRoad":false,"computedWaypoints":[],"fuelUsed":1.19566,"hasUnpaved":false,"hasHighway":true,"realTime":2153,"boundingBox":{"ul":{"lng":-76.730422,"lat":40.063938},"lr":{"lng":-76.305679,"lat":39.961879}},"distance":25.919,"time":2359,"locationSequence":[0,1],"sessionId":"51993344-015b-0007-02b7-3525-d485645bb58e","locations":[{"latLng":{"lng":-76.305801,"lat":40.0378},"adminArea4":"Lancaster County","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"Lancaster","street":"","adminArea1":"US","adminArea3":"PA","type":"s","displayLatLng":{"lng":-76.305801,"lat":40.037799},"linkId":18891356,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","adminArea3Type":"State"},{"latLng":{"lng":-76.728104,"lat":39.962502},"adminArea4":"York County","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"York","street":"","adminArea1":"US","adminArea3":"PA","type":"s","displayLatLng":{"lng":-76.728103,"lat":39.962501},"linkId":97982863,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","adminArea3Type":"State"}],"hasSeasonalClosure":false,"hasCountryCross":false,"legs":[{"hasTollRoad":false,"index":0,"roadGradeStrategy":[[]],"hasHighway":true,"hasUnpaved":false,"distance":25.919,"time":2359,"origIndex":3,"hasSeasonalClosure":false,"origNarrative":"Go west on US-30 W.","hasCountryCross":false,"formattedTime":"00:39:19","destNarrative":"Proceed to YORK, PA.","destIndex":3,"maneuvers":[{"signs":[{"text":"72","extraText":"","direction":1,"type":537,"url":"http://icons.mqcdn.com/icons/rs537.png?n=72&d=NORTH"}],"index":0,"maneuverNotes":[],"direction":1,"narrative":"Start out going north on S Queen St/PA-72 N toward E King St/Penn Sq/PA-462 E.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/icon-dirs-start_sm.gif","distance":0.562,"time":115,"linkIds":[],"streets":["S Queen St","PA-72 N"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:01:55","directionName":"North","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-1,40.037822,-76.305679,0,0|purple-2,40.045871,-76.307182,0,0|&center=40.0418465,-76.3064305&zoom=10&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.305679,"lat":40.037822},"turnType":0},{"signs":[],"index":1,"maneuverNotes":[],"direction":7,"narrative":"Turn left onto W James St.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif","distance":0.149,"time":38,"linkIds":[],"streets":["W James St"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:00:38","directionName":"West","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-2,40.045871,-76.307182,0,0|purple-3,40.045958999999996,-76.30989,0,0|&center=40.045914999999994,-76.308536&zoom=13&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.307182,"lat":40.045871},"turnType":6},{"signs":[],"index":2,"maneuverNotes":[],"direction":2,"narrative":"W James St becomes Harrisburg Pike.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_straight_sm.gif","distance":2.06,"time":275,"linkIds":[],"streets":["Harrisburg Pike"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:04:35","directionName":"Northwest","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-3,40.045958999999996,-76.30989,0,0|purple-4,40.063938,-76.340538,0,0|&center=40.054948499999995,-76.32521399999999&zoom=9&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.30989,"lat":40.045959},"turnType":0},{"signs":[{"text":"30","extraText":"","direction":7,"type":2,"url":"http://icons.mqcdn.com/icons/rs2.png?n=30&d=WEST"}],"index":3,"maneuverNotes":[],"direction":7,"narrative":"Merge onto US-30 W via the ramp on the left toward York.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_merge_left_sm.gif","distance":20.983,"time":1501,"linkIds":[],"streets":["US-30 W"],"attributes":128,"transportMode":"AUTO","formattedTime":"00:25:01","directionName":"West","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-4,40.063938,-76.340538,0,0|purple-5,39.982459999999996,-76.708152,0,0|&center=40.023199,-76.524345&zoom=6&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.340538,"lat":40.063938},"turnType":11},{"signs":[],"index":4,"maneuverNotes":[],"direction":4,"narrative":"Turn left onto N Sherman St.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif","distance":0.907,"time":173,"linkIds":[],"streets":["N Sherman St"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:02:53","directionName":"South","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-5,39.982459999999996,-76.708152,0,0|purple-6,39.970081,-76.712593,0,0|&center=39.9762705,-76.7103725&zoom=9&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.708152,"lat":39.98246},"turnType":6},{"signs":[{"text":"462","extraText":"","direction":7,"type":537,"url":"http://icons.mqcdn.com/icons/rs537.png?n=462&d=WEST"}],"index":5,"maneuverNotes":[],"direction":6,"narrative":"Turn right onto E Philadelphia St/PA-462 W.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_right_sm.gif","distance":1.062,"time":217,"linkIds":[],"streets":["E Philadelphia St","PA-462 W"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:03:37","directionName":"Southwest","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-6,39.970081,-76.712593,0,0|purple-7,39.963279,-76.73042199999999,0,0|&center=39.96668,-76.7215075&zoom=10&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.712593,"lat":39.970081},"turnType":2},{"signs":[],"index":6,"maneuverNotes":[],"direction":5,"narrative":"Turn left onto N Beaver St.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif","distance":0.104,"time":27,"linkIds":[],"streets":["N Beaver St"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:00:27","directionName":"Southeast","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-7,39.963279,-76.73042199999999,0,0|purple-8,39.961878999999996,-76.729682,0,0|&center=39.962579,-76.730052&zoom=13&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.730422,"lat":39.963279},"turnType":6},{"signs":[{"text":"74","extraText":"","direction":4,"type":537,"url":"http://icons.mqcdn.com/icons/rs537.png?n=74&d=SOUTH"},{"text":"462","extraText":"","direction":8,"type":537,"url":"http://icons.mqcdn.com/icons/rs537.png?n=462&d=EAST"}],"index":7,"maneuverNotes":[],"direction":8,"narrative":"Turn left onto W Market St/PA-74 S/PA-462 E.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif","distance":0.092,"time":13,"linkIds":[],"streets":["W Market St","PA-74 S","PA-462 E"],"attributes":0,"transportMode":"AUTO","formattedTime":"00:00:13","directionName":"East","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-8,39.961878999999996,-76.729682,0,0|purple-9,39.962340999999995,-76.72805,0,0|&center=39.962109999999996,-76.728866&zoom=14&rand=30560672&session=51993344-015b-0007-02b7-3525-d485645bb58e","startPoint":{"lng":-76.729682,"lat":39.961879},"turnType":6},{"signs":[],"index":8,"maneuverNotes":[],"direction":0,"narrative":"Welcome to YORK, PA.","iconUrl":"http://content.mapquest.com/mqsite/turnsigns/icon-dirs-end_sm.gif","distance":0,"time":0,"linkIds":[],"streets":[],"attributes":0,"transportMode":"AUTO","formattedTime":"00:00:00","directionName":"","startPoint":{"lng":-76.72805,"lat":39.962341},"turnType":-1}],"hasFerry":false}],"formattedTime":"00:39:19","options":{"mustAvoidLinkIds":[],"drivingStyle":2,"countryBoundaryDisplay":true,"generalize":-1,"narrativeType":"text","locale":"en_US","avoidTimedConditions":false,"destinationManeuverDisplay":true,"enhancedNarrative":false,"filterZoneFactor":-1,"timeType":0,"maxWalkingDistance":-1,"routeType":"FASTEST","transferPenalty":-1,"stateBoundaryDisplay":true,"walkingSpeed":-1,"maxLinkId":0,"arteryWeights":[],"tryAvoidLinkIds":[],"unit":"M","routeNumber":0,"shapeFormat":"raw","maneuverPenalty":-1,"useTraffic":false,"returnLinkDirections":false,"avoidTripIds":[],"manmaps":"true","highwayEfficiency":22,"sideOfStreetDisplay":true,"cyclingRoadFactor":1,"urbanAvoidFactor":-1},"hasFerry":false},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":0,"messages":[]}}
@@ -0,0 +1,366 @@
1
+ {
2
+ "route": {
3
+ "hasTollRoad": false,
4
+ "computedWaypoints": [],
5
+ "fuelUsed": 1.19566,
6
+ "hasUnpaved": false,
7
+ "hasHighway": true,
8
+ "realTime": 2152,
9
+ "boundingBox": {
10
+ "ul": {
11
+ "lng": -76.730422,
12
+ "lat": 40.063938
13
+ },
14
+ "lr": {
15
+ "lng": -76.305679,
16
+ "lat": 39.961879
17
+ }
18
+ },
19
+ "distance": 25.919,
20
+ "time": 2359,
21
+ "locationSequence": [0, 1],
22
+ "sessionId": "518e8da5-01fa-000e-02b7-3523-d485645bb58e",
23
+ "locations": [{
24
+ "latLng": {
25
+ "lng": -76.305801,
26
+ "lat": 40.0378
27
+ },
28
+ "adminArea4": "Lancaster County",
29
+ "adminArea5Type": "City",
30
+ "adminArea4Type": "County",
31
+ "adminArea5": "Lancaster",
32
+ "street": "",
33
+ "adminArea1": "US",
34
+ "adminArea3": "PA",
35
+ "type": "s",
36
+ "displayLatLng": {
37
+ "lng": -76.305801,
38
+ "lat": 40.037799
39
+ },
40
+ "linkId": 18891356,
41
+ "postalCode": "",
42
+ "sideOfStreet": "N",
43
+ "dragPoint": false,
44
+ "adminArea1Type": "Country",
45
+ "geocodeQuality": "CITY",
46
+ "geocodeQualityCode": "A5XAX",
47
+ "adminArea3Type": "State"
48
+ }, {
49
+ "latLng": {
50
+ "lng": -76.728104,
51
+ "lat": 39.962502
52
+ },
53
+ "adminArea4": "York County",
54
+ "adminArea5Type": "City",
55
+ "adminArea4Type": "County",
56
+ "adminArea5": "York",
57
+ "street": "",
58
+ "adminArea1": "US",
59
+ "adminArea3": "PA",
60
+ "type": "s",
61
+ "displayLatLng": {
62
+ "lng": -76.728103,
63
+ "lat": 39.962501
64
+ },
65
+ "linkId": 97982863,
66
+ "postalCode": "",
67
+ "sideOfStreet": "N",
68
+ "dragPoint": false,
69
+ "adminArea1Type": "Country",
70
+ "geocodeQuality": "CITY",
71
+ "geocodeQualityCode": "A5XAX",
72
+ "adminArea3Type": "State"
73
+ }
74
+ ],
75
+ "hasSeasonalClosure": false,
76
+ "hasCountryCross": false,
77
+ "legs": [{
78
+ "hasTollRoad": false,
79
+ "index": 0,
80
+ "roadGradeStrategy": [
81
+ []
82
+ ],
83
+ "hasHighway": true,
84
+ "hasUnpaved": false,
85
+ "distance": 25.919,
86
+ "time": 2359,
87
+ "origIndex": 3,
88
+ "hasSeasonalClosure": false,
89
+ "origNarrative": "Go west on US-30 W.",
90
+ "hasCountryCross": false,
91
+ "formattedTime": "00:39:19",
92
+ "destNarrative": "Proceed to YORK, PA.",
93
+ "destIndex": 3,
94
+ "maneuvers": [{
95
+ "signs": [{
96
+ "text": "72",
97
+ "extraText": "",
98
+ "direction": 1,
99
+ "type": 537,
100
+ "url": "http://icons.mqcdn.com/icons/rs537.png?n=72&d=NORTH"
101
+ }
102
+ ],
103
+ "index": 0,
104
+ "maneuverNotes": [],
105
+ "direction": 1,
106
+ "narrative": "Start out going north on S Queen St/PA-72 N toward E King St/Penn Sq/PA-462 E.",
107
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/icon-dirs-start_sm.gif",
108
+ "distance": 0.562,
109
+ "time": 115,
110
+ "linkIds": [],
111
+ "streets": ["S Queen St", "PA-72 N"],
112
+ "attributes": 0,
113
+ "transportMode": "AUTO",
114
+ "formattedTime": "00:01:55",
115
+ "directionName": "North",
116
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-1,40.037822,-76.305679,0,0|purple-2,40.045871,-76.307182,0,0|&center=40.0418465,-76.3064305&zoom=10&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
117
+ "startPoint": {
118
+ "lng": -76.305679,
119
+ "lat": 40.037822
120
+ },
121
+ "turnType": 0
122
+ }, {
123
+ "signs": [],
124
+ "index": 1,
125
+ "maneuverNotes": [],
126
+ "direction": 7,
127
+ "narrative": "Turn left onto W James St.",
128
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif",
129
+ "distance": 0.149,
130
+ "time": 38,
131
+ "linkIds": [],
132
+ "streets": ["W James St"],
133
+ "attributes": 0,
134
+ "transportMode": "AUTO",
135
+ "formattedTime": "00:00:38",
136
+ "directionName": "West",
137
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-2,40.045871,-76.307182,0,0|purple-3,40.045958999999996,-76.30989,0,0|&center=40.045914999999994,-76.308536&zoom=13&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
138
+ "startPoint": {
139
+ "lng": -76.307182,
140
+ "lat": 40.045871
141
+ },
142
+ "turnType": 6
143
+ }, {
144
+ "signs": [],
145
+ "index": 2,
146
+ "maneuverNotes": [],
147
+ "direction": 2,
148
+ "narrative": "W James St becomes Harrisburg Pike.",
149
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_straight_sm.gif",
150
+ "distance": 2.06,
151
+ "time": 275,
152
+ "linkIds": [],
153
+ "streets": ["Harrisburg Pike"],
154
+ "attributes": 0,
155
+ "transportMode": "AUTO",
156
+ "formattedTime": "00:04:35",
157
+ "directionName": "Northwest",
158
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-3,40.045958999999996,-76.30989,0,0|purple-4,40.063938,-76.340538,0,0|&center=40.054948499999995,-76.32521399999999&zoom=9&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
159
+ "startPoint": {
160
+ "lng": -76.30989,
161
+ "lat": 40.045959
162
+ },
163
+ "turnType": 0
164
+ }, {
165
+ "signs": [{
166
+ "text": "30",
167
+ "extraText": "",
168
+ "direction": 7,
169
+ "type": 2,
170
+ "url": "http://icons.mqcdn.com/icons/rs2.png?n=30&d=WEST"
171
+ }
172
+ ],
173
+ "index": 3,
174
+ "maneuverNotes": [],
175
+ "direction": 7,
176
+ "narrative": "Merge onto US-30 W via the ramp on the left toward York.",
177
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_merge_left_sm.gif",
178
+ "distance": 20.983,
179
+ "time": 1501,
180
+ "linkIds": [],
181
+ "streets": ["US-30 W"],
182
+ "attributes": 128,
183
+ "transportMode": "AUTO",
184
+ "formattedTime": "00:25:01",
185
+ "directionName": "West",
186
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-4,40.063938,-76.340538,0,0|purple-5,39.982459999999996,-76.708152,0,0|&center=40.023199,-76.524345&zoom=6&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
187
+ "startPoint": {
188
+ "lng": -76.340538,
189
+ "lat": 40.063938
190
+ },
191
+ "turnType": 11
192
+ }, {
193
+ "signs": [],
194
+ "index": 4,
195
+ "maneuverNotes": [],
196
+ "direction": 4,
197
+ "narrative": "Turn left onto N Sherman St.",
198
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif",
199
+ "distance": 0.907,
200
+ "time": 173,
201
+ "linkIds": [],
202
+ "streets": ["N Sherman St"],
203
+ "attributes": 0,
204
+ "transportMode": "AUTO",
205
+ "formattedTime": "00:02:53",
206
+ "directionName": "South",
207
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-5,39.982459999999996,-76.708152,0,0|purple-6,39.970081,-76.712593,0,0|&center=39.9762705,-76.7103725&zoom=9&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
208
+ "startPoint": {
209
+ "lng": -76.708152,
210
+ "lat": 39.98246
211
+ },
212
+ "turnType": 6
213
+ }, {
214
+ "signs": [{
215
+ "text": "462",
216
+ "extraText": "",
217
+ "direction": 7,
218
+ "type": 537,
219
+ "url": "http://icons.mqcdn.com/icons/rs537.png?n=462&d=WEST"
220
+ }
221
+ ],
222
+ "index": 5,
223
+ "maneuverNotes": [],
224
+ "direction": 6,
225
+ "narrative": "Turn right onto E Philadelphia St/PA-462 W.",
226
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_right_sm.gif",
227
+ "distance": 1.062,
228
+ "time": 217,
229
+ "linkIds": [],
230
+ "streets": ["E Philadelphia St", "PA-462 W"],
231
+ "attributes": 0,
232
+ "transportMode": "AUTO",
233
+ "formattedTime": "00:03:37",
234
+ "directionName": "Southwest",
235
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-6,39.970081,-76.712593,0,0|purple-7,39.963279,-76.73042199999999,0,0|&center=39.96668,-76.7215075&zoom=10&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
236
+ "startPoint": {
237
+ "lng": -76.712593,
238
+ "lat": 39.970081
239
+ },
240
+ "turnType": 2
241
+ }, {
242
+ "signs": [],
243
+ "index": 6,
244
+ "maneuverNotes": [],
245
+ "direction": 5,
246
+ "narrative": "Turn left onto N Beaver St.",
247
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif",
248
+ "distance": 0.104,
249
+ "time": 27,
250
+ "linkIds": [],
251
+ "streets": ["N Beaver St"],
252
+ "attributes": 0,
253
+ "transportMode": "AUTO",
254
+ "formattedTime": "00:00:27",
255
+ "directionName": "Southeast",
256
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-7,39.963279,-76.73042199999999,0,0|purple-8,39.961878999999996,-76.729682,0,0|&center=39.962579,-76.730052&zoom=13&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
257
+ "startPoint": {
258
+ "lng": -76.730422,
259
+ "lat": 39.963279
260
+ },
261
+ "turnType": 6
262
+ }, {
263
+ "signs": [{
264
+ "text": "74",
265
+ "extraText": "",
266
+ "direction": 4,
267
+ "type": 537,
268
+ "url": "http://icons.mqcdn.com/icons/rs537.png?n=74&d=SOUTH"
269
+ }, {
270
+ "text": "462",
271
+ "extraText": "",
272
+ "direction": 8,
273
+ "type": 537,
274
+ "url": "http://icons.mqcdn.com/icons/rs537.png?n=462&d=EAST"
275
+ }
276
+ ],
277
+ "index": 7,
278
+ "maneuverNotes": [],
279
+ "direction": 8,
280
+ "narrative": "Turn left onto W Market St/PA-74 S/PA-462 E.",
281
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif",
282
+ "distance": 0.092,
283
+ "time": 13,
284
+ "linkIds": [],
285
+ "streets": ["W Market St", "PA-74 S", "PA-462 E"],
286
+ "attributes": 0,
287
+ "transportMode": "AUTO",
288
+ "formattedTime": "00:00:13",
289
+ "directionName": "East",
290
+ "mapUrl": "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-8,39.961878999999996,-76.729682,0,0|purple-9,39.962340999999995,-76.72805,0,0|&center=39.962109999999996,-76.728866&zoom=14&rand=166378434&session=518e8da5-01fa-000e-02b7-3523-d485645bb58e",
291
+ "startPoint": {
292
+ "lng": -76.729682,
293
+ "lat": 39.961879
294
+ },
295
+ "turnType": 6
296
+ }, {
297
+ "signs": [],
298
+ "index": 8,
299
+ "maneuverNotes": [],
300
+ "direction": 0,
301
+ "narrative": "Welcome to YORK, PA.",
302
+ "iconUrl": "http://content.mapquest.com/mqsite/turnsigns/icon-dirs-end_sm.gif",
303
+ "distance": 0,
304
+ "time": 0,
305
+ "linkIds": [],
306
+ "streets": [],
307
+ "attributes": 0,
308
+ "transportMode": "AUTO",
309
+ "formattedTime": "00:00:00",
310
+ "directionName": "",
311
+ "startPoint": {
312
+ "lng": -76.72805,
313
+ "lat": 39.962341
314
+ },
315
+ "turnType": -1
316
+ }
317
+ ],
318
+ "hasFerry": false
319
+ }
320
+ ],
321
+ "formattedTime": "00:39:19",
322
+ "options": {
323
+ "mustAvoidLinkIds": [],
324
+ "drivingStyle": 2,
325
+ "countryBoundaryDisplay": true,
326
+ "generalize": -1,
327
+ "narrativeType": "text",
328
+ "locale": "en_US",
329
+ "avoidTimedConditions": false,
330
+ "destinationManeuverDisplay": true,
331
+ "enhancedNarrative": false,
332
+ "filterZoneFactor": -1,
333
+ "timeType": 0,
334
+ "maxWalkingDistance": -1,
335
+ "routeType": "FASTEST",
336
+ "transferPenalty": -1,
337
+ "stateBoundaryDisplay": true,
338
+ "walkingSpeed": -1,
339
+ "maxLinkId": 0,
340
+ "arteryWeights": [],
341
+ "tryAvoidLinkIds": [],
342
+ "unit": "M",
343
+ "routeNumber": 0,
344
+ "shapeFormat": "raw",
345
+ "maneuverPenalty": -1,
346
+ "useTraffic": false,
347
+ "returnLinkDirections": false,
348
+ "avoidTripIds": [],
349
+ "manmaps": "true",
350
+ "highwayEfficiency": 22,
351
+ "sideOfStreetDisplay": true,
352
+ "cyclingRoadFactor": 1,
353
+ "urbanAvoidFactor": -1
354
+ },
355
+ "hasFerry": false
356
+ },
357
+ "info": {
358
+ "copyright": {
359
+ "text": "© 2013 MapQuest, Inc.",
360
+ "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
361
+ "imageAltText": "© 2013 MapQuest, Inc."
362
+ },
363
+ "statuscode": 0,
364
+ "messages": []
365
+ }
366
+ }
@@ -0,0 +1 @@
1
+ {"results":[{"locations":[],"providedLocation":{}}],"options":{"ignoreLatLngInput":false,"maxResults":-1,"thumbMaps":true},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":400,"messages":["Illegal argument from request: Value passed was 'dfsd'"]}}
@@ -0,0 +1 @@
1
+ {"results":[{"locations":[{"latLng":{"lng":-0.12766,"lat":51.507276},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.12766,"lat":51.507276},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-1,51.5072759,-0.1276597,0,0|&center=51.5072759,-0.1276597&zoom=12&rand=-572938956","adminArea3Type":"State"},{"latLng":{"lng":-3.049338,"lat":59.135418},"adminArea4":"Rousay","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"Scotland","type":"s","displayLatLng":{"lng":-3.049338,"lat":59.135418},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-2,59.1354177,-3.0493379,0,0|&center=59.1354177,-3.0493379&zoom=12&rand=-572938956","adminArea3Type":"State"}],"providedLocation":{"location":"London, UK"}}],"options":{"ignoreLatLngInput":false,"maxResults":2,"thumbMaps":true},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":0,"messages":[]}}
@@ -0,0 +1 @@
1
+ {"results":[{"locations":[{"latLng":{"lng":-0.12766,"lat":51.507276},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.12766,"lat":51.507276},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-1,51.5072759,-0.1276597,0,0|&center=51.5072759,-0.1276597&zoom=12&rand=-1248245486","adminArea3Type":"State"},{"latLng":{"lng":-3.049338,"lat":59.135418},"adminArea4":"Rousay","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"Scotland","type":"s","displayLatLng":{"lng":-3.049338,"lat":59.135418},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-2,59.1354177,-3.0493379,0,0|&center=59.1354177,-3.0493379&zoom=12&rand=-1248245486","adminArea3Type":"State"},{"latLng":{"lng":-0.141158,"lat":51.517561},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"City of Westminster","street":"Mortimer Street","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.141158,"lat":51.517561},"linkId":0,"postalCode":"W1B 3DG","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-3,51.5175614698645,-0.141158489226213,0,0|&center=51.5175614698645,-0.141158489226213&zoom=15&rand=-1248245486","adminArea3Type":"State"},{"latLng":{"lng":-0.132185,"lat":51.516195},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"City of Westminster","street":"47 Oxford Street","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.132185,"lat":51.516195},"linkId":0,"postalCode":"W1D 2DU","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-4,51.5161952,-0.1321849,0,0|&center=51.5161952,-0.1321849&zoom=15&rand=-1248245486","adminArea3Type":"State"},{"latLng":{"lng":-2.978759,"lat":51.350317},"adminArea4":"North Somerset","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"Weston-super-Mare","street":"Waterloo Street","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-2.978759,"lat":51.350317},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-5,51.3503173,-2.9787593,0,0|&center=51.3503173,-2.9787593&zoom=15&rand=-1248245486","adminArea3Type":"State"},{"latLng":{"lng":-0.111696,"lat":51.601489},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London Borough of Haringey","street":"Canning Crescent","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.111696,"lat":51.601489},"linkId":0,"postalCode":"N22 8LE","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-6,51.6014893,-0.1116958,0,0|&center=51.6014893,-0.1116958&zoom=15&rand=-1248245486","adminArea3Type":"State"}],"providedLocation":{"location":"London, UK"}}],"options":{"ignoreLatLngInput":false,"maxResults":-1,"thumbMaps":true},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":0,"messages":[]}}
@@ -0,0 +1 @@
1
+ {"results":[{"locations":[{"latLng":{"lng":-0.12766,"lat":51.507276},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.12766,"lat":51.507276},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","adminArea3Type":"State"},{"latLng":{"lng":-3.049338,"lat":59.135418},"adminArea4":"Rousay","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"Scotland","type":"s","displayLatLng":{"lng":-3.049338,"lat":59.135418},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","adminArea3Type":"State"},{"latLng":{"lng":-0.141158,"lat":51.517561},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"City of Westminster","street":"Mortimer Street","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.141158,"lat":51.517561},"linkId":0,"postalCode":"W1B 3DG","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","adminArea3Type":"State"},{"latLng":{"lng":-0.132185,"lat":51.516195},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"City of Westminster","street":"47 Oxford Street","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.132185,"lat":51.516195},"linkId":0,"postalCode":"W1D 2DU","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","adminArea3Type":"State"},{"latLng":{"lng":-2.978759,"lat":51.350317},"adminArea4":"North Somerset","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"Weston-super-Mare","street":"Waterloo Street","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-2.978759,"lat":51.350317},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","adminArea3Type":"State"},{"latLng":{"lng":-0.111696,"lat":51.601489},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London Borough of Haringey","street":"Canning Crescent","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.111696,"lat":51.601489},"linkId":0,"postalCode":"N22 8LE","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1XXX","adminArea3Type":"State"}],"providedLocation":{"location":"London, UK"}}],"options":{"ignoreLatLngInput":false,"maxResults":-1,"thumbMaps":false},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":0,"messages":[]}}
@@ -0,0 +1 @@
1
+ {"results":[{"locations":[{"latLng":{"lng":-0.12766,"lat":51.507276},"adminArea4":"London","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"England","type":"s","displayLatLng":{"lng":-0.12766,"lat":51.507276},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","adminArea3Type":"State"},{"latLng":{"lng":-3.049338,"lat":59.135418},"adminArea4":"Rousay","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"London","street":"","adminArea1":"GB","adminArea3":"Scotland","type":"s","displayLatLng":{"lng":-3.049338,"lat":59.135418},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"CITY","geocodeQualityCode":"A5XAX","adminArea3Type":"State"}],"providedLocation":{"location":"London, UK"}}],"options":{"ignoreLatLngInput":false,"maxResults":2,"thumbMaps":false},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":0,"messages":[]}}
@@ -0,0 +1 @@
1
+ {"results":[{"locations":[{"latLng":{"lng":-76.329999,"lat":40.0755},"adminArea4":"Lancaster","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"Lancaster","street":"300 Granite Run Dr","adminArea1":"US","adminArea3":"PA","type":"s","displayLatLng":{"lng":-76.329999,"lat":40.0755},"linkId":90819339,"postalCode":"17601","sideOfStreet":"L","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"ADDRESS","geocodeQualityCode":"L1AAA","mapUrl":"http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2d6ynu,7a=o5-9u22gr&type=map&size=225,160&pois=purple-1,40.0755,-76.329999,0,0|&center=40.0755,-76.329999&zoom=15&rand=227718572","adminArea3Type":"State"}],"providedLocation":{"latLng":{"lng":-76.329999,"lat":40.0755}}}],"options":{"ignoreLatLngInput":false,"maxResults":-1,"thumbMaps":true},"info":{"copyright":{"text":"© 2013 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2013 MapQuest, Inc."},"statuscode":0,"messages":[]}}
@@ -0,0 +1,172 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe MapQuest::Services::Geocoding do
4
+
5
+ let(:mapquest) { MapQuest.new 'xxx' }
6
+
7
+ describe '#geocoding' do
8
+ it 'should be an instance of Geocoding' do
9
+ mapquest.geocoding.should be_an_instance_of MapQuest::Services::Geocoding
10
+ end
11
+ end
12
+
13
+ describe '#address' do
14
+
15
+ context 'location is not provided' do
16
+ it 'should raise an error if location is not provided' do
17
+ expect { mapquest.geocoding.address }.to raise_error ArgumentError
18
+ end
19
+ end
20
+
21
+ context 'location is provided' do
22
+ subject(:geocoding) { mapquest.geocoding.address 'London, UK' }
23
+
24
+ it 'should receive a location' do
25
+ fixture = fixture 'geocoding/location_only'
26
+ query = {
27
+ :key => 'xxx',
28
+ :location => 'London, UK'
29
+ }
30
+ stub_request(:get, 'www.mapquestapi.com/geocoding/v1/address').with(:query => query).to_return(:body => fixture)
31
+ end
32
+
33
+ its(:providedLocation) { should == {:location => 'London, UK'} }
34
+ end
35
+
36
+ context 'location and :thumbMaps provided' do
37
+ subject(:geocoding) { mapquest.geocoding.address 'London, UK', :thumbMaps => false }
38
+
39
+ it 'should receive a location and thumbMaps' do
40
+ fixture = fixture 'geocoding/location_thumbMaps'
41
+ query = {
42
+ :key => 'xxx',
43
+ :location => 'London, UK',
44
+ :thumbMaps => false
45
+ }
46
+ stub_request(:get, 'www.mapquestapi.com/geocoding/v1/address').with(:query => query).to_return(:body => fixture)
47
+ end
48
+
49
+ it { geocoding.options[:thumbMaps].should == false }
50
+ end
51
+
52
+ context 'location and :maxResults are provided' do
53
+ subject(:geocoding) { mapquest.geocoding.address 'London, UK', :maxResults => 2 }
54
+
55
+ it 'should receive a location and maxResults' do
56
+ fixture = fixture 'geocoding/location_maxResults'
57
+ query = {
58
+ :key => 'xxx',
59
+ :location => 'London, UK',
60
+ :maxResults => 2
61
+ }
62
+ stub_request(:get, 'www.mapquestapi.com/geocoding/v1/address').with(:query => query).to_return(:body => fixture)
63
+ end
64
+
65
+ it { geocoding.options[:maxResults].should == 2 }
66
+
67
+ end
68
+
69
+ end
70
+
71
+ describe '#reverse' do
72
+
73
+ context 'location is not provided' do
74
+ it 'should raise an error if location is not an array' do
75
+ expect { mapquest.geocoding.reverse 'xxx' }.to raise_error ArgumentError
76
+ end
77
+ end
78
+
79
+ context 'location is provided' do
80
+ subject(:geocoding) { mapquest.geocoding.reverse ['40.0755', '-76.329999'] }
81
+
82
+ it 'should receive a location' do
83
+ fixture = fixture 'geocoding/reverse_location'
84
+ query = {
85
+ :key => 'xxx',
86
+ :location => ['40.0755', '-76.329999'].join(',')
87
+ }
88
+ stub_request(:get, 'www.mapquestapi.com/geocoding/v1/reverse').with(:query => query).to_return(:body => fixture)
89
+ end
90
+
91
+ end
92
+
93
+
94
+ context 'when request is valid' do
95
+
96
+ describe MapQuest::Services::Geocoding::Response do
97
+
98
+ let(:max_results) { -1 }
99
+ let(:fixt) { 'geocoding/location_only' }
100
+ let(:thumb_maps) { true }
101
+
102
+ let(:valid_response) do
103
+ params = {
104
+ :location => 'London, UK',
105
+ :maxResults => max_results,
106
+ :thumbMaps => thumb_maps
107
+ }
108
+ MapQuest::Services::Geocoding::Response.new fixture(fixt), params
109
+ end
110
+
111
+ it { valid_response.status[:code].should == 0 }
112
+ it { valid_response.status[:messages].should == [] }
113
+ it { valid_response.valid.should == true }
114
+ it { valid_response.locations.should be_kind_of(Array) }
115
+
116
+ context 'only :location is provided' do
117
+ it { valid_response.providedLocation[:location].should == valid_response.params[:location] }
118
+ it { valid_response.copyright[:imageUrl].should == 'http://api.mqcdn.com/res/mqlogo.gif' }
119
+ end
120
+
121
+ context ':maxResults is also provided' do
122
+ let(:fixt) { 'geocoding/location_maxResults' }
123
+ let(:max_results) { 2 }
124
+ it { valid_response.options[:maxResults].should == valid_response.params[:maxResults] }
125
+ it { valid_response.params[:maxResults].should >= valid_response.locations.length }
126
+ end
127
+
128
+ context ':thumbMap is also provided' do
129
+ let(:fixt) { 'geocoding/location_thumbMaps' }
130
+ let(:thumb_maps) { false }
131
+ it { valid_response.options[:thumbMaps].should == valid_response.params[:thumbMaps] }
132
+ end
133
+
134
+ context ':thumbMap is also provided' do
135
+ let(:fixt) { 'geocoding/location_thumbMaps_maxResults' }
136
+ let(:thumb_maps) { false }
137
+ let(:max_results) { 2 }
138
+ it { valid_response.options[:thumbMaps].should == valid_response.params[:thumbMaps] }
139
+ it { valid_response.options[:maxResults].should == valid_response.params[:maxResults] }
140
+ it { valid_response.params[:maxResults].should >= valid_response.locations.length }
141
+ end
142
+ end
143
+ end
144
+
145
+ context 'when invalid request' do
146
+
147
+ context 'when api key is invalid' do
148
+ let(:wrong_api_key_response) do
149
+ MapQuest::Services::Directions::Response.new fixture 'geocoding/invalid_key'
150
+ end
151
+
152
+ describe MapQuest::Services::Directions::Response do
153
+ it { wrong_api_key_response.status[:code].should == 403 }
154
+ it { wrong_api_key_response.status[:messages].first.should match /^This is not a valid key/ }
155
+ end
156
+ end
157
+
158
+ context 'when argument is invalid' do
159
+
160
+ let(:invalid_argument) do
161
+ MapQuest::Services::Directions::Response.new fixture 'geocoding/illegal_argument'
162
+ end
163
+
164
+ describe MapQuest::Services::Directions::Response do
165
+ it { invalid_argument.status[:code].should == 400 }
166
+ it { invalid_argument.status[:messages].first.should match /^Illegal argument/ }
167
+ end
168
+
169
+ end
170
+ end
171
+ end
172
+ end