gares 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +30 -0
- data/gares.gemspec +1 -0
- data/lib/gares/train.rb +62 -0
- data/lib/gares/train_stop.rb +86 -0
- data/lib/gares/version.rb +1 -1
- data/lib/gares.rb +3 -0
- data/spec/fixtures/get-train-11641 +547 -0
- data/spec/fixtures/get-train-17495 +539 -0
- data/spec/fixtures/get-train-17709 +713 -0
- data/spec/fixtures/get-train-6815 +352 -0
- data/spec/fixtures/post-train-11641 +0 -0
- data/spec/fixtures/post-train-17495 +0 -0
- data/spec/fixtures/post-train-17709 +0 -0
- data/spec/fixtures/post-train-6815 +0 -0
- data/spec/gares/train_spec.rb +96 -0
- data/spec/spec_helper.rb +30 -1
- data/tasks/fixtures.rake +22 -0
- metadata +26 -1
@@ -0,0 +1,352 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: text/html;charset=UTF-8
|
3
|
+
X-UA-Compatible: IE=edge
|
4
|
+
Date: Sat, 25 Apr 2015 18:27:40 GMT
|
5
|
+
Content-Length: 21750
|
6
|
+
Connection: keep-alive
|
7
|
+
Set-Cookie: SNC_city=SDN_PRD6; path=/; domain=.sncf.com
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
13
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
14
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" data-placeholder-focus="false">
|
15
|
+
|
16
|
+
<head>
|
17
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
18
|
+
<title>List of trains - Traffic & timetable updates | SNCF</title>
|
19
|
+
<link rel="canonical" href="http://www.sncf.com/en/horaires-info-trafic/train/resultats" />
|
20
|
+
<meta name="revisit-after" content="1 day" />
|
21
|
+
<link rel="shortcut icon" href="/theme/favicon.ico" type="image/x-icon" />
|
22
|
+
<link href="http://www.sncf.com/fr/info-trafic" rel="canonical" />
|
23
|
+
<meta http-equiv="Content-Language" content="en" /> <link type="text/css" rel="stylesheet" media="all" href="/ressources/menu_icons/menu_icons_en.css?1" />
|
24
|
+
<link type="text/css" rel="stylesheet" media="all" href="/ressources/css/css_fa8eef945cc8331059f2b2fe01e8b03b.css" />
|
25
|
+
<link type="text/css" rel="stylesheet" media="all" href="/ressources/css/css_ec8154e529f1ae274507ee7da445a16c.css" />
|
26
|
+
<link type="text/css" rel="stylesheet" media="print" href="/ressources/css/css_37cfb2f93b571bec4cf2ecfe43124557.css" />
|
27
|
+
<!--[if IE 6]>
|
28
|
+
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sncfninesixty/styles/ie6.css?1" />
|
29
|
+
<![endif]-->
|
30
|
+
<!--[if lte IE 7]>
|
31
|
+
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sncfninesixty/styles/ie7-and-below.css?1" />
|
32
|
+
<![endif]-->
|
33
|
+
<!--[if IE 8]>
|
34
|
+
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sncfninesixty/styles/ie8.css?1" />
|
35
|
+
<![endif]-->
|
36
|
+
<!--[if gte IE 9]>
|
37
|
+
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sncfninesixty/styles/ie9-and-above.css?1" />
|
38
|
+
<![endif]-->
|
39
|
+
<link href="/css/Generic-transac.css" media="all" type="text/css" rel="stylesheet" />
|
40
|
+
<link href="/css/itineraries.css" media="all" type="text/css" rel="stylesheet" /><link href="/css/train.css" media="all" type="text/css" rel="stylesheet" />
|
41
|
+
<script type="text/javascript" src="/ressources/js/js_89f43c3221c41b67e6924fff9b6a7908.js"></script>
|
42
|
+
<script type="text/javascript">
|
43
|
+
<!--//--><![CDATA[//><!--
|
44
|
+
jQuery.extend(Drupal.settings, { "basePath": "/", "googleanalytics": { "trackOutgoing": 1, "trackMailto": 1, "trackDownload": 1, "trackDownloadExtensions": "7z|aac|arc|arj|asf|asx|avi|bin|csv|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip" }, "sncfcom_search_hours": { "list": { "form_start": "1", "form_end": "3" }, "calendar": { "form_start": "1", "form_end": "90" } }, "user_connected": false, "user_rights": { "1": "anonymous user" }, "user_valid": false, "site_language": "en", "site_country": null, "sncfcom_feature_id_chartes": { "nid": "32510" }, "radio": { "height": "400", "width": "632" }, "sncfcom_satisfaction": { "campaigns": [ { "sid": "1", "page": "/fr/contacts/foire-aux-questions", "height_delta": "0", "width_delta": "0", "campaign_url": "", "count_url": "" }, { "sid": "2", "page": "/fr/promotions-billets-train", "height_delta": "317", "width_delta": "25", "campaign_url": "http://www.monavis.sncf.com/website/4v0voyconet0BChH0/form/86/100?responsive=0\x26toolbar=0", "count_url": "http://jcvd.myfeelback.com/indicator/monavis_feedback_dircom?campaign=86\x26formsubmissiontag=Like" }, { "sid": "3", "page": "/fr/gare-", "height_delta": "230", "width_delta": "17", "campaign_url": "http://www.monavis.sncf.com/website/4v0vosh9h4RHM3cUM/form/85/99?responsive=0\x26toolbar=0", "count_url": "http://jcvd.myfeelback.com/indicator/monavis_feedback_dircom?campaign=85\x26formsubmissiontag=Like" }, { "sid": "4", "page": "/fr/itineraire/resultats", "height_delta": "318", "width_delta": "10", "campaign_url": "http://www.monavis.sncf.com/website/4v0voobke4qGav23I/form/84/98?responsive=0\x26toolbar=0", "count_url": "http://jcvd.myfeelback.com/indicator/monavis_feedback_dircom?campaign=84\x26formsubmissiontag=Like" } ] }, "sncfcom_tagcarrier_widget": "", "addthis": { "config_default": { "services_compact": "email,facebook,twitter,google_plusone_share,linkedin,viadeo,more", "ui_language": "en", "ui_click": true, "ui_508_compliant": false, "ui_use_css": true, "data_ga_tracker": "UA-1308810-1", "data_track_clickback": true, "pubid": "xa-4e2cfd1147868c4e" }, "share_default": null, "localize": { "share_caption": "Share with friends" } }, "campaigns_tracking": { "ttl": 90, "cname": "snc_links_id" } });
|
45
|
+
//--><!]]>
|
46
|
+
</script>
|
47
|
+
<script type="text/javascript">
|
48
|
+
<!--//--><![CDATA[//><!--
|
49
|
+
var popupradio_autoplay = true;
|
50
|
+
//--><!]]>
|
51
|
+
</script>
|
52
|
+
<script src="/js/Generic-transac.js" type="text/javascript"></script>
|
53
|
+
<script src="/js/itineraries.js" type="text/javascript"></script>
|
54
|
+
<script src="/js/ga_dynamic.js" type="text/javascript"></script>
|
55
|
+
<script src="/js/map-links.js" type="text/javascript"></script>
|
56
|
+
</head>
|
57
|
+
|
58
|
+
<body class="not-front not-logged-in page-node node-type-transac-page no-sidebars sncfcom-b2c sncfcom-colors-cb0044 i18n-en not-js">
|
59
|
+
|
60
|
+
|
61
|
+
<ul id="skip-links"><li><a href="#navbar-wrapper">Go to main menu</a></li><li><a href="#left-menu">Go to secondary menu</a></li><li><a href="#content">Go to content</a></li><li><a href="#footer">Go to footer</a></li></ul>
|
62
|
+
|
63
|
+
<div id='bubble_print' class='out'>Print this page</div><div id='bubble_share' class='out'>Share this page</div>
|
64
|
+
|
65
|
+
<div id="navbar-wrapper">
|
66
|
+
<div id="navbar">
|
67
|
+
<div id="sncf-barre-galactique" class="grid_d">
|
68
|
+
|
69
|
+
<div id="primary-menu">
|
70
|
+
<ul class="links"><li class="menu-12124 active-trail first"><a href="/en/passengers" title=" (Active section)"><span><span>Passengers</span></span></a></li>
|
71
|
+
<li class="menu-12126"><a href="/en/businesses-communities"><span><span>Businesses & Communities</span></span></a></li>
|
72
|
+
<li class="menu-15545 last"><a href="/en/group"><span><span>SNCF Group</span></span></a></li>
|
73
|
+
</ul> </div>
|
74
|
+
|
75
|
+
<div class="barre_right">
|
76
|
+
|
77
|
+
<div id="radio-menu">
|
78
|
+
<a href="#" class="open_radio"><span class="bold">SNCF</span> LA RADIO</a>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
|
82
|
+
<div id="menu-langue">
|
83
|
+
<div><span>en</span></div><ul class="links" title="Change language"><li class="menu-1521 first"><a href="/voyageurs"><span class="js">Français</span><span class="no-js">Fr</span></a></li>
|
84
|
+
<li class="menu-1522"><a href="/en/passengers"><span class="js">English</span><span class="no-js">En</span></a></li>
|
85
|
+
<li class="menu-1523 last"><a href="/de/fahrgaste"><span class="js">Deutsch</span><span class="no-js">De</span></a></li>
|
86
|
+
</ul> </div>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div> </div>
|
91
|
+
</div>
|
92
|
+
<div id="navbar-spacer"></div>
|
93
|
+
|
94
|
+
<div class="container_d">
|
95
|
+
|
96
|
+
|
97
|
+
<div class="grid_a" id="sidebar-left">
|
98
|
+
<div id="left-menu">
|
99
|
+
<div class="telecommand"><div class="arrow"></div><div class="content"><div class="logo"><a href="/en/passengers" title="Logo SNCF"><img src="/theme/images/logo-sncf.png" alt="Logo SNCF" title="Logo SNCF" width="131" height="76" /></a></div><ul><li class="menu-17388 active "><div class="text"><span><span>Tickets & <span class="sncfcom-colors-automatic">train status</span></span></span></div><div class="submenu"><ul class="tc-content-2"><li class="menu-17393 no-icon first "><a href="http://en.voyages-sncf.com/en/" class=" " title="" target=""><span><span>Reservations</span></span></a></li><li class="menu-17389 active no-icon last "><a href="/en/sub-home/17389" class="sub-panel-form sub-form_infos_trafic has_sub-home sub-home-mlid-17389 " title="Open "Timetables & real-time traffic updates" in a floating panel" target=""><span><span class='double_line'>Timetables & real-time <br /><span class="sncfcom-colors-automatic">traffic updates</span></span></span></a></li></ul></div></li><li class="menu-58934 "><div class="text"><span><span>Passenger services</span></span></div><div class="submenu"><ul class="tc-content-2"><li class="menu-58935 first "><a href="/en/sub-home/58935" class=" has_sub-home sub-home-mlid-58935 " title="" target=""><span><span>All <span class="sncfcom-colors-automatic">passengers</span></span></span></a></li><li class="menu-58942 "><a href="/en/sub-home/58942" class=" has_sub-home sub-home-mlid-58942 " title="" target=""><span><span>Business <span class="sncfcom-colors-automatic">travel</span></span></span></a></li><li class="menu-58943 "><a href="/en/sub-home/58943" class=" has_sub-home sub-home-mlid-58943 " title="" target=""><span><span>Disability <span class="sncfcom-colors-automatic">access</span></span></span></a></li><li class="menu-58944 last "><a href="/en/sub-home/58944" class=" has_sub-home sub-home-mlid-58944 " title="" target=""><span><span>Group <span class="sncfcom-colors-automatic">travel</span></span></span></a></li></ul></div></li><li class="menu-58939 "><div class="text"><span><span>Trains & coaches</span></span></div><div class="submenu"><ul class="tc-content-2"><li class="menu-58945 first "><a href="/en/sub-home/58945" class=" has_sub-home sub-home-mlid-58945 " title="" target=""><span><span>French <span class="sncfcom-colors-automatic">regions</span></span></span></a></li><li class="menu-58946 "><a href="/en/trains/transilien" class=" " title="" target=""><span><span>Paris <span class="sncfcom-colors-automatic">region</span></span></span></a></li><li class="menu-58947 "><a href="/en/sub-home/58947" class=" has_sub-home sub-home-mlid-58947 " title="" target=""><span><span>France</span></span></a></li><li class="menu-58948 last "><a href="/en/sub-home/58948" class=" has_sub-home sub-home-mlid-58948 " title="" target=""><span><span>Europe</span></span></a></li></ul></div></li><li class="menu-58940 "><div class="text"><span><span>Fares & cards</span></span></div><div class="submenu"><ul class="tc-content-2"><li class="menu-17377 first "><a href="/en/special-deals" class=" " title="" target=""><span><span>Special Deals</span></span></a></li><li class="menu-58949 "><a href="/en/sub-home/58949" class=" has_sub-home sub-home-mlid-58949 " title="" target=""><span><span>Cards & <span class="sncfcom-colors-automatic">discounts</span></span></span></a></li><li class="menu-58950 "><a href="/en/sub-home/58950" class=" has_sub-home sub-home-mlid-58950 " title="" target=""><span><span>Special <span class="sncfcom-colors-automatic">fares</span></span></span></a></li><li class="menu-58951 last "><a href="/en/sub-home/58951" class=" has_sub-home sub-home-mlid-58951 " title="" target=""><span><span>Loyalty <span class="sncfcom-colors-automatic">programmes</span></span></span></a></li></ul></div></li><li class="menu-58941 "><div class="text"><span><span>Customer relations</span></span></div><div class="submenu"><ul class="tc-content-2"><li class="menu-58990 first "><a href="/en/sub-home/58990" class=" has_sub-home sub-home-mlid-58990 " title="" target=""><span><span>Talk to us <span class="sncfcom-colors-automatic">on line</span></span></span></a></li><li class="menu-58952 "><a href="/en/sub-home/58952" class=" has_sub-home sub-home-mlid-58952 " title="" target=""><span><span>Contact <span class="sncfcom-colors-automatic">us</span></span></span></a></li><li class="menu-58953 "><a href="/en/sub-home/58953" class=" has_sub-home sub-home-mlid-58953 " title="" target=""><span><span>Our <span class="sncfcom-colors-automatic">commitments</span></span></span></a></li><li class="menu-58954 last "><a href="/en/sub-home/58954" class=" has_sub-home sub-home-mlid-58954 " title="" target=""><span><span class='double_line'>After-sales service <br /><span class="sncfcom-colors-automatic">& Ombudsman</span></span></span></a></li></ul></div></li></ul></div></div>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
<div class="grid_c container_content_12" id="content">
|
105
|
+
|
106
|
+
<div id="sncf-logo-print" class="grid_12"><img src="/theme/images/logo.png" alt ="" /></div>
|
107
|
+
|
108
|
+
|
109
|
+
<div class="content_text">
|
110
|
+
<div class="breadcrumb grid_10"><ul><li>Passengers</li> / <li>Tickets & train status</li> / <li>Timetables & real-time traffic updates</li> / <li title="Active page" class="last">Résultat de recherche : fiche train (en)</li></ul></div><div class="action-links grid_2"> <span> <a class="print" target="_blank" href="/en/jprint/train/resultats">
|
111
|
+
</a>
|
112
|
+
<a role="button" class="addthis_button share" href="/en/horaires-info-trafic/train/resultats#">Share this page</a></span></div><div id="node-32510" class=" node clear-block">
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<div class="content">
|
117
|
+
<div id="block-itineraires" class="transac-block transac-header">
|
118
|
+
|
119
|
+
<div class="container_12">
|
120
|
+
<h1 class="grid_9">
|
121
|
+
Timetables & real-time <br/><span class="sncfcom-colors-automatic">traffic updates</span>
|
122
|
+
</h1>
|
123
|
+
<div id="description" class="grid_8">
|
124
|
+
<h2>
|
125
|
+
Your <span class="sncfcom-colors-automatic">
|
126
|
+
search </span>
|
127
|
+
</h2>
|
128
|
+
|
129
|
+
<p class="search_summary">
|
130
|
+
Train no. : <strong>6815</strong><br/>
|
131
|
+
Travel date :
|
132
|
+
<strong> Saturday 25 April </strong>
|
133
|
+
</p>
|
134
|
+
|
135
|
+
<div class="search_modify">
|
136
|
+
<a href="/sncf/train/displayForm" id="lien-modifiere" class="sncfcom-colors-action-automatic">
|
137
|
+
Modify your search </a>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
<hr class="clear border grid_12" />
|
145
|
+
<div id="result-container" class="grid_12 dedoublonnage">
|
146
|
+
|
147
|
+
<p id ="trains-doublons">Several trains match your search:</p>
|
148
|
+
<ul class="result-itineraries">
|
149
|
+
<li class="result-itinerary">
|
150
|
+
<ul>
|
151
|
+
<li class="itinerary-content ">
|
152
|
+
<input type="hidden" name="heure-depart" value="1429971360000" />
|
153
|
+
<input type="hidden" name="nb-correspondance" value="0" />
|
154
|
+
<input type="hidden" name="duree-trajet" value="386" />
|
155
|
+
<ul>
|
156
|
+
<li class="itinerary-abstract">
|
157
|
+
<div class="cell duration">Duration <strong>6h26</strong></div>
|
158
|
+
<div class="cell connection">
|
159
|
+
Direct journey </div>
|
160
|
+
<div class="cell itinerary-message ">
|
161
|
+
<span class="middle">
|
162
|
+
|
163
|
+
</span>
|
164
|
+
</div>
|
165
|
+
<div class="cell emissions">
|
166
|
+
<div class="co2-value"> : 2.7 kg </div>
|
167
|
+
</div>
|
168
|
+
<hr class="clear" />
|
169
|
+
</li>
|
170
|
+
<li class="row">
|
171
|
+
<table class="timetable ">
|
172
|
+
<tr class="itinerary-header">
|
173
|
+
<th class="duration">
|
174
|
+
Timetables </th>
|
175
|
+
<th class="duration new-schedule">
|
176
|
+
</th>
|
177
|
+
<th class="line"></th>
|
178
|
+
<th class="stations">Journey</th>
|
179
|
+
<th class="type">Type</th>
|
180
|
+
<th class="info">Information</th>
|
181
|
+
</tr>
|
182
|
+
<tr class="itinerary-start first ">
|
183
|
+
<td class="time ">16H16</td>
|
184
|
+
<td class="time new-schedule"></td>
|
185
|
+
<td class="line"></td>
|
186
|
+
<td class="stations"><div class="station">DIJON VILLE</div></td>
|
187
|
+
|
188
|
+
<td class="type TRN center" rowspan="2" >
|
189
|
+
<div class="train-type">TGV</div>
|
190
|
+
<div class="train-number">no.<strong>6815</strong></div>
|
191
|
+
</td>
|
192
|
+
|
193
|
+
<td class="info separator " >
|
194
|
+
<span class="titre">
|
195
|
+
On time
|
196
|
+
</span>
|
197
|
+
<hr/>
|
198
|
+
</td>
|
199
|
+
</tr>
|
200
|
+
<tr class="itinerary-end last ">
|
201
|
+
<td class="time ">22H37</td>
|
202
|
+
<td class="time new-schedule"></td>
|
203
|
+
<td class="line"></td>
|
204
|
+
<td class="stations">
|
205
|
+
<div class="station">NICE VILLE</div>
|
206
|
+
</td>
|
207
|
+
<td class="info disruption">
|
208
|
+
<span class="titre">
|
209
|
+
Delayed arrival 5MIN
|
210
|
+
</span>
|
211
|
+
</td>
|
212
|
+
</tr>
|
213
|
+
</table>
|
214
|
+
<a href="/sncf/train/displayDetailTrain?idItineraire=0" class="plus" action="train/displayDetailTrain?idItineraire=0">+</a>
|
215
|
+
</li>
|
216
|
+
</ul>
|
217
|
+
</li>
|
218
|
+
</ul>
|
219
|
+
</li>
|
220
|
+
<li class="result-itinerary">
|
221
|
+
<ul>
|
222
|
+
<li class="itinerary-content ">
|
223
|
+
<input type="hidden" name="heure-depart" value="1429945920000" />
|
224
|
+
<input type="hidden" name="nb-correspondance" value="0" />
|
225
|
+
<input type="hidden" name="duree-trajet" value="45" />
|
226
|
+
<ul>
|
227
|
+
<li class="itinerary-abstract">
|
228
|
+
<div class="cell duration">Duration <strong>0h45</strong></div>
|
229
|
+
<div class="cell connection">
|
230
|
+
Direct journey </div>
|
231
|
+
<div class="cell itinerary-message ">
|
232
|
+
<span class="middle">
|
233
|
+
|
234
|
+
</span>
|
235
|
+
</div>
|
236
|
+
<div class="cell emissions">
|
237
|
+
<div class="co2-value">n.a. </div>
|
238
|
+
</div>
|
239
|
+
<hr class="clear" />
|
240
|
+
</li>
|
241
|
+
<li class="row">
|
242
|
+
<table class="timetable ">
|
243
|
+
<tr class="itinerary-header">
|
244
|
+
<th class="duration">
|
245
|
+
Timetables </th>
|
246
|
+
<th class="duration new-schedule">
|
247
|
+
</th>
|
248
|
+
<th class="line"></th>
|
249
|
+
<th class="stations">Journey</th>
|
250
|
+
<th class="type">Type</th>
|
251
|
+
<th class="info">Information</th>
|
252
|
+
</tr>
|
253
|
+
<tr class="itinerary-start first ">
|
254
|
+
<td class="time ">09H12</td>
|
255
|
+
<td class="time new-schedule"></td>
|
256
|
+
<td class="line"></td>
|
257
|
+
<td class="stations"><div class="station">SPIEZ</div></td>
|
258
|
+
|
259
|
+
<td class="type TRN center" rowspan="2" >
|
260
|
+
<div class="train-type">INTERCITÉS</div>
|
261
|
+
<div class="train-number">no.<strong>6815</strong></div>
|
262
|
+
</td>
|
263
|
+
|
264
|
+
<td class="info center " rowspan="2">
|
265
|
+
<span class="titre">
|
266
|
+
On time
|
267
|
+
</span>
|
268
|
+
|
269
|
+
</td>
|
270
|
+
</tr>
|
271
|
+
<tr class="itinerary-end last ">
|
272
|
+
<td class="time ">09H57</td>
|
273
|
+
<td class="time new-schedule"></td>
|
274
|
+
<td class="line"></td>
|
275
|
+
<td class="stations">
|
276
|
+
<div class="station">ZWEISIMMEN</div>
|
277
|
+
</td>
|
278
|
+
</tr>
|
279
|
+
</table>
|
280
|
+
<a href="/sncf/train/displayDetailTrain?idItineraire=1" class="plus" action="train/displayDetailTrain?idItineraire=1">+</a>
|
281
|
+
</li>
|
282
|
+
</ul>
|
283
|
+
</li>
|
284
|
+
</ul>
|
285
|
+
</li>
|
286
|
+
</ul>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
|
290
|
+
</div>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
</div>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
<div class="grid_c alpha omega" id="footer">
|
298
|
+
<div class="footer_content">
|
299
|
+
|
300
|
+
<div id="forgotten_password_block">
|
301
|
+
<a id="lb-close" tabindex="2">Fermer la popin</a>
|
302
|
+
<div class="forgotten_password identity">
|
303
|
+
<h3>Mot de passe oublié ?</h3>
|
304
|
+
<hr class="clear-border" />
|
305
|
+
<span class="identity-message">Indiquez l'adresse électronique utilisée lors de la création<br /> de votre compte. Un courriel vous sera envoyé pour définir<br /> votre mot de passe.</span>
|
306
|
+
<div class="form-item mail">
|
307
|
+
<label for="forgotten_password_email">Adresse électronique :</label>
|
308
|
+
<div class="message_fpw sncfcom-colors-error-automatic sncfcom-colors-automatic"></div>
|
309
|
+
<input type="text" maxlength="60" size="60" name="email_link" id="forgotten_password_email" value="" />
|
310
|
+
</div>
|
311
|
+
<div class="form-item">
|
312
|
+
<input type="submit" name="op" id="edit-send-mail-retrieve-password" value="Envoyer" class="form-submit sncfcom-colors-action-automatic sncfcom-colors-internal-caps-automatic" />
|
313
|
+
</div>
|
314
|
+
<div class="response-forgotten-password sncfcom-colors-automatic"></div>
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
<div id="block-sncfcom_navigation-footer" class="block block-sncfcom_navigation">
|
318
|
+
|
319
|
+
<div class="content">
|
320
|
+
|
321
|
+
<h2 class="grid_3 omega">Quick access : </h2>
|
322
|
+
<div id="quick-access" class="grid_10 alpha omega"><ul class="menu"><li class="leaf first"><a href="/en/education/schools">Teachers</a></li>
|
323
|
+
<li class="leaf last"><a href="/en/meet-sncf/finance/news">Finance</a></li>
|
324
|
+
</ul></div>
|
325
|
+
|
326
|
+
<hr class="clear border grid_12 no-margin" />
|
327
|
+
|
328
|
+
<div id="universes" class="grid_12"><ul class="menu"><li class="grid_4 first "><span><span>Passengers</span></span><ul class="menu"><li><a href="/en/reductions/lowest-fares">Travel at the lowest fares</a></li><li><a href="/en/services/mobile-apps-old">Mobile apps</a></li><li><a href="/en/services/after-sales-services">After-sales service</a></li></ul></li><li class="grid_4 "><span><span>Business and local communities</span></span><ul class="menu"><li><a href="/en/sub-home/15515">For business</a></li><li><a href="/en/sub-home/15518">For local communities</a></li><li><a href="/en/railway-companies">Railway Companies</a></li></ul></li><li class="grid_4 last "><span><span>SNCF Group</span></span><ul class="menu"><li><a href="/en/businesses/global-presence">Our global presence</a></li><li><a href="/en/our-commitments/sncf-foundation">SNCF Foundation</a></li></ul></li></ul></div>
|
329
|
+
|
330
|
+
<div id="radio-link" class="grid_4"><a href="http://laradio.sncf.com" target="_blank"><span class="bold">SNCF</span> LA RADIO</a></div>
|
331
|
+
<div id="about" class="grid_8"><ul class="menu"><li class="leaf first"><a href="/en/footer/legal-notice">Legal notice</a></li>
|
332
|
+
<li class="leaf last"><a href="http://sncf.com/cil/registre/">Contact for IT & civil liberties issues</a></li>
|
333
|
+
</ul></div>
|
334
|
+
|
335
|
+
<hr class="clear" /> </div>
|
336
|
+
</div>
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
</div>
|
341
|
+
<div class="clear"></div>
|
342
|
+
|
343
|
+
</div>
|
344
|
+
<script type="text/javascript">
|
345
|
+
<!--//--><![CDATA[//><!--
|
346
|
+
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-1308810-17"]);_gaq.push(["b._setAccount", "UA-1308810-1"]);(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();
|
347
|
+
//--><!]]>
|
348
|
+
</script>
|
349
|
+
|
350
|
+
</body>
|
351
|
+
</html>
|
352
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Gares::Train do
|
6
|
+
describe 'a delayed train' do
|
7
|
+
|
8
|
+
let (:train_number) { 17709 }
|
9
|
+
let (:date) { Time.parse("2015-04-25") }
|
10
|
+
|
11
|
+
before do
|
12
|
+
# See tasks/fixtures.rake to change dataset
|
13
|
+
fake_response_for_train(train_number)
|
14
|
+
end
|
15
|
+
|
16
|
+
subject do
|
17
|
+
Gares::Train.new(train_number, date)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "is delayed" do
|
21
|
+
expect(subject).to be_delayed
|
22
|
+
end
|
23
|
+
|
24
|
+
it "has a departure station" do
|
25
|
+
expect(subject.departure.departure_date).to eq(Time.parse('2015-04-25 09:18:00'))
|
26
|
+
expect(subject.departure.real_departure_date).to eq(Time.parse('2015-04-25 09:28:00'))
|
27
|
+
expect(subject.departure.station.name).to eq('Lyon Part Dieu')
|
28
|
+
expect(subject.departure.station.lat).to eql(45.760281)
|
29
|
+
expect(subject.departure.platform).to eq('--')
|
30
|
+
|
31
|
+
expect(subject.departure.delayed?).to be(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "has stops" do
|
35
|
+
expect(subject.stops.size).to eq(12)
|
36
|
+
expect(subject.stops.first.station.name).to eq('Vienne')
|
37
|
+
|
38
|
+
expect(subject.stops[2].station.name).to eq('Tain l\'Hermitage Tournon')
|
39
|
+
expect(subject.stops[2].platform).to eq('B')
|
40
|
+
expect(subject.stops[2].minutes_of_delay).to eq(10)
|
41
|
+
|
42
|
+
expect(subject.stops.last.station.name).to eq('Vitrolles Aéroport Marseille Provence')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "has a arrival station" do
|
46
|
+
expect(subject.arrival.arrival_date).to eq(Time.parse('2015-04-25 12:50:00'))
|
47
|
+
expect(subject.arrival.real_arrival_date).to eq(Time.parse('2015-04-25 13:00:00'))
|
48
|
+
expect(subject.arrival.station.name).to eq('Marseille St Charles')
|
49
|
+
expect(subject.arrival.platform).to eq('--')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'an on-time train' do
|
54
|
+
|
55
|
+
let (:train_number) { 11641 }
|
56
|
+
let (:date) { Time.parse("2015-04-25") }
|
57
|
+
|
58
|
+
before do
|
59
|
+
# See tasks/fixtures.rake to change dataset
|
60
|
+
fake_response_for_train(train_number)
|
61
|
+
end
|
62
|
+
|
63
|
+
subject do
|
64
|
+
Gares::Train.new(train_number, date)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "is delayed" do
|
68
|
+
expect(subject).to_not be_delayed
|
69
|
+
end
|
70
|
+
|
71
|
+
it "has a departure station" do
|
72
|
+
expect(subject.departure.departure_date).to eq(Time.parse('2015-04-25 06:42:00'))
|
73
|
+
expect(subject.departure.real_departure_date).to be_nil
|
74
|
+
expect(subject.departure.station.name).to eq('Paris Est')
|
75
|
+
expect(subject.departure.platform).to eq('--')
|
76
|
+
|
77
|
+
expect(subject.departure.delayed?).to be(false)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "has stops" do
|
81
|
+
expect(subject.stops.size).to eq(7)
|
82
|
+
expect(subject.stops.first.station.name).to eq('Nogent sur Seine')
|
83
|
+
|
84
|
+
expect(subject.stops[2].station.name).to eq('Troyes')
|
85
|
+
|
86
|
+
expect(subject.stops.last.station.name).to eq('Langres')
|
87
|
+
end
|
88
|
+
|
89
|
+
it "has a arrival station" do
|
90
|
+
expect(subject.arrival.arrival_date).to eq(Time.parse('2015-04-25 09:45:00'))
|
91
|
+
expect(subject.arrival.real_arrival_date).to be_nil
|
92
|
+
expect(subject.arrival.station.name).to eq('Culmont - Chalindrey')
|
93
|
+
expect(subject.arrival.platform).to eq('--')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,8 +8,13 @@
|
|
8
8
|
# no changes to the gares-en-mouvement.com interface have affected the parser.
|
9
9
|
###
|
10
10
|
|
11
|
+
require 'simplecov'
|
11
12
|
require 'coveralls'
|
12
|
-
|
13
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
14
|
+
SimpleCov::Formatter::HTMLFormatter,
|
15
|
+
Coveralls::SimpleCov::Formatter
|
16
|
+
]
|
17
|
+
SimpleCov.start
|
13
18
|
|
14
19
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
15
20
|
require 'gares'
|
@@ -18,6 +23,7 @@ def read_fixture(path)
|
|
18
23
|
File.read(File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', path)))
|
19
24
|
end
|
20
25
|
|
26
|
+
# Fixtures for Gares
|
21
27
|
GARES_SAMPLES = {
|
22
28
|
'http://www.gares-en-mouvement.com/fr/frqxb/services-en-gare/vente/' => 'frqxb-services-vente',
|
23
29
|
'http://www.gares-en-mouvement.com/fr/frqxb/services-en-gare/service/' => 'frqxb-services',
|
@@ -30,6 +36,14 @@ GARES_SAMPLES = {
|
|
30
36
|
'https://www.kimonolabs.com/api/7jys32dy?apikey=lsOO4tNm78cH9JxqWg9gAk9l4nYaou9j&kimmodify=1' => 'search'
|
31
37
|
}
|
32
38
|
|
39
|
+
# Sample fixtures for Trains
|
40
|
+
TRAINS_SAMPLES = [
|
41
|
+
{ 17709 => 'train-17709' },
|
42
|
+
{ 11641 => 'train-11641' },
|
43
|
+
{ 17495 => 'train-17495' },
|
44
|
+
{ 6815 => 'train-6815' }, # Multi-itinerary
|
45
|
+
]
|
46
|
+
|
33
47
|
unless ENV['LIVE_TEST']
|
34
48
|
begin
|
35
49
|
require 'rubygems'
|
@@ -44,3 +58,18 @@ unless ENV['LIVE_TEST']
|
|
44
58
|
puts 'You can run `gem install fakeweb` to stub out the responses.'
|
45
59
|
end
|
46
60
|
end
|
61
|
+
|
62
|
+
def fake_response_for_train(number)
|
63
|
+
unless ENV['LIVE_TEST']
|
64
|
+
begin
|
65
|
+
response = TRAINS_SAMPLES.find { |sample| sample.keys.first == number }.values.first
|
66
|
+
sncf_result_url = 'http://www.sncf.com/en/horaires-info-trafic/train/resultats'
|
67
|
+
FakeWeb.register_uri(:get, sncf_result_url, response: read_fixture("get-#{response}"))
|
68
|
+
sncf_post_url = 'http://www.sncf.com/sncf/train'
|
69
|
+
FakeWeb.register_uri(:post, sncf_post_url, response: read_fixture("post-#{response}"))
|
70
|
+
rescue LoadError
|
71
|
+
puts 'Could not load FakeWeb, these tests will hit gares-en-mouvement.com'
|
72
|
+
puts 'You can run `gem install fakeweb` to stub out the responses.'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/tasks/fixtures.rake
CHANGED
@@ -13,5 +13,27 @@ namespace :fixtures do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
16
|
+
TRAINS_SAMPLES.each do |train|
|
17
|
+
post_fixture = "post-#{train.values.first}"
|
18
|
+
get_fixture = "get-#{train.values.first}"
|
19
|
+
train_number = train.keys.first
|
20
|
+
next if !ONLY.empty? and !ONLY.include?(post_fixture)
|
21
|
+
page = `curl -is 'http://www.sncf.com/sncf/train' --data 'numeroTrain=#{train_number}&date=25%2F04%2F2015'`
|
22
|
+
|
23
|
+
File.open(File.expand_path(File.dirname(__FILE__) + "/../spec/fixtures/#{post_fixture}"), 'w') do |f|
|
24
|
+
f.write(page)
|
25
|
+
end
|
26
|
+
|
27
|
+
cookies = page.force_encoding('ISO-8859-1').encode('UTF-8').split("\n").map do |line|
|
28
|
+
if md = line.match(/Set-Cookie: (.*?);/)
|
29
|
+
md.captures.first
|
30
|
+
end
|
31
|
+
end.compact
|
32
|
+
page = `curl -is 'http://www.sncf.com/en/horaires-info-trafic/train/resultats' -H 'Cookie: #{cookies.join(";")}'`
|
33
|
+
|
34
|
+
File.open(File.expand_path(File.dirname(__FILE__) + "/../spec/fixtures/#{get_fixture}"), 'w') do |f|
|
35
|
+
f.write(page)
|
36
|
+
end
|
37
|
+
end
|
16
38
|
end
|
17
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gares
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Bonaud
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.13'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.13'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,6 +204,8 @@ files:
|
|
190
204
|
- lib/gares/station.rb
|
191
205
|
- lib/gares/station_list.rb
|
192
206
|
- lib/gares/string_extensions.rb
|
207
|
+
- lib/gares/train.rb
|
208
|
+
- lib/gares/train_stop.rb
|
193
209
|
- lib/gares/version.rb
|
194
210
|
- spec/fixtures/frabt
|
195
211
|
- spec/fixtures/frabt-services-vente
|
@@ -200,11 +216,20 @@ files:
|
|
200
216
|
- spec/fixtures/frqxb-services
|
201
217
|
- spec/fixtures/frqxb-services-vente
|
202
218
|
- spec/fixtures/frxag
|
219
|
+
- spec/fixtures/get-train-11641
|
220
|
+
- spec/fixtures/get-train-17495
|
221
|
+
- spec/fixtures/get-train-17709
|
222
|
+
- spec/fixtures/get-train-6815
|
223
|
+
- spec/fixtures/post-train-11641
|
224
|
+
- spec/fixtures/post-train-17495
|
225
|
+
- spec/fixtures/post-train-17709
|
226
|
+
- spec/fixtures/post-train-6815
|
203
227
|
- spec/fixtures/search
|
204
228
|
- spec/gares/gare_spec.rb
|
205
229
|
- spec/gares/sales_spec.rb
|
206
230
|
- spec/gares/search_spec.rb
|
207
231
|
- spec/gares/string_extensions_spec.rb
|
232
|
+
- spec/gares/train_spec.rb
|
208
233
|
- spec/spec_helper.rb
|
209
234
|
- tasks/fixtures.rake
|
210
235
|
- tasks/rspec.rake
|