gillbus 0.17.6 → 0.22.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -1
  3. data/Gemfile +0 -4
  4. data/gillbus.gemspec +1 -1
  5. data/lib/gillbus/base_request.rb +2 -0
  6. data/lib/gillbus/base_response.rb +8 -4
  7. data/lib/gillbus/get_carriers.rb +13 -0
  8. data/lib/gillbus/get_required_fields.rb +1 -0
  9. data/lib/gillbus/get_trip_seats.rb +7 -0
  10. data/lib/gillbus/helpers/parser.rb +45 -11
  11. data/lib/gillbus/return_position.rb +2 -0
  12. data/lib/gillbus/return_position_forced.rb +16 -0
  13. data/lib/gillbus/search_nearby_trips.rb +39 -0
  14. data/lib/gillbus/search_trips.rb +20 -13
  15. data/lib/gillbus/structs/carrier.rb +11 -0
  16. data/lib/gillbus/structs/luggage.rb +19 -0
  17. data/lib/gillbus/structs/nearby_cities_trip.rb +61 -0
  18. data/lib/gillbus/structs/point.rb +2 -0
  19. data/lib/gillbus/structs/return_cause.rb +1 -1
  20. data/lib/gillbus/structs/seat.rb +1 -0
  21. data/lib/gillbus/structs/segment.rb +27 -0
  22. data/lib/gillbus/structs/tariff/return_cause.rb +8 -3
  23. data/lib/gillbus/structs/ticket.rb +29 -12
  24. data/lib/gillbus/structs/tickets_option.rb +29 -0
  25. data/lib/gillbus/structs/trip.rb +35 -0
  26. data/lib/gillbus/structs/trip_options.rb +82 -24
  27. data/lib/gillbus/structs/trip_service.rb +16 -1
  28. data/lib/gillbus/tickets_booking.rb +34 -0
  29. data/lib/gillbus/version.rb +1 -1
  30. data/lib/gillbus.rb +31 -3
  31. data/test/error_test.rb +1 -1
  32. data/test/find_order_test.rb +16 -0
  33. data/test/get_required_fields_test.rb +77 -0
  34. data/test/get_trip_seats_test.rb +36 -0
  35. data/test/get_trip_segments_test.rb +1 -0
  36. data/test/parse_trip_options_test.rb +92 -0
  37. data/test/parse_trip_test.rb +25 -0
  38. data/test/responses/findOrder.xml +8 -0
  39. data/test/responses/getRequiredFieldsWithOneLuggage.xml +28 -0
  40. data/test/responses/getRequiredFieldsWithTwoLuggageSegments.xml +40 -0
  41. data/test/responses/getRequiredFieldsWithoutLuggage.xml +23 -0
  42. data/test/responses/getTripSeats-back-seats.xml +1192 -0
  43. data/test/responses/getTripSeats-two-floors.xml +1122 -0
  44. data/test/responses/getTripSeats.xml +70 -0
  45. data/test/responses/legacy_trip.yml +120 -0
  46. data/test/responses/legacy_trip_2.yml +217 -0
  47. data/test/responses/searchTrips-full-carriers-info.xml +231 -0
  48. data/test/responses/searchTrips-new-options-format.xml +244 -0
  49. data/test/responses/searchTrips-prod.xml +5 -0
  50. data/test/responses/searchTrips-round-trip-offers.xml +2016 -0
  51. data/test/responses/searchTripsNearby.xml +707 -0
  52. data/test/responses/ticketsBooking.xml +1 -0
  53. data/test/search_nearby_trips_test.rb +18 -0
  54. data/test/search_trips_test.rb +93 -0
  55. data/test/tickets_booking_test.rb +63 -0
  56. metadata +49 -13
@@ -0,0 +1,244 @@
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
+ <ITEM>Внимание! Ознакомьтесь со списком стран, въезд в которые ограничен в связи с коронавирусом &gt;&gt; https://busfor.com/ru/blog/covid-19-updates</ITEM>
121
+ <CRITICAL_INF ID="16">в связи с дорожными условиями, возможно отклонение в расписании движения в пределах 1час30.</CRITICAL_INF>
122
+ </CRITICAL_INFO>
123
+ <SEATING>
124
+ <SEATIN ID="1">Свободная рассадка.</SEATIN>
125
+ </SEATING>
126
+ <RESOURCE_TRIP_OPTION>
127
+ <RESOURCE_TRIP_OPTIO ID="1">Посадка начинается за 10 мин.</RESOURCE_TRIP_OPTIO>
128
+ </RESOURCE_TRIP_OPTION>
129
+ <OTHER>
130
+ <OTHE ID="1">Переправа</OTHE>
131
+ <OTHE ID="2">Трансфер</OTHE>
132
+ <OTHE>Cкидка при покупке раунд-трипа</OTHE>
133
+ </OTHER>
134
+ <PROMO>
135
+ <PROM ID="1">BUSFOR_RECOMMEND</PROM>
136
+ <PROM ID="2">ADVERTISING</PROM>
137
+ </PROMO>
138
+ <TICKETS>
139
+ <TICKET ID="7">ЭЛЕКТРОННЫЙ БИЛЕТ. Печать билета не требуется!</TICKET>
140
+ </TICKETS>
141
+ </OPTIONS>
142
+ </TRIP>
143
+ <TRIP>
144
+ <ID>-3986171261205069729</ID>
145
+ <RES_ID>10</RES_ID>
146
+ <NUMBER>2093</NUMBER>
147
+ <START_CITY_NAME>Москва</START_CITY_NAME>
148
+ <END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
149
+ <START_DATE>23.08.2014</START_DATE>
150
+ <END_DATE>24.08.2014</END_DATE>
151
+ <START_TIME>21:10</START_TIME>
152
+ <END_TIME>08:40</END_TIME>
153
+ <BUS_MODEL/>
154
+ <PLACES_COUNT>18</PLACES_COUNT>
155
+ <FREE_PLACES_COUNT>10</FREE_PLACES_COUNT>
156
+ <FREE_BUSY_PLACES>10/18</FREE_BUSY_PLACES>
157
+ <CARRIER_NAME>ИП Унанян И.А.</CARRIER_NAME>
158
+ <TIME_IN_ROAD>11:30</TIME_IN_ROAD>
159
+ <STATION_BEGIN_NAME>Москва</STATION_BEGIN_NAME>
160
+ <STATION_BEGIN_ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</STATION_BEGIN_ADDRESS>
161
+ <STATION_END_NAME>Санкт-Петербург</STATION_END_NAME>
162
+ <STATION_END_ADDRESS>м. Купчино </STATION_END_ADDRESS>
163
+ <RESERVATION_ENABLED>true</RESERVATION_ENABLED>
164
+ <SALE_ENABLED>true</SALE_ENABLED>
165
+ <RETURN_ENABLED>false</RETURN_ENABLED>
166
+ <TIME_FOR_CANCEL>25</TIME_FOR_CANCEL>
167
+ <TRIP_FULL_SALE>false</TRIP_FULL_SALE>
168
+ <CAN_DISCOUNT>true</CAN_DISCOUNT>
169
+ <INTERNATIONAL>false</INTERNATIONAL>
170
+ <JOIN_BOOK_BUY>false</JOIN_BOOK_BUY>
171
+ <RECOMMENDED>false</RECOMMENDED>
172
+ <TRIP_MODE>1</TRIP_MODE>
173
+ <CUSTOM_STATUS>0</CUSTOM_STATUS>
174
+ <IMAGE_URL>null</IMAGE_URL>
175
+ <START_POINT_TYPE>null</START_POINT_TYPE>
176
+ <VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
177
+ <VEHICLE_FEATURES>null</VEHICLE_FEATURES>
178
+ <TOTAL_COST>1410</TOTAL_COST>
179
+ <CURRENCY>RUB</CURRENCY>
180
+ <CURRENCY_CODE>643</CURRENCY_CODE>
181
+ <TARIFF>
182
+ <SHORT_NAME>Y</SHORT_NAME>
183
+ <FULL_NAME/>
184
+ <START_DATE/>
185
+ <END_DATE/>
186
+ <DESCRIPTION/>
187
+ <TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
188
+ <TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
189
+ <COST>1410</COST>
190
+ <AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
191
+ <PASSENGER_BIRTHDAY/>
192
+ <PASSENGER_ISIC_NUMBER/>
193
+ <PASSENGER_STUDENT_TICKET/>
194
+ <RETURN_CAUSE id='asdasd'>cause 1</RETURN_CAUSE>
195
+ <IS_EXCLUSIVE_PRICE>true</IS_EXCLUSIVE_PRICE>
196
+ </TARIFF>
197
+ <POINT>
198
+ <NUMBER>0</NUMBER>
199
+ <GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
200
+ <NAME>Москва</NAME>
201
+ <ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
202
+ <ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
203
+ <ARRIVAL_TIME>21:10</ARRIVAL_TIME>
204
+ <DISPATCH_DATE/>
205
+ <DISPATCH_TIME/>
206
+ <CHECK_POINT>false</CHECK_POINT>
207
+ </POINT>
208
+ <POINT>
209
+ <NUMBER>1</NUMBER>
210
+ <GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
211
+ <NAME>Вышний Волочек</NAME>
212
+ <ADDRESS>трасса (М10)</ADDRESS>
213
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
214
+ <ARRIVAL_TIME>02:10</ARRIVAL_TIME>
215
+ <DISPATCH_DATE/>
216
+ <DISPATCH_TIME/>
217
+ <CHECK_POINT>false</CHECK_POINT>
218
+ </POINT>
219
+ <POINT>
220
+ <NUMBER>2</NUMBER>
221
+ <GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
222
+ <NAME>Великий Новгород</NAME>
223
+ <ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
224
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
225
+ <ARRIVAL_TIME>05:40</ARRIVAL_TIME>
226
+ <DISPATCH_DATE/>
227
+ <DISPATCH_TIME/>
228
+ <CHECK_POINT>false</CHECK_POINT>
229
+ </POINT>
230
+ <POINT>
231
+ <NUMBER>3</NUMBER>
232
+ <GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
233
+ <NAME>Санкт-Петербург</NAME>
234
+ <ADDRESS>м. Купчино </ADDRESS>
235
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
236
+ <ARRIVAL_TIME>08:40</ARRIVAL_TIME>
237
+ <DISPATCH_DATE/>
238
+ <DISPATCH_TIME/>
239
+ <CHECK_POINT>false</CHECK_POINT>
240
+ </POINT>
241
+ <OPTIONS>
242
+ </OPTIONS>
243
+ </TRIP>
244
+ </DATA>
@@ -42,6 +42,7 @@
42
42
  <CURRENCY>RUB</CURRENCY>
43
43
  <CURRENCY_CODE>643</CURRENCY_CODE>
44
44
  <REDIRECT_URL>http://example.com/123</REDIRECT_URL>
45
+ <BUS_FLOORS_NUMBER>0</BUS_FLOORS_NUMBER>
45
46
  <TARIFF>
46
47
  <SHORT_NAME>Y</SHORT_NAME>
47
48
  <FULL_NAME/>
@@ -134,6 +135,9 @@
134
135
  <ITEM>BUSFOR_RECOMMEND</ITEM>
135
136
  <ITEM>ADVERTISING</ITEM>
136
137
  </PROMO>
138
+ <TICKETS>
139
+ <TICKET ID="7">ЭЛЕКТРОННЫЙ БИЛЕТ. Печать билета не требуется!</TICKET>
140
+ </TICKETS>
137
141
  </OPTIONS>
138
142
  </TRIP>
139
143
  <TRIP>
@@ -174,6 +178,7 @@
174
178
  <TOTAL_COST>1410</TOTAL_COST>
175
179
  <CURRENCY>RUB</CURRENCY>
176
180
  <CURRENCY_CODE>643</CURRENCY_CODE>
181
+ <BUS_FLOORS_NUMBER>2</BUS_FLOORS_NUMBER>
177
182
  <TARIFF>
178
183
  <SHORT_NAME>Y</SHORT_NAME>
179
184
  <FULL_NAME/>