gillbus 0.14.6 → 0.14.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10cfea77870129d9ef00afacb83340c832398d0d
4
- data.tar.gz: b7ee92fc71ad0d916a73eedfa8e5025f6404afed
3
+ metadata.gz: 89a26660f11461b286b9df3ad393dd0897242980
4
+ data.tar.gz: 71b8efba172662cabba3ddb0fec7f156a073779b
5
5
  SHA512:
6
- metadata.gz: 4b19f6ce383299de3bf3b142b2eb5199473e447ccecc7f441b6e86b87644e9de8d4101dd193759dff3992c13f3f17bdcdebc4797ef8b119d5d219287ea99f7cd
7
- data.tar.gz: d524af2600ea59cf2e248b869232e0f848a6e88ddb036b91d141014730ec3ab62ecdcbd6e6b501060644ece30425cfe7309540161e783f2336346aaa7448de85
6
+ metadata.gz: 290ecffa3baae47be1d88c3970677bd5233d1d746de297d29e3587bb0bec9dcb058cfb9c7e4d01173965d5a406c7b4438e1f316b2af77cccdd49bb8ef3ae752d
7
+ data.tar.gz: 490eef262107d49133575587e8200792efe9f15658cebddad0b9f8086565c91ae23599f7cc763854adce600942f6b6767e22210a6c65125fee53020c16506f93
@@ -35,7 +35,7 @@ class Gillbus
35
35
  xml.key?("DATA") or return ParseError.new(xml_string)
36
36
  data = xml["DATA"] || {}
37
37
  parse(data)
38
- rescue MultiXml::ParseError
38
+ rescue MultiXml::ParseError, ArgumentError
39
39
  ParseError.new(xml_string)
40
40
  end
41
41
 
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = "0.14.6"
2
+ VERSION = "0.14.7"
3
3
  end
@@ -0,0 +1,202 @@
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
+ <IMAGE_URL>null</IMAGE_URL>
35
+ <START_POINT_TYPE>null</START_POINT_TYPE>
36
+ <FAKE_TIME_IN_ROAD>true</FAKE_TIME_IN_ROAD>
37
+ <VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
38
+ <RECOMMENDED>true</RECOMMENDED>
39
+ <VEHICLE_FEATURES>null</VEHICLE_FEATURES>
40
+ <TOTAL_COST>1410.0</TOTAL_COST>
41
+ <CURRENCY>RUB</CURRENCY>
42
+ <CURRENCY_CODE>643</CURRENCY_CODE>
43
+ <TARIFF>
44
+ <SHORT_NAME>Y</SHORT_NAME>
45
+ <FULL_NAME/>
46
+ <START_DATE/>
47
+ <END_DATE/>
48
+ <DESCRIPTION/>
49
+ <TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
50
+ <TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
51
+ <COST>1410</COST>
52
+ <AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
53
+ <PASSENGER_BIRTHDAY/>
54
+ <PASSENGER_ISIC_NUMBER/>
55
+ <PASSENGER_STUDENT_TICKET/>
56
+ </TARIFF>
57
+ <POINT>
58
+ <NUMBER>0</NUMBER>
59
+ <GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
60
+ <NAME>Москва</NAME>
61
+ <ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
62
+ <ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
63
+ <ARRIVAL_TIME>19:00</ARRIVAL_TIME>
64
+ <DISPATCH_DATE/>
65
+ <DISPATCH_TIME/>
66
+ <CHECK_POINT>false</CHECK_POINT>
67
+ </POINT>
68
+ <POINT>
69
+ <NUMBER>1</NUMBER>
70
+ <GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
71
+ <NAME>Вышний Волочек</NAME>
72
+ <ADDRESS>трасса (М10)</ADDRESS>
73
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
74
+ <ARRIVAL_TIME>00:00</ARRIVAL_TIME>
75
+ <DISPATCH_DATE/>
76
+ <DISPATCH_TIME/>
77
+ <CHECK_POINT>false</CHECK_POINT>
78
+ </POINT>
79
+ <POINT>
80
+ <NUMBER>2</NUMBER>
81
+ <GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
82
+ <NAME>Великий Новгород</NAME>
83
+ <ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
84
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
85
+ <ARRIVAL_TIME>03:30</ARRIVAL_TIME>
86
+ <DISPATCH_DATE/>
87
+ <DISPATCH_TIME/>
88
+ <CHECK_POINT>false</CHECK_POINT>
89
+ </POINT>
90
+ <POINT>
91
+ <NUMBER>3</NUMBER>
92
+ <GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
93
+ <NAME>Санкт-Петербург</NAME>
94
+ <ADDRESS>м. Купчино </ADDRESS>
95
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
96
+ <ARRIVAL_TIME>06:30</ARRIVAL_TIME>
97
+ <DISPATCH_DATE/>
98
+ <DISPATCH_TIME/>
99
+ <CHECK_POINT>false</CHECK_POINT>
100
+ </POINT>
101
+ <OPTIONS>
102
+ <OPTION>Кофе</OPTION>
103
+ <OPTION>Wi-Fi</OPTION>
104
+ </OPTIONS>
105
+ </TRIP>
106
+ <TRIP>
107
+ <ID>-3986171261205069729</ID>
108
+ <RES_ID>10</RES_ID>
109
+ <NUMBER>2093</NUMBER>
110
+ <START_CITY_NAME>Москва</START_CITY_NAME>
111
+ <END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
112
+ <START_DATE>23.08.2014</START_DATE>
113
+ <END_DATE>24.08.2014</END_DATE>
114
+ <START_TIME>21:10</START_TIME>
115
+ <END_TIME>08:40</END_TIME>
116
+ <BUS_MODEL/>
117
+ <PLACES_COUNT>18</PLACES_COUNT>
118
+ <FREE_PLACES_COUNT>10</FREE_PLACES_COUNT>
119
+ <FREE_BUSY_PLACES>10/18</FREE_BUSY_PLACES>
120
+ <CARRIER_NAME>ИП Унанян И.А.</CARRIER_NAME>
121
+ <TIME_IN_ROAD>11:30</TIME_IN_ROAD>
122
+ <STATION_BEGIN_NAME>Москва</STATION_BEGIN_NAME>
123
+ <STATION_BEGIN_ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</STATION_BEGIN_ADDRESS>
124
+ <STATION_END_NAME>Санкт-Петербург</STATION_END_NAME>
125
+ <STATION_END_ADDRESS>м. Купчино </STATION_END_ADDRESS>
126
+ <RESERVATION_ENABLED>true</RESERVATION_ENABLED>
127
+ <SALE_ENABLED>true</SALE_ENABLED>
128
+ <RETURN_ENABLED>false</RETURN_ENABLED>
129
+ <TIME_FOR_CANCEL>25</TIME_FOR_CANCEL>
130
+ <TRIP_FULL_SALE>false</TRIP_FULL_SALE>
131
+ <CAN_DISCOUNT>true</CAN_DISCOUNT>
132
+ <INTERNATIONAL>false</INTERNATIONAL>
133
+ <JOIN_BOOK_BUY>false</JOIN_BOOK_BUY>
134
+ <RECOMMENDED>false</RECOMMENDED>
135
+ <TRIP_MODE>1</TRIP_MODE>
136
+ <IMAGE_URL>null</IMAGE_URL>
137
+ <START_POINT_TYPE>null</START_POINT_TYPE>
138
+ <VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
139
+ <VEHICLE_FEATURES>null</VEHICLE_FEATURES>
140
+ <TOTAL_COST>1410</TOTAL_COST>
141
+ <CURRENCY>RUB</CURRENCY>
142
+ <CURRENCY_CODE>643</CURRENCY_CODE>
143
+ <TARIFF>
144
+ <SHORT_NAME>Y</SHORT_NAME>
145
+ <FULL_NAME/>
146
+ <START_DATE/>
147
+ <END_DATE/>
148
+ <DESCRIPTION/>
149
+ <TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
150
+ <TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
151
+ <COST>1410</COST>
152
+ <AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
153
+ <PASSENGER_BIRTHDAY/>
154
+ <PASSENGER_ISIC_NUMBER/>
155
+ <PASSENGER_STUDENT_TICKET/>
156
+ </TARIFF>
157
+ <POINT>
158
+ <NUMBER>0</NUMBER>
159
+ <GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
160
+ <NAME>Москва</NAME>
161
+ <ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
162
+ <ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
163
+ <ARRIVAL_TIME>21:10</ARRIVAL_TIME>
164
+ <DISPATCH_DATE/>
165
+ <DISPATCH_TIME/>
166
+ <CHECK_POINT>false</CHECK_POINT>
167
+ </POINT>
168
+ <POINT>
169
+ <NUMBER>1</NUMBER>
170
+ <GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
171
+ <NAME>Вышний Волочек</NAME>
172
+ <ADDRESS>трасса (М10)</ADDRESS>
173
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
174
+ <ARRIVAL_TIME>02:10</ARRIVAL_TIME>
175
+ <DISPATCH_DATE/>
176
+ <DISPATCH_TIME/>
177
+ <CHECK_POINT>false</CHECK_POINT>
178
+ </POINT>
179
+ <POINT>
180
+ <NUMBER>2</NUMBER>
181
+ <GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
182
+ <NAME>Великий Новгород</NAME>
183
+ <ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
184
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
185
+ <ARRIVAL_TIME>05:40</ARRIVAL_TIME>
186
+ <DISPATCH_DATE/>
187
+ <DISPATCH_TIME/>
188
+ <CHECK_POINT>false</CHECK_POINT>
189
+ </POINT>
190
+ <POINT>
191
+ <NUMBER>3</NUMBER>
192
+ <GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
193
+ <NAME>Санкт-Петербург</NAME>
194
+ <ADDRESS>м. Купчино </ADDRESS>
195
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
196
+ <ARRIVAL_TIME>08:40</ARRIVAL_TIME>
197
+ <DISPATCH_DATE/>
198
+ <DISPATCH_TIME/>
199
+ <CHECK_POINT>false</CHECK_POINT>
200
+ </POINT>
201
+ </TRIP>
202
+ </DATA>
@@ -56,6 +56,10 @@ class SearchTripsResponseTest < Minitest::Test
56
56
  Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-prod.xml'))
57
57
  end
58
58
 
59
+ def get_successful_search_trips_with_bad_data
60
+ Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-prod-invalid.xml'))
61
+ end
62
+
59
63
  def get_trips_with_segments
60
64
  Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-segments.xml'))
61
65
  end
@@ -85,6 +89,12 @@ class SearchTripsResponseTest < Minitest::Test
85
89
  assert_equal true, response.trips.first.recommended
86
90
  end
87
91
 
92
+ def test_fields_parsing_bad_data
93
+ response = get_successful_search_trips_with_bad_data
94
+ assert response.error?
95
+ assert_includes response.response.to_s, '23/08/2014'
96
+ end
97
+
88
98
  def test_faking_response
89
99
  trip = Gillbus::Trip.new(
90
100
  id: '12345',
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.14.6
4
+ version: 0.14.7
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: 2017-05-17 00:00:00.000000000 Z
12
+ date: 2017-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_xml
@@ -231,6 +231,7 @@ files:
231
231
  - test/responses/lockSeats.xml
232
232
  - test/responses/reserveTickets.xml
233
233
  - test/responses/searchTrips-empty.xml
234
+ - test/responses/searchTrips-prod-invalid.xml
234
235
  - test/responses/searchTrips-prod.xml
235
236
  - test/responses/searchTrips-segments-roundtrip.xml
236
237
  - test/responses/searchTrips-segments.xml
@@ -296,6 +297,7 @@ test_files:
296
297
  - test/responses/lockSeats.xml
297
298
  - test/responses/reserveTickets.xml
298
299
  - test/responses/searchTrips-empty.xml
300
+ - test/responses/searchTrips-prod-invalid.xml
299
301
  - test/responses/searchTrips-prod.xml
300
302
  - test/responses/searchTrips-segments-roundtrip.xml
301
303
  - test/responses/searchTrips-segments.xml
@@ -306,4 +308,3 @@ test_files:
306
308
  - test/session_login_test.rb
307
309
  - test/test_helper.rb
308
310
  - test/tickets_booking_test.rb
309
- has_rdoc: