gillbus 0.18.9 → 0.18.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gillbus/base_response.rb +5 -1
- data/lib/gillbus/version.rb +1 -1
- data/test/error_test.rb +1 -1
- data/test/responses/legacy_trip.yml +120 -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: edf0f3b1165bb7dc21dc075e495b6e55b36e258c
|
4
|
+
data.tar.gz: 9b7db48a310875a95a63eba6571af8df9e0697ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 382b6e505597994c30a27442559cf476b44d68c2c49e79cc568a4af4962002040e06427a148cee3f6d11ef24c627464d072aa865abab41f71a675b2bba7fc479
|
7
|
+
data.tar.gz: f3a880e2903f05ff53eb6ff3c2cce6f35cd3b6cc912cd74cc7bd61eeb76905fe0a85e5a7285981fe098ad44bf209d3593e0d248a9930178625d87555edbf4a05
|
@@ -13,11 +13,15 @@ class Gillbus
|
|
13
13
|
attr_accessor :external_error_message
|
14
14
|
attr_accessor :request_time
|
15
15
|
|
16
|
+
attr_accessor :raw_xml # make accessible for logging and debuging
|
17
|
+
|
16
18
|
def error?
|
17
19
|
!error_code.nil?
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.parse(data, instance: new, options: {})
|
23
|
+
instance.raw_xml = options[:raw_xml] if options[:raw_xml]
|
24
|
+
|
21
25
|
# ugly
|
22
26
|
if data['MESSAGE']
|
23
27
|
instance.error_code = data['MESSAGE']['CODE'].to_i
|
@@ -36,7 +40,7 @@ class Gillbus
|
|
36
40
|
# <DATA/> is a valid response
|
37
41
|
return ParseError.new(xml_string, 'DATA attribute missing') unless xml.key?('DATA')
|
38
42
|
data = xml['DATA'] || {}
|
39
|
-
parse(data, instance: new, options: options)
|
43
|
+
parse(data, instance: new, options: options.merge(raw_xml: xml_string))
|
40
44
|
rescue Ox::ParseError, ArgumentError => e
|
41
45
|
ParseError.new(xml_string, e.message)
|
42
46
|
end
|
data/lib/gillbus/version.rb
CHANGED
data/test/error_test.rb
CHANGED
@@ -22,7 +22,7 @@ class ErrorTest < Minitest::Test
|
|
22
22
|
|
23
23
|
def test_malformed_errorness
|
24
24
|
assert malformed_response.error?
|
25
|
-
assert_equal "Malformed response: invalid format, expected < at line 1, column 1 [parse.c:
|
25
|
+
assert_equal "Malformed response: invalid format, expected < at line 1, column 1 [parse.c:147]\n", malformed_response.error_message
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_malformed_2_errorness
|
@@ -0,0 +1,120 @@
|
|
1
|
+
---
|
2
|
+
ID: '386911730793662069'
|
3
|
+
RES_ID: '0'
|
4
|
+
NUMBER: TEST - Москва-Брянск
|
5
|
+
START_CITY_NAME: Москва
|
6
|
+
END_CITY_NAME: Брянск
|
7
|
+
START_TIMEZONE:
|
8
|
+
END_TIMEZONE:
|
9
|
+
START_DATE: 29.12.2017
|
10
|
+
END_DATE: 29.12.2017
|
11
|
+
START_TIME: '07:00'
|
12
|
+
END_TIME: '13:30'
|
13
|
+
BUS_MODEL: SCANIA C
|
14
|
+
BUS_CLASS:
|
15
|
+
BUS_ID:
|
16
|
+
BUS_FLOORS_NUMBER: '1'
|
17
|
+
PLATFORM:
|
18
|
+
TRIP_SEATS_MAP: 'true'
|
19
|
+
SHOW_PICKUP_DROPOFF: 'false'
|
20
|
+
BRANDED: 'false'
|
21
|
+
HAS_TRANSFER: 'false'
|
22
|
+
PLACES_COUNT: '51'
|
23
|
+
FREE_PLACES_COUNT: '20'
|
24
|
+
FREE_BUSY_PLACES: 20/51
|
25
|
+
CARRIER_ID: 39E2022747F26FA1E0530300F00A8A55
|
26
|
+
CARRIER_NAME: '"Региональные Автобусные Маршруты" ООО'
|
27
|
+
TIME_IN_ROAD: '06:30'
|
28
|
+
FAKE_TIME_IN_ROAD: 'false'
|
29
|
+
STATION_BEGIN_ID: 34C0A393C480628CE0530300F00AE18E
|
30
|
+
STATION_BEGIN_NAME: Киевский вокзал
|
31
|
+
STATION_BEGIN_ADDRESS: пл. Киевского Вокзала, д. 1
|
32
|
+
STATION_END_ID: 357C66C2E3907C1CE0530300F00A3A4E
|
33
|
+
STATION_END_NAME: Брянск, ж/д вокзал
|
34
|
+
STATION_END_ADDRESS: ул. Речная д. 1
|
35
|
+
RESERVATION_ENABLED: 'true'
|
36
|
+
SALE_ENABLED: 'true'
|
37
|
+
RETURN_ENABLED: 'false'
|
38
|
+
TIME_FOR_CANCEL: '40'
|
39
|
+
TRIP_FULL_SALE: 'false'
|
40
|
+
CAN_DISCOUNT: 'true'
|
41
|
+
INTERNATIONAL: 'false'
|
42
|
+
JOIN_BOOK_BUY: 'true'
|
43
|
+
TRIP_MODE: '1'
|
44
|
+
CUSTOM_STATUS: '0'
|
45
|
+
SPECIAL_CONDITIONS:
|
46
|
+
REDIRECT_URL:
|
47
|
+
IMAGE_URL: 'null'
|
48
|
+
START_POINT_TYPE: 'null'
|
49
|
+
VEHICLE_DESCRIPTION: 'null'
|
50
|
+
VEHICLE_FEATURES: 'null'
|
51
|
+
TOTAL_COST: '550.0'
|
52
|
+
CURRENCY: RUB
|
53
|
+
CURRENCY_CODE: '643'
|
54
|
+
TARIFF:
|
55
|
+
SHORT_NAME: Y
|
56
|
+
FULL_NAME: Базовый тариф
|
57
|
+
START_DATE:
|
58
|
+
END_DATE:
|
59
|
+
DESCRIPTION: 'Базовый тариф стоимости проезда одного пассажиров в одном направлении
|
60
|
+
|
61
|
+
'
|
62
|
+
TIME_TO_BUY_RESERVED: '2'
|
63
|
+
TIME_TO_STOP_BOOKING: '2'
|
64
|
+
TIME_TO_PAY_RESERVATION: 06.12.2017 18:25:39
|
65
|
+
COST: '550'
|
66
|
+
INSURANCE_COST: '0'
|
67
|
+
INSURANCE_ID:
|
68
|
+
INSURANCE_SUM: '0'
|
69
|
+
INSURANCE_CUR:
|
70
|
+
AFTER_DISPATCH_NO_RETURN: 'true'
|
71
|
+
PASSENGER_BIRTHDAY:
|
72
|
+
PASSENGER_ISIC_NUMBER:
|
73
|
+
PASSENGER_STUDENT_TICKET:
|
74
|
+
NOTE:
|
75
|
+
RETURN_CAUSE:
|
76
|
+
- lossless: 'true'
|
77
|
+
__content__: Без потерь, более чем за 2 ч., до отправления рейса. Возвращается
|
78
|
+
100% стоимости тарифа. Ориентировочная сумма возврата 550
|
79
|
+
- 'Добровольно, менее чем за 2 ч., до отправления рейса. Удерживается при возврате:
|
80
|
+
15% тарифа. Ориентировочная сумма возврата 425'
|
81
|
+
- 'Возврат маршрутной квитанции в случае опоздания к отправлению (стоимость не возвращается).
|
82
|
+
Удерживается при возврате: 100% тарифа. Ориентировочная сумма возврата 0'
|
83
|
+
- Возврат маршрутной квитанции по отмене отправления т/с, задержки отправления т/с
|
84
|
+
более чем на час и непредставления пассажиру указанного в билете места. СРОК ОБРАЩЕНИЯ
|
85
|
+
для возврата билета 24 часа с времени отправления. . Возвращается 100% стоимости
|
86
|
+
билета. Ориентировочная сумма возврата 550
|
87
|
+
PROMOTE: 'false'
|
88
|
+
IS_EXCLUSIVE_PRICE: 'false'
|
89
|
+
POINT:
|
90
|
+
- NUMBER: '0'
|
91
|
+
GEOGRAPHY_NAME: Москва
|
92
|
+
NAME: Киевский вокзал
|
93
|
+
ADDRESS: пл. Киевского Вокзала, д. 1
|
94
|
+
TIMEZONE:
|
95
|
+
ARRIVAL_DATE: 29.12.2017
|
96
|
+
ARRIVAL_TIME:
|
97
|
+
DISPATCH_DATE: 29.12.2017
|
98
|
+
DISPATCH_TIME: '07:00'
|
99
|
+
CHECK_POINT: 'false'
|
100
|
+
DISTANCE: '0'
|
101
|
+
TRANSFER_POINT: 'false'
|
102
|
+
PLATFORM:
|
103
|
+
BUSMODEL:
|
104
|
+
AGREED: 'true'
|
105
|
+
- NUMBER: '1'
|
106
|
+
GEOGRAPHY_NAME: Брянск
|
107
|
+
NAME: Остановка Брянск
|
108
|
+
ADDRESS: улица Речная; дом 1
|
109
|
+
TIMEZONE:
|
110
|
+
ARRIVAL_DATE: 29.12.2017
|
111
|
+
ARRIVAL_TIME: '13:30'
|
112
|
+
DISPATCH_DATE: 29.12.2017
|
113
|
+
DISPATCH_TIME:
|
114
|
+
CHECK_POINT: 'false'
|
115
|
+
DISTANCE: '390'
|
116
|
+
TRANSFER_POINT: 'false'
|
117
|
+
PLATFORM:
|
118
|
+
BUSMODEL:
|
119
|
+
AGREED: 'true'
|
120
|
+
EXTRA_CHARGE: '0.0'
|
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.18.
|
4
|
+
version: 0.18.10
|
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: 2018-08-
|
12
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -258,6 +258,7 @@ files:
|
|
258
258
|
- test/responses/getTripSeats-segments.xml
|
259
259
|
- test/responses/getTripSeats.xml
|
260
260
|
- test/responses/getTripSegments.xml
|
261
|
+
- test/responses/legacy_trip.yml
|
261
262
|
- test/responses/legacy_trip_2.yml
|
262
263
|
- test/responses/lockSeats.xml
|
263
264
|
- test/responses/reserveTickets.xml
|
@@ -337,6 +338,7 @@ test_files:
|
|
337
338
|
- test/responses/getTripSeats-segments.xml
|
338
339
|
- test/responses/getTripSeats.xml
|
339
340
|
- test/responses/getTripSegments.xml
|
341
|
+
- test/responses/legacy_trip.yml
|
340
342
|
- test/responses/legacy_trip_2.yml
|
341
343
|
- test/responses/lockSeats.xml
|
342
344
|
- test/responses/reserveTickets.xml
|