ratis 3.1.0 → 3.1.1

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,722 @@
1
+ require 'spec_helper'
2
+
3
+ describe Ratis::Itinerary do
4
+
5
+ describe 'single itinerary, single service' do
6
+
7
+ before do
8
+ stub_atis_request.to_return( atis_response 'Plantrip', '1.27', '0', <<-BODY )
9
+ <Input>
10
+ <Originlat>33.452082</Originlat>
11
+ <Originlong>-112.074374</Originlong>
12
+ <Originlandmarkid>0</Originlandmarkid>
13
+ <Origintext>Origin</Origintext>
14
+ <Destinationlat>33.446347</Destinationlat>
15
+ <Destinationlong>-112.068689</Destinationlong>
16
+ <Destinationlandmarkid>0</Destinationlandmarkid>
17
+ <Destinationtext>Destination</Destinationtext>
18
+ <Date>07/26/2012</Date>
19
+ <Time>06:43 PM</Time>
20
+ <Minimize>T</Minimize>
21
+ <Accessible>N</Accessible>
22
+ <Arrdep>D</Arrdep>
23
+ <Walkspeed> 2.00 </Walkspeed>
24
+ <Maxwalk>0.4</Maxwalk>
25
+ <Walkorigin>0.4</Walkorigin>
26
+ <Walkdestination>0.4</Walkdestination>
27
+ </Input>
28
+ <Lesserttime>
29
+ <Time/>
30
+ <Arrdep/>
31
+ </Lesserttime>
32
+ <Walkable>N</Walkable>
33
+ <Walkadjust>0</Walkadjust>
34
+ <Itin>
35
+ <Legs>
36
+ <Leg>
37
+ <Onwalkdist>0.21</Onwalkdist>
38
+ <Onwalkdir>W</Onwalkdir>
39
+ <Onwalkhint>Y</Onwalkhint>
40
+ <Onstop>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Onstop>
41
+ <Ontime>1859</Ontime>
42
+ <Onstopdata>
43
+ <Description>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Description>
44
+ <Area>PH</Area>
45
+ <Lat>33.452252</Lat>
46
+ <Long>-112.075081</Long>
47
+ <Time>1859</Time>
48
+ <Date>07/26/12</Date>
49
+ <Atisstopid>10880</Atisstopid>
50
+ <Stopid>10012</Stopid>
51
+ <Stopstatustype>N</Stopstatustype>
52
+ <Stopseq>11</Stopseq>
53
+ <Stopposition>O</Stopposition>
54
+ <Heading>NB</Heading>
55
+ <Side>Far</Side>
56
+ <Accessible>N</Accessible>
57
+ </Onstopdata>
58
+ <Service>
59
+ <Route>LTRL</Route>
60
+ <Sign>Metro light rail To Sycamore&#x2F;Main</Sign>
61
+ <Altsign></Altsign>
62
+ <Direction>E</Direction>
63
+ <Operator>METRO</Operator>
64
+ <Servicetype>W</Servicetype>
65
+ <Routeid>46880</Routeid>
66
+ <Block>17074</Block>
67
+ <Trip>14</Trip>
68
+ <Peak>N</Peak>
69
+ <Routetype>L</Routetype>
70
+ <Statustype>N</Statustype>
71
+ <Adherence>0</Adherence>
72
+ <Polltime></Polltime>
73
+ <Lat>0.000000</Lat>
74
+ <Long>0.000000</Long>
75
+ <Vehicle></Vehicle>
76
+ <Patternorigin></Patternorigin>
77
+ <Patterndestination></Patterndestination>
78
+ <Exception>N</Exception>
79
+ <Statusid>0</Statusid>
80
+ </Service>
81
+ <Fare>
82
+ <Onfarezone>0</Onfarezone>
83
+ <Offfarezone>0</Offfarezone>
84
+ <Legregularfare>1.75</Legregularfare>
85
+ <Legregularfarexfer>0.00</Legregularfarexfer>
86
+ <Legreducedfare>0.85</Legreducedfare>
87
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
88
+ </Fare>
89
+ <Offstop>3RD STREET&#x2F;JEFFERSON LIGHT RAIL STATION</Offstop>
90
+ <Offtime>1903</Offtime>
91
+ <Offstopdata>
92
+ <Description>3RD STREET&#x2F;JEFFERSON LIGHT RAIL STATION</Description>
93
+ <Area>PH</Area>
94
+ <Lat>33.446270</Lat>
95
+ <Long>-112.069777</Long>
96
+ <Time>1903</Time>
97
+ <Date>07/26/12</Date>
98
+ <Atisstopid>10892</Atisstopid>
99
+ <Stopid>10014</Stopid>
100
+ <Stopstatustype>N</Stopstatustype>
101
+ <Stopseq>13</Stopseq>
102
+ <Stopposition>O</Stopposition>
103
+ <Heading>NB</Heading>
104
+ <Side>Far</Side>
105
+ <Accessible>N</Accessible>
106
+ </Offstopdata>
107
+ </Leg>
108
+ </Legs>
109
+ <Finalwalk>0.07</Finalwalk>
110
+ <Finalwalkdir>E</Finalwalkdir>
111
+ <Finalwalkhint>Y</Finalwalkhint>
112
+ <Transittime>4</Transittime>
113
+ <Regularfare>1.75</Regularfare>
114
+ <Reducedfare>0.85</Reducedfare>
115
+ <Fareinfo>1|0|1.75|0.85~W|06:59 PM|07:03 PM|LTRL| |W|E|L|12|0|1956|14|46880|METRO|10880|11|10892|13|BUSFARE|0|0|0|R~</Fareinfo>
116
+ <Traceinfo>1|46880|11|13</Traceinfo>
117
+ <Exmodified>N</Exmodified>
118
+ <Exmodids/>
119
+ <Disttransit> 0.63</Disttransit>
120
+ <Distauto> 0.92</Distauto>
121
+ <Co2transit>0.260</Co2transit>
122
+ <Co2auto>0.881</Co2auto>
123
+ </Itin>
124
+ BODY
125
+
126
+ @itineraries = Ratis::Itinerary.where(
127
+ :date => '07/26/2012', :time => '1843', :minimize => 'T',
128
+ :origin_lat => '33.452082', :origin_long => '-112.074374',
129
+ :destination_lat => '33.446347', :destination_long => '-112.068689' )
130
+ end
131
+
132
+ describe '#where' do
133
+
134
+ it 'only makes one request' do
135
+ an_atis_request.should have_been_made.times 1
136
+ end
137
+
138
+ it 'requests the correct SOAP action' do
139
+ an_atis_request_for('Plantrip',
140
+ 'Date' => '07/26/2012', 'Time' => '1843', 'Minimize' => 'T',
141
+ 'Originlat' => '33.452082', 'Originlong' => '-112.074374',
142
+ 'Destinationlat' => '33.446347', 'Destinationlong' => '-112.068689'
143
+ ).should have_been_made
144
+ end
145
+
146
+ it 'returns one itinerary' do
147
+ @itineraries.should have(1).item
148
+ @itineraries.first.should be_a_kind_of Ratis::Itinerary
149
+ end
150
+
151
+ end
152
+
153
+ describe '#legs' do
154
+
155
+ it 'returns one leg' do
156
+ @itineraries.first.legs.should have(1).item
157
+ @itineraries.first.legs.first.should_not be_nil
158
+ end
159
+
160
+ end
161
+
162
+ it 'marshalls the members to their correct type' do
163
+ itinerary = @itineraries.first
164
+ itinerary.co2_auto = 0.881
165
+ itinerary.co2_transit = 0.260
166
+ itinerary.final_walk_dir = 'E'
167
+ itinerary.reduced_fare = 0.85
168
+ itinerary.regular_fare = 1.75
169
+ itinerary.transit_time = 4
170
+ end
171
+
172
+ end
173
+
174
+ describe 'three itineraries, each with multiple service' do
175
+
176
+ before do
177
+ stub_atis_request.to_return( atis_response 'Plantrip', '1.27', '0', <<-BODY )
178
+ <Tid></Tid>
179
+ <Input>
180
+ <Originlat>33.452082</Originlat>
181
+ <Originlong>-112.074374</Originlong>
182
+ <Originlandmarkid>7234</Originlandmarkid>
183
+ <Origintext>CENTRAL STATION</Origintext>
184
+ <Destinationlat>33.432254</Destinationlat>
185
+ <Destinationlong>-111.904625</Destinationlong>
186
+ <Destinationlandmarkid>7542</Destinationlandmarkid>
187
+ <Destinationtext>TEMPE MARKETPLACE</Destinationtext>
188
+ <Date>07/31/2012</Date>
189
+ <Time>09:14 AM</Time>
190
+ <Minimize>T</Minimize>
191
+ <Accessible>N</Accessible>
192
+ <Arrdep>D</Arrdep>
193
+ <Walkspeed> 2.00 </Walkspeed>
194
+ <Maxwalk>0.50</Maxwalk>
195
+ <Walkorigin>0.50</Walkorigin>
196
+ <Walkdestination>0.50</Walkdestination>
197
+ </Input>
198
+ <Lesserttime>
199
+ <Time/>
200
+ <Arrdep/>
201
+ </Lesserttime>
202
+ <Walkable>N</Walkable>
203
+ <Walkadjust>0</Walkadjust>
204
+ <Itin>
205
+ <Legs>
206
+ <Leg>
207
+ <Onwalkdist>0.21</Onwalkdist>
208
+ <Onwalkdir>W</Onwalkdir>
209
+ <Onwalkhint>Y</Onwalkhint>
210
+ <Onstop>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Onstop>
211
+ <Ontime>0931</Ontime>
212
+ <Onstopdata>
213
+ <Description>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Description>
214
+ <Area>PH</Area>
215
+ <Lat>33.452252</Lat>
216
+ <Long>-112.075081</Long>
217
+ <Time>0931</Time>
218
+ <Date>07/31/12</Date>
219
+ <Atisstopid>10880</Atisstopid>
220
+ <Stopid>10012</Stopid>
221
+ <Stopstatustype>N</Stopstatustype>
222
+ <Stopseq>11</Stopseq>
223
+ <Stopposition>O</Stopposition>
224
+ <Heading>NB</Heading>
225
+ <Side>Far</Side>
226
+ <Accessible>N</Accessible>
227
+ </Onstopdata>
228
+ <Service>
229
+ <Route>LTRL</Route>
230
+ <Sign>Metro light rail To Sycamore&#x2F;Main</Sign>
231
+ <Altsign></Altsign>
232
+ <Direction>E</Direction>
233
+ <Operator>METRO</Operator>
234
+ <Servicetype>W</Servicetype>
235
+ <Routeid>46860</Routeid>
236
+ <Block>17027</Block>
237
+ <Trip>3</Trip>
238
+ <Peak>N</Peak>
239
+ <Routetype>L</Routetype>
240
+ <Statustype>N</Statustype>
241
+ <Adherence>0</Adherence>
242
+ <Polltime></Polltime>
243
+ <Lat>0.000000</Lat>
244
+ <Long>0.000000</Long>
245
+ <Vehicle></Vehicle>
246
+ <Patternorigin></Patternorigin>
247
+ <Patterndestination></Patterndestination>
248
+ <Exception>N</Exception>
249
+ <Statusid>0</Statusid>
250
+ </Service>
251
+ <Fare>
252
+ <Onfarezone>0</Onfarezone>
253
+ <Offfarezone>0</Offfarezone>
254
+ <Legregularfare>1.75</Legregularfare>
255
+ <Legregularfarexfer>0.00</Legregularfarexfer>
256
+ <Legreducedfare>0.85</Legreducedfare>
257
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
258
+ </Fare>
259
+ <Offstop>MCCLINTOCK DR&#x2F;APACHE LIGHT RAIL STATION</Offstop>
260
+ <Offtime>1007</Offtime>
261
+ <Offstopdata>
262
+ <Description>MCCLINTOCK DR&#x2F;APACHE LIGHT RAIL STATION</Description>
263
+ <Area>TE</Area>
264
+ <Lat>33.414688</Lat>
265
+ <Long>-111.908882</Long>
266
+ <Time>1007</Time>
267
+ <Date>07/31/12</Date>
268
+ <Atisstopid>10887</Atisstopid>
269
+ <Stopid>10025</Stopid>
270
+ <Stopstatustype>N</Stopstatustype>
271
+ <Stopseq>26</Stopseq>
272
+ <Stopposition>O</Stopposition>
273
+ <Heading>NB</Heading>
274
+ <Side>Far</Side>
275
+ <Accessible>N</Accessible>
276
+ </Offstopdata>
277
+ </Leg>
278
+ <Leg>
279
+ <Onwalkdist>0</Onwalkdist>
280
+ <Onwalkdir> </Onwalkdir>
281
+ <Onwalkhint>N</Onwalkhint>
282
+ <Onstop>MCCLINTOCK DR &amp; APACHE BLVD</Onstop>
283
+ <Ontime>1013</Ontime>
284
+ <Onstopdata>
285
+ <Description>MCCLINTOCK DR &amp; APACHE BLVD</Description>
286
+ <Area>TE</Area>
287
+ <Lat>33.414938</Lat>
288
+ <Long>-111.909100</Long>
289
+ <Time>1013</Time>
290
+ <Date>07/31/12</Date>
291
+ <Atisstopid>3431</Atisstopid>
292
+ <Stopid>15090</Stopid>
293
+ <Stopstatustype>N</Stopstatustype>
294
+ <Stopseq>32</Stopseq>
295
+ <Stopposition>O</Stopposition>
296
+ <Heading>NB</Heading>
297
+ <Side>Far</Side>
298
+ <Accessible>N</Accessible>
299
+ </Onstopdata>
300
+ <Service>
301
+ <Route>81</Route>
302
+ <Sign>81 Haydn&#x2F;Mclintk To Raintree&#x2F;Nrthsight</Sign>
303
+ <Altsign></Altsign>
304
+ <Direction>N</Direction>
305
+ <Operator>VEOLIA-TEM</Operator>
306
+ <Servicetype>W</Servicetype>
307
+ <Routeid>38240</Routeid>
308
+ <Block>4082</Block>
309
+ <Trip>4</Trip>
310
+ <Peak>N</Peak>
311
+ <Routetype>B</Routetype>
312
+ <Statustype>N</Statustype>
313
+ <Adherence>0</Adherence>
314
+ <Polltime></Polltime>
315
+ <Lat>0.000000</Lat>
316
+ <Long>0.000000</Long>
317
+ <Vehicle></Vehicle>
318
+ <Patternorigin></Patternorigin>
319
+ <Patterndestination></Patterndestination>
320
+ <Exception>N</Exception>
321
+ <Statusid>0</Statusid>
322
+ </Service>
323
+ <Fare>
324
+ <Onfarezone>0</Onfarezone>
325
+ <Offfarezone>0</Offfarezone>
326
+ <Legregularfare>1.75</Legregularfare>
327
+ <Legregularfarexfer>0.00</Legregularfarexfer>
328
+ <Legreducedfare>0.85</Legreducedfare>
329
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
330
+ </Fare>
331
+ <Offstop>TEMPE MARKETPLACE</Offstop>
332
+ <Offtime>1020</Offtime>
333
+ <Offstopdata>
334
+ <Description>TEMPE MARKETPLACE</Description>
335
+ <Area>TE</Area>
336
+ <Lat>33.432256</Lat>
337
+ <Long>-111.904661</Long>
338
+ <Time>1020</Time>
339
+ <Date>07/31/12</Date>
340
+ <Atisstopid>10453</Atisstopid>
341
+ <Stopid>14167</Stopid>
342
+ <Stopstatustype>N</Stopstatustype>
343
+ <Stopseq>36</Stopseq>
344
+ <Stopposition> </Stopposition>
345
+ <Heading> </Heading>
346
+ <Side>unknown</Side>
347
+ <Accessible>N</Accessible>
348
+ </Offstopdata>
349
+ </Leg>
350
+ </Legs>
351
+ <Finalwalk>0</Finalwalk>
352
+ <Finalwalkdir> </Finalwalkdir>
353
+ <Finalwalkhint>N</Finalwalkhint>
354
+ <Transittime>49</Transittime>
355
+ <Regularfare>3.50</Regularfare>
356
+ <Reducedfare>1.70</Reducedfare>
357
+ <Fareinfo>2|0|3.50|1.70~W|09:31 AM|10:07 AM|LTRL| |W|E|L|10|0|1944|3|46860|METRO|10880|11|10887|26|BUSFARE|0|0|0|R~T|10:13 AM|10:20 AM|81| |W|N|B|2|0|1609|4|38240|VEOLIA-TEM|3431|32|10453|36|BUSFARE|0|0|0|B~</Fareinfo>
358
+ <Traceinfo>2|46860|11|26|38240|32|36</Traceinfo>
359
+ <Exmodified>N</Exmodified>
360
+ <Exmodids/>
361
+ <Disttransit>12.39</Disttransit>
362
+ <Distauto>12.63</Distauto>
363
+ <Co2transit>5.437</Co2transit>
364
+ <Co2auto>12.125</Co2auto>
365
+ </Itin>
366
+ <Itin>
367
+ <Legs>
368
+ <Leg>
369
+ <Onwalkdist>0.21</Onwalkdist>
370
+ <Onwalkdir>W</Onwalkdir>
371
+ <Onwalkhint>Y</Onwalkhint>
372
+ <Onstop>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Onstop>
373
+ <Ontime>0931</Ontime>
374
+ <Onstopdata>
375
+ <Description>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Description>
376
+ <Area>PH</Area>
377
+ <Lat>33.452252</Lat>
378
+ <Long>-112.075081</Long>
379
+ <Time>0931</Time>
380
+ <Date>07/31/12</Date>
381
+ <Atisstopid>10880</Atisstopid>
382
+ <Stopid>10012</Stopid>
383
+ <Stopstatustype>N</Stopstatustype>
384
+ <Stopseq>11</Stopseq>
385
+ <Stopposition>O</Stopposition>
386
+ <Heading>NB</Heading>
387
+ <Side>Far</Side>
388
+ <Accessible>N</Accessible>
389
+ </Onstopdata>
390
+ <Service>
391
+ <Route>LTRL</Route>
392
+ <Sign>Metro light rail To Sycamore&#x2F;Main</Sign>
393
+ <Altsign></Altsign>
394
+ <Direction>E</Direction>
395
+ <Operator>METRO</Operator>
396
+ <Servicetype>W</Servicetype>
397
+ <Routeid>46860</Routeid>
398
+ <Block>17027</Block>
399
+ <Trip>3</Trip>
400
+ <Peak>N</Peak>
401
+ <Routetype>L</Routetype>
402
+ <Statustype>N</Statustype>
403
+ <Adherence>0</Adherence>
404
+ <Polltime></Polltime>
405
+ <Lat>0.000000</Lat>
406
+ <Long>0.000000</Long>
407
+ <Vehicle></Vehicle>
408
+ <Patternorigin></Patternorigin>
409
+ <Patterndestination></Patterndestination>
410
+ <Exception>N</Exception>
411
+ <Statusid>0</Statusid>
412
+ </Service>
413
+ <Fare>
414
+ <Onfarezone>0</Onfarezone>
415
+ <Offfarezone>0</Offfarezone>
416
+ <Legregularfare>1.75</Legregularfare>
417
+ <Legregularfarexfer>0.00</Legregularfarexfer>
418
+ <Legreducedfare>0.85</Legreducedfare>
419
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
420
+ </Fare>
421
+ <Offstop>VETERANS WAY&#x2F;COLLEGE LIGHT RAIL STATION</Offstop>
422
+ <Offtime>0959</Offtime>
423
+ <Offstopdata>
424
+ <Description>VETERANS WAY&#x2F;COLLEGE LIGHT RAIL STATION</Description>
425
+ <Area>TE</Area>
426
+ <Lat>33.426222</Lat>
427
+ <Long>-111.936477</Long>
428
+ <Time>0959</Time>
429
+ <Date>07/31/12</Date>
430
+ <Atisstopid>10895</Atisstopid>
431
+ <Stopid>10022</Stopid>
432
+ <Stopstatustype>N</Stopstatustype>
433
+ <Stopseq>22</Stopseq>
434
+ <Stopposition>O</Stopposition>
435
+ <Heading>NB</Heading>
436
+ <Side>Far</Side>
437
+ <Accessible>N</Accessible>
438
+ </Offstopdata>
439
+ </Leg>
440
+ <Leg>
441
+ <Onwalkdist>0</Onwalkdist>
442
+ <Onwalkdir> </Onwalkdir>
443
+ <Onwalkhint>N</Onwalkhint>
444
+ <Onstop>TEMPE TRANSIT CENTER NORTH SIDE</Onstop>
445
+ <Ontime>1031</Ontime>
446
+ <Onstopdata>
447
+ <Description>TEMPE TRANSIT CENTER NORTH SIDE</Description>
448
+ <Area>TE</Area>
449
+ <Lat>33.425740</Lat>
450
+ <Long>-111.935929</Long>
451
+ <Time>1031</Time>
452
+ <Date>07/31/12</Date>
453
+ <Atisstopid>11042</Atisstopid>
454
+ <Stopid>14163</Stopid>
455
+ <Stopstatustype>N</Stopstatustype>
456
+ <Stopseq>42</Stopseq>
457
+ <Stopposition> </Stopposition>
458
+ <Heading> </Heading>
459
+ <Side>unknown</Side>
460
+ <Accessible>N</Accessible>
461
+ </Onstopdata>
462
+ <Service>
463
+ <Route>62</Route>
464
+ <Sign>62 Hardy&#x2F;Guadalupe To Tempe Marketplace</Sign>
465
+ <Altsign></Altsign>
466
+ <Direction>N</Direction>
467
+ <Operator>VEOLIA-TEM</Operator>
468
+ <Servicetype>W</Servicetype>
469
+ <Routeid>37140</Routeid>
470
+ <Block>4049</Block>
471
+ <Trip>5</Trip>
472
+ <Peak>N</Peak>
473
+ <Routetype>B</Routetype>
474
+ <Statustype>N</Statustype>
475
+ <Adherence>0</Adherence>
476
+ <Polltime></Polltime>
477
+ <Lat>0.000000</Lat>
478
+ <Long>0.000000</Long>
479
+ <Vehicle></Vehicle>
480
+ <Patternorigin></Patternorigin>
481
+ <Patterndestination></Patterndestination>
482
+ <Exception>N</Exception>
483
+ <Statusid>0</Statusid>
484
+ </Service>
485
+ <Fare>
486
+ <Onfarezone>0</Onfarezone>
487
+ <Offfarezone>0</Offfarezone>
488
+ <Legregularfare>1.75</Legregularfare>
489
+ <Legregularfarexfer>0.00</Legregularfarexfer>
490
+ <Legreducedfare>0.85</Legreducedfare>
491
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
492
+ </Fare>
493
+ <Offstop>TEMPE MARKETPLACE</Offstop>
494
+ <Offtime>1044</Offtime>
495
+ <Offstopdata>
496
+ <Description>TEMPE MARKETPLACE</Description>
497
+ <Area>TE</Area>
498
+ <Lat>33.432256</Lat>
499
+ <Long>-111.904661</Long>
500
+ <Time>1044</Time>
501
+ <Date>07/31/12</Date>
502
+ <Atisstopid>10453</Atisstopid>
503
+ <Stopid>14167</Stopid>
504
+ <Stopstatustype>N</Stopstatustype>
505
+ <Stopseq>51</Stopseq>
506
+ <Stopposition> </Stopposition>
507
+ <Heading> </Heading>
508
+ <Side>unknown</Side>
509
+ <Accessible>N</Accessible>
510
+ </Offstopdata>
511
+ </Leg>
512
+ </Legs>
513
+ <Finalwalk>0</Finalwalk>
514
+ <Finalwalkdir> </Finalwalkdir>
515
+ <Finalwalkhint>N</Finalwalkhint>
516
+ <Transittime>73</Transittime>
517
+ <Regularfare>3.50</Regularfare>
518
+ <Reducedfare>1.70</Reducedfare>
519
+ <Fareinfo>2|0|3.50|1.70~W|09:31 AM|09:59 AM|LTRL| |W|E|L|10|0|1944|3|46860|METRO|10880|11|10895|22|BUSFARE|0|0|0|R~T|10:31 AM|10:44 AM|62| |W|N|B|1|0|1279|5|37140|VEOLIA-TEM|11042|42|10453|51|BUSFARE|0|0|0|B~</Fareinfo>
520
+ <Traceinfo>2|46860|11|22|37140|42|51</Traceinfo>
521
+ <Exmodified>N</Exmodified>
522
+ <Exmodids/>
523
+ <Disttransit>11.82</Disttransit>
524
+ <Distauto>12.08</Distauto>
525
+ <Co2transit>5.520</Co2transit>
526
+ <Co2auto>11.597</Co2auto>
527
+ </Itin>
528
+ <Itin>
529
+ <Legs>
530
+ <Leg>
531
+ <Onwalkdist>0.21</Onwalkdist>
532
+ <Onwalkdir>W</Onwalkdir>
533
+ <Onwalkhint>Y</Onwalkhint>
534
+ <Onstop>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Onstop>
535
+ <Ontime>0931</Ontime>
536
+ <Onstopdata>
537
+ <Description>VAN BUREN&#x2F;1ST AVE LIGHT RAIL STATION</Description>
538
+ <Area>PH</Area>
539
+ <Lat>33.452252</Lat>
540
+ <Long>-112.075081</Long>
541
+ <Time>0931</Time>
542
+ <Date>07/31/12</Date>
543
+ <Atisstopid>10880</Atisstopid>
544
+ <Stopid>10012</Stopid>
545
+ <Stopstatustype>N</Stopstatustype>
546
+ <Stopseq>11</Stopseq>
547
+ <Stopposition>O</Stopposition>
548
+ <Heading>NB</Heading>
549
+ <Side>Far</Side>
550
+ <Accessible>N</Accessible>
551
+ </Onstopdata>
552
+ <Service>
553
+ <Route>LTRL</Route>
554
+ <Sign>Metro light rail To Sycamore&#x2F;Main</Sign>
555
+ <Altsign></Altsign>
556
+ <Direction>E</Direction>
557
+ <Operator>METRO</Operator>
558
+ <Servicetype>W</Servicetype>
559
+ <Routeid>46860</Routeid>
560
+ <Block>17027</Block>
561
+ <Trip>3</Trip>
562
+ <Peak>N</Peak>
563
+ <Routetype>L</Routetype>
564
+ <Statustype>N</Statustype>
565
+ <Adherence>0</Adherence>
566
+ <Polltime></Polltime>
567
+ <Lat>0.000000</Lat>
568
+ <Long>0.000000</Long>
569
+ <Vehicle></Vehicle>
570
+ <Patternorigin></Patternorigin>
571
+ <Patterndestination></Patterndestination>
572
+ <Exception>N</Exception>
573
+ <Statusid>0</Statusid>
574
+ </Service>
575
+ <Fare>
576
+ <Onfarezone>0</Onfarezone>
577
+ <Offfarezone>0</Offfarezone>
578
+ <Legregularfare>1.75</Legregularfare>
579
+ <Legregularfarexfer>0.00</Legregularfarexfer>
580
+ <Legreducedfare>0.85</Legreducedfare>
581
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
582
+ </Fare>
583
+ <Offstop>MCCLINTOCK DR&#x2F;APACHE LIGHT RAIL STATION</Offstop>
584
+ <Offtime>1007</Offtime>
585
+ <Offstopdata>
586
+ <Description>MCCLINTOCK DR&#x2F;APACHE LIGHT RAIL STATION</Description>
587
+ <Area>TE</Area>
588
+ <Lat>33.414688</Lat>
589
+ <Long>-111.908882</Long>
590
+ <Time>1007</Time>
591
+ <Date>07/31/12</Date>
592
+ <Atisstopid>10887</Atisstopid>
593
+ <Stopid>10025</Stopid>
594
+ <Stopstatustype>N</Stopstatustype>
595
+ <Stopseq>26</Stopseq>
596
+ <Stopposition>O</Stopposition>
597
+ <Heading>NB</Heading>
598
+ <Side>Far</Side>
599
+ <Accessible>N</Accessible>
600
+ </Offstopdata>
601
+ </Leg>
602
+ <Leg>
603
+ <Onwalkdist>0</Onwalkdist>
604
+ <Onwalkdir> </Onwalkdir>
605
+ <Onwalkhint>N</Onwalkhint>
606
+ <Onstop>MCCLINTOCK DR &amp; APACHE BLVD</Onstop>
607
+ <Ontime>1043</Ontime>
608
+ <Onstopdata>
609
+ <Description>MCCLINTOCK DR &amp; APACHE BLVD</Description>
610
+ <Area>TE</Area>
611
+ <Lat>33.414938</Lat>
612
+ <Long>-111.909100</Long>
613
+ <Time>1043</Time>
614
+ <Date>07/31/12</Date>
615
+ <Atisstopid>3431</Atisstopid>
616
+ <Stopid>15090</Stopid>
617
+ <Stopstatustype>N</Stopstatustype>
618
+ <Stopseq>32</Stopseq>
619
+ <Stopposition>O</Stopposition>
620
+ <Heading>NB</Heading>
621
+ <Side>Far</Side>
622
+ <Accessible>N</Accessible>
623
+ </Onstopdata>
624
+ <Service>
625
+ <Route>81</Route>
626
+ <Sign>81 Haydn&#x2F;Mclintk To Raintree&#x2F;Nrthsight</Sign>
627
+ <Altsign></Altsign>
628
+ <Direction>N</Direction>
629
+ <Operator>VEOLIA-TEM</Operator>
630
+ <Servicetype>W</Servicetype>
631
+ <Routeid>38241</Routeid>
632
+ <Block>4085</Block>
633
+ <Trip>4</Trip>
634
+ <Peak>N</Peak>
635
+ <Routetype>B</Routetype>
636
+ <Statustype>N</Statustype>
637
+ <Adherence>0</Adherence>
638
+ <Polltime></Polltime>
639
+ <Lat>0.000000</Lat>
640
+ <Long>0.000000</Long>
641
+ <Vehicle></Vehicle>
642
+ <Patternorigin></Patternorigin>
643
+ <Patterndestination></Patterndestination>
644
+ <Exception>N</Exception>
645
+ <Statusid>0</Statusid>
646
+ </Service>
647
+ <Fare>
648
+ <Onfarezone>0</Onfarezone>
649
+ <Offfarezone>0</Offfarezone>
650
+ <Legregularfare>1.75</Legregularfare>
651
+ <Legregularfarexfer>0.00</Legregularfarexfer>
652
+ <Legreducedfare>0.85</Legreducedfare>
653
+ <Legreducedfarexfer>0.00</Legreducedfarexfer>
654
+ </Fare>
655
+ <Offstop>TEMPE MARKETPLACE</Offstop>
656
+ <Offtime>1050</Offtime>
657
+ <Offstopdata>
658
+ <Description>TEMPE MARKETPLACE</Description>
659
+ <Area>TE</Area>
660
+ <Lat>33.432256</Lat>
661
+ <Long>-111.904661</Long>
662
+ <Time>1050</Time>
663
+ <Date>07/31/12</Date>
664
+ <Atisstopid>10453</Atisstopid>
665
+ <Stopid>14167</Stopid>
666
+ <Stopstatustype>N</Stopstatustype>
667
+ <Stopseq>36</Stopseq>
668
+ <Stopposition> </Stopposition>
669
+ <Heading> </Heading>
670
+ <Side>unknown</Side>
671
+ <Accessible>N</Accessible>
672
+ </Offstopdata>
673
+ </Leg>
674
+ </Legs>
675
+ <Finalwalk>0</Finalwalk>
676
+ <Finalwalkdir> </Finalwalkdir>
677
+ <Finalwalkhint>N</Finalwalkhint>
678
+ <Transittime>79</Transittime>
679
+ <Regularfare>3.50</Regularfare>
680
+ <Reducedfare>1.70</Reducedfare>
681
+ <Fareinfo>2|0|3.50|1.70~W|09:31 AM|10:07 AM|LTRL| |W|E|L|10|0|1944|3|46860|METRO|10880|11|10887|26|BUSFARE|0|0|0|R~T|10:43 AM|10:50 AM|81| |W|N|B|2|0|1610|4|38241|VEOLIA-TEM|3431|32|10453|36|BUSFARE|0|0|0|B~</Fareinfo>
682
+ <Traceinfo>2|46860|11|26|38241|32|36</Traceinfo>
683
+ <Exmodified>N</Exmodified>
684
+ <Exmodids/>
685
+ <Disttransit>12.39</Disttransit>
686
+ <Distauto>12.63</Distauto>
687
+ <Co2transit>5.437</Co2transit>
688
+ <Co2auto>12.125</Co2auto>
689
+ </Itin>
690
+ BODY
691
+
692
+ @itineraries = Ratis::Itinerary.where(
693
+ :date => '07/31/2012', :time => '0914', :minimize => 'T',
694
+ :origin_lat => '33.452082', :origin_long => '-112.074374',
695
+ :destination_lat => '33.432254', :destination_long => '-111.904625' )
696
+ end
697
+
698
+ describe '#where' do
699
+
700
+ it 'only makes one request' do
701
+ an_atis_request.should have_been_made.times 1
702
+ end
703
+
704
+ it 'requests the correct SOAP action' do
705
+ an_atis_request_for('Plantrip',
706
+ 'Date' => '07/31/2012', 'Time' => '0914', 'Minimize' => 'T',
707
+ 'Originlat' => '33.452082', 'Originlong' => '-112.074374',
708
+ 'Destinationlat' => '33.432254', 'Destinationlong' => '-111.904625'
709
+ ).should have_been_made
710
+ end
711
+
712
+ it 'returns three itineraries' do
713
+ @itineraries.should have(3).item
714
+ @itineraries.each { |itin| itin.should be_a_kind_of Ratis::Itinerary }
715
+ end
716
+
717
+ end
718
+
719
+ end
720
+
721
+ end
722
+