gillbus 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gillbus/helpers/parser.rb +9 -4
- data/lib/gillbus/structs/trip.rb +4 -0
- data/lib/gillbus/structs/trip_options.rb +75 -29
- data/lib/gillbus/version.rb +1 -1
- data/test/responses/searchTrips-new-options-format.xml +243 -0
- data/test/search_trips_test.rb +53 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4f1397e33a3f080cc2cbaf71079d3ee1a2d620
|
4
|
+
data.tar.gz: 0cceb90c341e2137e81b51d2ef597b5e1b957844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51110d42884c545f9faccba44bcd1ca5aeff7c321002ec57cec42a80c125902ca3b8223258a36ce1685254cc12a762e8347fe72ea1e3831f1da052f78c373bb9
|
7
|
+
data.tar.gz: 3eb457ec67c063dfc708778f16deaf8033df8feccd5b5571bbead73cec95e0f4efd4c123ef7d1d4ca0450a0a092e5ebd0fb37a6ba2b6c778d4f400d88d00cfd9
|
@@ -40,12 +40,15 @@ class Gillbus
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def fetch_value(key:, root:)
|
43
|
+
target_doc = root ? doc[root] : doc
|
44
|
+
return unless target_doc
|
45
|
+
|
43
46
|
if key.is_a?(Regexp)
|
44
|
-
|
45
|
-
elsif
|
46
|
-
|
47
|
+
target_doc.select { |k| k =~ key }
|
48
|
+
elsif key.is_a?(Array)
|
49
|
+
key.map { |k| Array(target_doc[k]) }.inject(&:+)
|
47
50
|
else
|
48
|
-
|
51
|
+
target_doc[key]
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
@@ -81,6 +84,8 @@ class Gillbus
|
|
81
84
|
|
82
85
|
def string(val)
|
83
86
|
return if val == NULL_CONST
|
87
|
+
# если это тег с атрибутами - возвращаем только содержимое тега
|
88
|
+
return val.last if val.is_a?(Array) && val.size == 2
|
84
89
|
val
|
85
90
|
end
|
86
91
|
|
data/lib/gillbus/structs/trip.rb
CHANGED
@@ -3,45 +3,91 @@ class Gillbus
|
|
3
3
|
extend Fields
|
4
4
|
include UpdateAttrs
|
5
5
|
|
6
|
-
#
|
7
|
-
field :services, [TripService],
|
6
|
+
# Услуги на рейсе (Wi-Fi, розетки и т.п.)
|
7
|
+
field :services, [TripService],
|
8
|
+
root: 'TRIP_SERVICES',
|
9
|
+
key: 'TRIP_SERVICE'
|
8
10
|
|
9
|
-
#
|
10
|
-
|
11
|
+
# Условия по багажу на рейсе.
|
12
|
+
# Поддерживаются старый и новый форматы:
|
13
|
+
# <LUGGAGE>
|
14
|
+
# <ITEM>Text</ITEM>
|
15
|
+
# <LUGGAG ID="1">Text</LUGGAG>
|
16
|
+
# </LUGGAGE>
|
17
|
+
field :luggage, [:string],
|
18
|
+
root: 'LUGGAGE',
|
19
|
+
key: ['ITEM', 'LUGGAG']
|
11
20
|
|
12
|
-
#
|
13
|
-
|
21
|
+
# Условия рассадки на рейсе.
|
22
|
+
# Поддерживаются старый и новый форматы:
|
23
|
+
# <SEATING>
|
24
|
+
# <ITEM>Text</ITEM>
|
25
|
+
# <SEATIN ID="1">Text</SEATIN>
|
26
|
+
# </SEATING>
|
27
|
+
field :seating, [:string],
|
28
|
+
root: 'SEATING',
|
29
|
+
key: ['ITEM', 'SEATIN']
|
14
30
|
|
15
|
-
#
|
16
|
-
|
31
|
+
# Информация о технических остановках.
|
32
|
+
# Поддерживаются старый и новый форматы:
|
33
|
+
# <TECHNICAL_STOP>
|
34
|
+
# <ITEM>Text</ITEM>
|
35
|
+
# <TECHNICAL_STO ID="1">Text</TECHNICAL_STO>
|
36
|
+
# </TECHNICAL_STOP>
|
37
|
+
field :technical_stops, [:string],
|
38
|
+
root: 'TECHNICAL_STOP',
|
39
|
+
key: ['ITEM', 'TECHNICAL_STO']
|
17
40
|
|
18
|
-
#
|
19
|
-
|
41
|
+
# Критичная информация о рейсе.
|
42
|
+
# Поддерживаются старый и новый форматы:
|
43
|
+
# <CRITICAL_INFO>
|
44
|
+
# <ITEM>Text</ITEM>
|
45
|
+
# <CRITICAL_INF ID="1">Text</CRITICAL_INF>
|
46
|
+
# </CRITICAL_INFO>
|
47
|
+
field :critical_info, [:string],
|
48
|
+
root: 'CRITICAL_INFO',
|
49
|
+
key: ['ITEM', 'CRITICAL_INF']
|
20
50
|
|
21
|
-
#
|
22
|
-
|
51
|
+
# Опции полученные от внешних ресурсов.
|
52
|
+
# Поддерживаются старый и новый форматы:
|
53
|
+
# <RESOURCE_TRIP_OPTION>
|
54
|
+
# <ITEM>Text</ITEM>
|
55
|
+
# <RESOURCE_TRIP_OPTIO ID="1">Text</RESOURCE_TRIP_OPTIO>
|
56
|
+
# </RESOURCE_TRIP_OPTION>
|
57
|
+
field :resource_options, [:string],
|
58
|
+
root: 'RESOURCE_TRIP_OPTION',
|
59
|
+
key: ['ITEM', 'RESOURCE_TRIP_OPTIO']
|
23
60
|
|
24
|
-
#
|
25
|
-
|
61
|
+
# Информация, отмеченная как "прочее".
|
62
|
+
# Поддерживаются старый и новый форматы:
|
63
|
+
# <OTHER>
|
64
|
+
# <ITEM>Text</ITEM>
|
65
|
+
# <OTHE ID="1">Text</OTHE>
|
66
|
+
# </OTHER>
|
67
|
+
field :other, [:string],
|
68
|
+
root: 'OTHER',
|
69
|
+
key: ['ITEM', 'OTHE']
|
26
70
|
|
27
|
-
#
|
28
|
-
|
71
|
+
# Поддерживаются старый и новый форматы:
|
72
|
+
# <PROMO>
|
73
|
+
# <ITEM>Text</ITEM>
|
74
|
+
# <PROM ID="1">Text</PROM>
|
75
|
+
# </PROMO>
|
76
|
+
field :promo, [:string],
|
77
|
+
root: 'PROMO',
|
78
|
+
key: ['ITEM', 'PROM']
|
29
79
|
|
30
|
-
#
|
31
|
-
field :
|
80
|
+
# Опции, связанные с билетами.
|
81
|
+
field :tickets, [TicketsOption],
|
82
|
+
root: 'TICKETS',
|
83
|
+
key: 'TICKET'
|
32
84
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
parser do # better not to let flag value out of this gem
|
38
|
-
def adertising_bool(vals)
|
39
|
-
vals.include?('ADVERTISING')
|
40
|
-
end
|
85
|
+
def advertising
|
86
|
+
promo.include?('ADVERTISING')
|
87
|
+
end
|
41
88
|
|
42
|
-
|
43
|
-
|
44
|
-
end
|
89
|
+
def busfor_recommend
|
90
|
+
promo.include?('BUSFOR_RECOMMEND')
|
45
91
|
end
|
46
92
|
|
47
93
|
def self.build_blank
|
data/lib/gillbus/version.rb
CHANGED
@@ -0,0 +1,243 @@
|
|
1
|
+
<DATA>
|
2
|
+
<COMPLETED>true</COMPLETED>
|
3
|
+
<TRIP>
|
4
|
+
<ID>3451212695530327295</ID>
|
5
|
+
<RES_ID>10</RES_ID>
|
6
|
+
<NUMBER>2197</NUMBER>
|
7
|
+
<START_CITY_NAME>Москва</START_CITY_NAME>
|
8
|
+
<END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
|
9
|
+
<START_DATE>23.08.2014</START_DATE>
|
10
|
+
<END_DATE>24.08.2014</END_DATE>
|
11
|
+
<START_TIME>19:00</START_TIME>
|
12
|
+
<START_TIMEZONE>Europe/Moscow</START_TIMEZONE>
|
13
|
+
<END_TIME>06:30</END_TIME>
|
14
|
+
<END_TIMEZONE>Europe/Moscow</END_TIMEZONE>
|
15
|
+
<BUS_MODEL/>
|
16
|
+
<PLACES_COUNT>18</PLACES_COUNT>
|
17
|
+
<FREE_PLACES_COUNT>3</FREE_PLACES_COUNT>
|
18
|
+
<FREE_BUSY_PLACES>3/18</FREE_BUSY_PLACES>
|
19
|
+
<CARRIER_NAME>ИП Унанян И.А.</CARRIER_NAME>
|
20
|
+
<TIME_IN_ROAD>11:30</TIME_IN_ROAD>
|
21
|
+
<STATION_BEGIN_NAME>Москва</STATION_BEGIN_NAME>
|
22
|
+
<STATION_BEGIN_ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</STATION_BEGIN_ADDRESS>
|
23
|
+
<STATION_END_NAME>Санкт-Петербург</STATION_END_NAME>
|
24
|
+
<STATION_END_ADDRESS>м. Купчино </STATION_END_ADDRESS>
|
25
|
+
<RESERVATION_ENABLED>true</RESERVATION_ENABLED>
|
26
|
+
<SALE_ENABLED>true</SALE_ENABLED>
|
27
|
+
<RETURN_ENABLED>false</RETURN_ENABLED>
|
28
|
+
<TIME_FOR_CANCEL>25</TIME_FOR_CANCEL>
|
29
|
+
<TRIP_FULL_SALE>false</TRIP_FULL_SALE>
|
30
|
+
<CAN_DISCOUNT>true</CAN_DISCOUNT>
|
31
|
+
<INTERNATIONAL>false</INTERNATIONAL>
|
32
|
+
<JOIN_BOOK_BUY>false</JOIN_BOOK_BUY>
|
33
|
+
<TRIP_MODE>1</TRIP_MODE>
|
34
|
+
<CUSTOM_STATUS>0</CUSTOM_STATUS>
|
35
|
+
<IMAGE_URL>null</IMAGE_URL>
|
36
|
+
<START_POINT_TYPE>null</START_POINT_TYPE>
|
37
|
+
<FAKE_TIME_IN_ROAD>true</FAKE_TIME_IN_ROAD>
|
38
|
+
<VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
|
39
|
+
<RECOMMENDED>true</RECOMMENDED>
|
40
|
+
<VEHICLE_FEATURES>null</VEHICLE_FEATURES>
|
41
|
+
<TOTAL_COST>1410.0</TOTAL_COST>
|
42
|
+
<CURRENCY>RUB</CURRENCY>
|
43
|
+
<CURRENCY_CODE>643</CURRENCY_CODE>
|
44
|
+
<REDIRECT_URL>http://example.com/123</REDIRECT_URL>
|
45
|
+
<TARIFF>
|
46
|
+
<SHORT_NAME>Y</SHORT_NAME>
|
47
|
+
<FULL_NAME/>
|
48
|
+
<START_DATE/>
|
49
|
+
<END_DATE/>
|
50
|
+
<DESCRIPTION/>
|
51
|
+
<TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
|
52
|
+
<TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
|
53
|
+
<COST>1410</COST>
|
54
|
+
<AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
|
55
|
+
<PASSENGER_BIRTHDAY/>
|
56
|
+
<PASSENGER_ISIC_NUMBER/>
|
57
|
+
<PASSENGER_STUDENT_TICKET/>
|
58
|
+
<RETURN_CAUSE lossless='true'>cause 1</RETURN_CAUSE>
|
59
|
+
<RETURN_CAUSE id='asdasd'>cause 2</RETURN_CAUSE>
|
60
|
+
<RETURN_CAUSE>cause 3</RETURN_CAUSE>
|
61
|
+
</TARIFF>
|
62
|
+
<POINT>
|
63
|
+
<NUMBER>0</NUMBER>
|
64
|
+
<GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
|
65
|
+
<NAME>Москва</NAME>
|
66
|
+
<ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
|
67
|
+
<ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
|
68
|
+
<ARRIVAL_TIME>19:00</ARRIVAL_TIME>
|
69
|
+
<DISPATCH_DATE/>
|
70
|
+
<DISPATCH_TIME/>
|
71
|
+
<CHECK_POINT>false</CHECK_POINT>
|
72
|
+
</POINT>
|
73
|
+
<POINT>
|
74
|
+
<NUMBER>1</NUMBER>
|
75
|
+
<GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
|
76
|
+
<NAME>Вышний Волочек</NAME>
|
77
|
+
<ADDRESS>трасса (М10)</ADDRESS>
|
78
|
+
<ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
|
79
|
+
<ARRIVAL_TIME>00:00</ARRIVAL_TIME>
|
80
|
+
<DISPATCH_DATE/>
|
81
|
+
<DISPATCH_TIME/>
|
82
|
+
<CHECK_POINT>false</CHECK_POINT>
|
83
|
+
</POINT>
|
84
|
+
<POINT>
|
85
|
+
<NUMBER>2</NUMBER>
|
86
|
+
<GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
|
87
|
+
<NAME>Великий Новгород</NAME>
|
88
|
+
<ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
|
89
|
+
<ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
|
90
|
+
<ARRIVAL_TIME>03:30</ARRIVAL_TIME>
|
91
|
+
<DISPATCH_DATE/>
|
92
|
+
<DISPATCH_TIME/>
|
93
|
+
<CHECK_POINT>false</CHECK_POINT>
|
94
|
+
</POINT>
|
95
|
+
<POINT>
|
96
|
+
<NUMBER>3</NUMBER>
|
97
|
+
<GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
|
98
|
+
<NAME>Санкт-Петербург</NAME>
|
99
|
+
<ADDRESS>м. Купчино </ADDRESS>
|
100
|
+
<ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
|
101
|
+
<ARRIVAL_TIME>06:30</ARRIVAL_TIME>
|
102
|
+
<DISPATCH_DATE/>
|
103
|
+
<DISPATCH_TIME/>
|
104
|
+
<CHECK_POINT>false</CHECK_POINT>
|
105
|
+
</POINT>
|
106
|
+
<OPTIONS>
|
107
|
+
<TRIP_SERVICES>
|
108
|
+
<TRIP_SERVICE ID="1">Кофе</TRIP_SERVICE>
|
109
|
+
<TRIP_SERVICE ID="15">Wi-Fi</TRIP_SERVICE>
|
110
|
+
</TRIP_SERVICES>
|
111
|
+
<LUGGAGE>
|
112
|
+
<LUGGAG ID="1">В стоимость входит провоз 2 единиц багажа свыше 80 кг.</LUGGAG>
|
113
|
+
<LUGGAG ID="2">Ручная кладь 20см x 40см x 30см входит в стоимость билета.</LUGGAG>
|
114
|
+
<LUGGAG ID="3">Превышение по багажу оплачивается в размере 1% от стоимости тарифа.</LUGGAG>
|
115
|
+
</LUGGAGE>
|
116
|
+
<TECHNICAL_STOP>
|
117
|
+
<TECHNICAL_STO ID="1">Технические остановки осуществляются каждые 2-3 часа.</TECHNICAL_STO>
|
118
|
+
</TECHNICAL_STOP>
|
119
|
+
<CRITICAL_INFO>
|
120
|
+
<CRITICAL_INF ID="1">ВНИМАНИЕ: Особые условия паспортного режима пересечения пропускного пункта (только с паспортами РБ и РФ).</CRITICAL_INF>
|
121
|
+
</CRITICAL_INFO>
|
122
|
+
<SEATING>
|
123
|
+
<SEATIN ID="1">Свободная рассадка.</SEATIN>
|
124
|
+
</SEATING>
|
125
|
+
<RESOURCE_TRIP_OPTION>
|
126
|
+
<RESOURCE_TRIP_OPTIO ID="1">Посадка начинается за 10 мин.</RESOURCE_TRIP_OPTIO>
|
127
|
+
</RESOURCE_TRIP_OPTION>
|
128
|
+
<OTHER>
|
129
|
+
<OTHE ID="1">Переправа</OTHE>
|
130
|
+
<OTHE ID="2">Трансфер</OTHE>
|
131
|
+
<OTHE>Cкидка при покупке раунд-трипа</OTHE>
|
132
|
+
</OTHER>
|
133
|
+
<PROMO>
|
134
|
+
<PROM ID="1">BUSFOR_RECOMMEND</PROM>
|
135
|
+
<PROM ID="2">ADVERTISING</PROM>
|
136
|
+
</PROMO>
|
137
|
+
<TICKETS>
|
138
|
+
<TICKET ID="7">ЭЛЕКТРОННЫЙ БИЛЕТ. Печать билета не требуется!</TICKET>
|
139
|
+
</TICKETS>
|
140
|
+
</OPTIONS>
|
141
|
+
</TRIP>
|
142
|
+
<TRIP>
|
143
|
+
<ID>-3986171261205069729</ID>
|
144
|
+
<RES_ID>10</RES_ID>
|
145
|
+
<NUMBER>2093</NUMBER>
|
146
|
+
<START_CITY_NAME>Москва</START_CITY_NAME>
|
147
|
+
<END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
|
148
|
+
<START_DATE>23.08.2014</START_DATE>
|
149
|
+
<END_DATE>24.08.2014</END_DATE>
|
150
|
+
<START_TIME>21:10</START_TIME>
|
151
|
+
<END_TIME>08:40</END_TIME>
|
152
|
+
<BUS_MODEL/>
|
153
|
+
<PLACES_COUNT>18</PLACES_COUNT>
|
154
|
+
<FREE_PLACES_COUNT>10</FREE_PLACES_COUNT>
|
155
|
+
<FREE_BUSY_PLACES>10/18</FREE_BUSY_PLACES>
|
156
|
+
<CARRIER_NAME>ИП Унанян И.А.</CARRIER_NAME>
|
157
|
+
<TIME_IN_ROAD>11:30</TIME_IN_ROAD>
|
158
|
+
<STATION_BEGIN_NAME>Москва</STATION_BEGIN_NAME>
|
159
|
+
<STATION_BEGIN_ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</STATION_BEGIN_ADDRESS>
|
160
|
+
<STATION_END_NAME>Санкт-Петербург</STATION_END_NAME>
|
161
|
+
<STATION_END_ADDRESS>м. Купчино </STATION_END_ADDRESS>
|
162
|
+
<RESERVATION_ENABLED>true</RESERVATION_ENABLED>
|
163
|
+
<SALE_ENABLED>true</SALE_ENABLED>
|
164
|
+
<RETURN_ENABLED>false</RETURN_ENABLED>
|
165
|
+
<TIME_FOR_CANCEL>25</TIME_FOR_CANCEL>
|
166
|
+
<TRIP_FULL_SALE>false</TRIP_FULL_SALE>
|
167
|
+
<CAN_DISCOUNT>true</CAN_DISCOUNT>
|
168
|
+
<INTERNATIONAL>false</INTERNATIONAL>
|
169
|
+
<JOIN_BOOK_BUY>false</JOIN_BOOK_BUY>
|
170
|
+
<RECOMMENDED>false</RECOMMENDED>
|
171
|
+
<TRIP_MODE>1</TRIP_MODE>
|
172
|
+
<CUSTOM_STATUS>0</CUSTOM_STATUS>
|
173
|
+
<IMAGE_URL>null</IMAGE_URL>
|
174
|
+
<START_POINT_TYPE>null</START_POINT_TYPE>
|
175
|
+
<VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
|
176
|
+
<VEHICLE_FEATURES>null</VEHICLE_FEATURES>
|
177
|
+
<TOTAL_COST>1410</TOTAL_COST>
|
178
|
+
<CURRENCY>RUB</CURRENCY>
|
179
|
+
<CURRENCY_CODE>643</CURRENCY_CODE>
|
180
|
+
<TARIFF>
|
181
|
+
<SHORT_NAME>Y</SHORT_NAME>
|
182
|
+
<FULL_NAME/>
|
183
|
+
<START_DATE/>
|
184
|
+
<END_DATE/>
|
185
|
+
<DESCRIPTION/>
|
186
|
+
<TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
|
187
|
+
<TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
|
188
|
+
<COST>1410</COST>
|
189
|
+
<AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
|
190
|
+
<PASSENGER_BIRTHDAY/>
|
191
|
+
<PASSENGER_ISIC_NUMBER/>
|
192
|
+
<PASSENGER_STUDENT_TICKET/>
|
193
|
+
<RETURN_CAUSE id='asdasd'>cause 1</RETURN_CAUSE>
|
194
|
+
<IS_EXCLUSIVE_PRICE>true</IS_EXCLUSIVE_PRICE>
|
195
|
+
</TARIFF>
|
196
|
+
<POINT>
|
197
|
+
<NUMBER>0</NUMBER>
|
198
|
+
<GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
|
199
|
+
<NAME>Москва</NAME>
|
200
|
+
<ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
|
201
|
+
<ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
|
202
|
+
<ARRIVAL_TIME>21:10</ARRIVAL_TIME>
|
203
|
+
<DISPATCH_DATE/>
|
204
|
+
<DISPATCH_TIME/>
|
205
|
+
<CHECK_POINT>false</CHECK_POINT>
|
206
|
+
</POINT>
|
207
|
+
<POINT>
|
208
|
+
<NUMBER>1</NUMBER>
|
209
|
+
<GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
|
210
|
+
<NAME>Вышний Волочек</NAME>
|
211
|
+
<ADDRESS>трасса (М10)</ADDRESS>
|
212
|
+
<ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
|
213
|
+
<ARRIVAL_TIME>02:10</ARRIVAL_TIME>
|
214
|
+
<DISPATCH_DATE/>
|
215
|
+
<DISPATCH_TIME/>
|
216
|
+
<CHECK_POINT>false</CHECK_POINT>
|
217
|
+
</POINT>
|
218
|
+
<POINT>
|
219
|
+
<NUMBER>2</NUMBER>
|
220
|
+
<GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
|
221
|
+
<NAME>Великий Новгород</NAME>
|
222
|
+
<ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
|
223
|
+
<ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
|
224
|
+
<ARRIVAL_TIME>05:40</ARRIVAL_TIME>
|
225
|
+
<DISPATCH_DATE/>
|
226
|
+
<DISPATCH_TIME/>
|
227
|
+
<CHECK_POINT>false</CHECK_POINT>
|
228
|
+
</POINT>
|
229
|
+
<POINT>
|
230
|
+
<NUMBER>3</NUMBER>
|
231
|
+
<GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
|
232
|
+
<NAME>Санкт-Петербург</NAME>
|
233
|
+
<ADDRESS>м. Купчино </ADDRESS>
|
234
|
+
<ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
|
235
|
+
<ARRIVAL_TIME>08:40</ARRIVAL_TIME>
|
236
|
+
<DISPATCH_DATE/>
|
237
|
+
<DISPATCH_TIME/>
|
238
|
+
<CHECK_POINT>false</CHECK_POINT>
|
239
|
+
</POINT>
|
240
|
+
<OPTIONS>
|
241
|
+
</OPTIONS>
|
242
|
+
</TRIP>
|
243
|
+
</DATA>
|
data/test/search_trips_test.rb
CHANGED
@@ -53,6 +53,10 @@ class SearchTripsResponseTest < Minitest::Test
|
|
53
53
|
Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-prod.xml'))
|
54
54
|
end
|
55
55
|
|
56
|
+
def get_successful_search_trips_with_new_options_format
|
57
|
+
Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-new-options-format.xml'))
|
58
|
+
end
|
59
|
+
|
56
60
|
def get_successful_search_trips_with_bad_data
|
57
61
|
Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-prod-invalid.xml'))
|
58
62
|
end
|
@@ -169,6 +173,55 @@ class SearchTripsResponseTest < Minitest::Test
|
|
169
173
|
assert options.busfor_recommend
|
170
174
|
end
|
171
175
|
|
176
|
+
def test_new_options_format
|
177
|
+
response = get_successful_search_trips_with_new_options_format
|
178
|
+
options = response.trips.first.options
|
179
|
+
|
180
|
+
services = {
|
181
|
+
1 => 'Кофе',
|
182
|
+
15 => 'Wi-Fi',
|
183
|
+
}
|
184
|
+
luggage_options = [
|
185
|
+
'В стоимость входит провоз 2 единиц багажа свыше 80 кг.',
|
186
|
+
'Ручная кладь 20см x 40см x 30см входит в стоимость билета.',
|
187
|
+
'Превышение по багажу оплачивается в размере 1% от стоимости тарифа.',
|
188
|
+
]
|
189
|
+
seating_options = [
|
190
|
+
'Свободная рассадка.',
|
191
|
+
]
|
192
|
+
technical_stops = [
|
193
|
+
'Технические остановки осуществляются каждые 2-3 часа.',
|
194
|
+
]
|
195
|
+
critical_info = [
|
196
|
+
'ВНИМАНИЕ: Особые условия паспортного режима пересечения пропускного пункта (только с паспортами РБ и РФ).',
|
197
|
+
]
|
198
|
+
resource_options = [
|
199
|
+
'Посадка начинается за 10 мин.',
|
200
|
+
]
|
201
|
+
other_options = [
|
202
|
+
'Переправа',
|
203
|
+
'Трансфер',
|
204
|
+
'Cкидка при покупке раунд-трипа',
|
205
|
+
]
|
206
|
+
titckets_options = [
|
207
|
+
'ЭЛЕКТРОННЫЙ БИЛЕТ. Печать билета не требуется!',
|
208
|
+
]
|
209
|
+
titckets_options_ids = [7]
|
210
|
+
|
211
|
+
assert_equal services.values, options.services.map(&:name)
|
212
|
+
assert_equal services.keys, options.services.map(&:id)
|
213
|
+
assert_equal luggage_options, options.luggage
|
214
|
+
assert_equal seating_options, options.seating
|
215
|
+
assert_equal technical_stops, options.technical_stops
|
216
|
+
assert_equal critical_info, options.critical_info
|
217
|
+
assert_equal resource_options, options.resource_options
|
218
|
+
assert_equal other_options, options.other
|
219
|
+
assert_equal titckets_options, options.tickets.map(&:text)
|
220
|
+
assert_equal titckets_options_ids, options.tickets.map(&:id)
|
221
|
+
assert options.advertising
|
222
|
+
assert options.busfor_recommend
|
223
|
+
end
|
224
|
+
|
172
225
|
def test_empty_options_parsing
|
173
226
|
response = get_successful_search_trips
|
174
227
|
options = response.trips.last.options
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gillbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey "codesnik" Trofimenko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -269,6 +269,7 @@ files:
|
|
269
269
|
- test/responses/returnPositionSuccess.xml
|
270
270
|
- test/responses/searchTrips-empty.xml
|
271
271
|
- test/responses/searchTrips-insurance.xml
|
272
|
+
- test/responses/searchTrips-new-options-format.xml
|
272
273
|
- test/responses/searchTrips-prod-invalid.xml
|
273
274
|
- test/responses/searchTrips-prod.xml
|
274
275
|
- test/responses/searchTrips-segments-roundtrip.xml
|
@@ -350,6 +351,7 @@ test_files:
|
|
350
351
|
- test/responses/returnPositionSuccess.xml
|
351
352
|
- test/responses/searchTrips-empty.xml
|
352
353
|
- test/responses/searchTrips-insurance.xml
|
354
|
+
- test/responses/searchTrips-new-options-format.xml
|
353
355
|
- test/responses/searchTrips-prod-invalid.xml
|
354
356
|
- test/responses/searchTrips-prod.xml
|
355
357
|
- test/responses/searchTrips-segments-roundtrip.xml
|