gillbus 0.11.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 +7 -0
- data/.gitignore +22 -0
- data/.ruby-version +1 -0
- data/Gemfile +10 -0
- data/Guardfile +29 -0
- data/LICENSE.txt +22 -0
- data/README.md +140 -0
- data/Rakefile +9 -0
- data/gillbus.gemspec +31 -0
- data/lib/gillbus/base_request.rb +99 -0
- data/lib/gillbus/base_response.rb +43 -0
- data/lib/gillbus/buy_booking.rb +74 -0
- data/lib/gillbus/buy_tickets.rb +36 -0
- data/lib/gillbus/cancel_order.rb +55 -0
- data/lib/gillbus/drivers/faraday_response_file_logger.rb +19 -0
- data/lib/gillbus/find_order.rb +37 -0
- data/lib/gillbus/get_all_cities.rb +24 -0
- data/lib/gillbus/get_cities.rb +34 -0
- data/lib/gillbus/get_countries.rb +24 -0
- data/lib/gillbus/get_dates_new.rb +35 -0
- data/lib/gillbus/get_order_status.rb +28 -0
- data/lib/gillbus/get_order_ticket.rb +62 -0
- data/lib/gillbus/get_required_fields.rb +32 -0
- data/lib/gillbus/get_time_table.rb +33 -0
- data/lib/gillbus/get_trip_seats.rb +61 -0
- data/lib/gillbus/get_trips.rb +13 -0
- data/lib/gillbus/helpers/fields.rb +47 -0
- data/lib/gillbus/helpers/parser.rb +100 -0
- data/lib/gillbus/helpers/update_attrs.rb +15 -0
- data/lib/gillbus/lock_seats.rb +82 -0
- data/lib/gillbus/logout.rb +19 -0
- data/lib/gillbus/parse_error.rb +11 -0
- data/lib/gillbus/reserve_tickets.rb +13 -0
- data/lib/gillbus/search_trips.rb +96 -0
- data/lib/gillbus/session_login.rb +32 -0
- data/lib/gillbus/structs/commission.rb +54 -0
- data/lib/gillbus/structs/item.rb +14 -0
- data/lib/gillbus/structs/passenger_discount.rb +37 -0
- data/lib/gillbus/structs/point.rb +38 -0
- data/lib/gillbus/structs/return_cause.rb +23 -0
- data/lib/gillbus/structs/seat.rb +38 -0
- data/lib/gillbus/structs/segment.rb +161 -0
- data/lib/gillbus/structs/tariff.rb +59 -0
- data/lib/gillbus/structs/ticket.rb +285 -0
- data/lib/gillbus/structs/timetable_segment.rb +51 -0
- data/lib/gillbus/structs/timetable_trip.rb +77 -0
- data/lib/gillbus/structs/trip.rb +164 -0
- data/lib/gillbus/tickets_booking.rb +182 -0
- data/lib/gillbus/unlock_seats.rb +15 -0
- data/lib/gillbus/version.rb +3 -0
- data/lib/gillbus.rb +86 -0
- data/script/example_booking.rb +82 -0
- data/script/example_booking_with_segments.rb +90 -0
- data/script/example_canceling_booking.rb +67 -0
- data/script/example_canceling_reservation.rb +69 -0
- data/script/example_reservation.rb +88 -0
- data/test/buy_booking_test.rb +32 -0
- data/test/buy_tickets_test.rb +12 -0
- data/test/cancel_order_test.rb +12 -0
- data/test/error_test.rb +31 -0
- data/test/find_order_test.rb +24 -0
- data/test/get_cities_test.rb +12 -0
- data/test/get_countries_test.rb +12 -0
- data/test/get_dates_new_test.rb +12 -0
- data/test/get_order_ticket_test.rb +12 -0
- data/test/get_time_table_test.rb +21 -0
- data/test/get_trip_seats_test.rb +40 -0
- data/test/lock_seats_test.rb +70 -0
- data/test/reserve_tickets_test.rb +22 -0
- data/test/responses/buyBooking.xml +9 -0
- data/test/responses/buyTickets.xml +7 -0
- data/test/responses/cancelOrder.xml +8 -0
- data/test/responses/error.xml +1 -0
- data/test/responses/findOrder.xml +296 -0
- data/test/responses/getCities.xml +266 -0
- data/test/responses/getCountries.xml +90 -0
- data/test/responses/getOrderTicket.xml +3 -0
- data/test/responses/getTimeTable.xml +81 -0
- data/test/responses/getTripSeats-one-empty-segment.xml +562 -0
- data/test/responses/getTripSeats-segments.xml +1052 -0
- data/test/responses/getTripSeats.xml +492 -0
- data/test/responses/lockSeats.xml +23 -0
- data/test/responses/reserveTickets.xml +76 -0
- data/test/responses/searchTrips-empty.xml +3 -0
- data/test/responses/searchTrips-prod.xml +193 -0
- data/test/responses/searchTrips-segments-roundtrip.xml +15812 -0
- data/test/responses/searchTrips-segments.xml +808 -0
- data/test/responses/sessionLogin.xml +3 -0
- data/test/responses/ticketsBooking.xml +75 -0
- data/test/responses/very_empty.xml +1 -0
- data/test/search_trips_test.rb +71 -0
- data/test/session_login_test.rb +12 -0
- data/test/test_helper.rb +3 -0
- data/test/tickets_booking_test.rb +16 -0
- metadata +303 -0
@@ -0,0 +1,285 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class Ticket
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# The ticket number in the system
|
8
|
+
# => 8472
|
9
|
+
field :ticket_number
|
10
|
+
|
11
|
+
field :carrier_ticket_number
|
12
|
+
|
13
|
+
# The item position system identifier (is unique for the for the every order item).
|
14
|
+
# => 8471
|
15
|
+
field :system_number
|
16
|
+
|
17
|
+
# The ticket order number
|
18
|
+
# => 14065
|
19
|
+
field :order_number
|
20
|
+
|
21
|
+
# The ticket status. Possible values are:
|
22
|
+
# :reserved 1 – ticket booked;
|
23
|
+
# :ticketed 2 – ticket sold;
|
24
|
+
# :ordered 3 – the booking, that waiting for the confirmation;
|
25
|
+
# :returned 4 – ticket returned;
|
26
|
+
# :canceled 5 – booking cancelled;
|
27
|
+
# :voided 6 – ticket cancelled;
|
28
|
+
# :booked 8 – the sale, that waiting for the confirmation
|
29
|
+
field :ticket_status, :ticket_status
|
30
|
+
|
31
|
+
# The insurance number
|
32
|
+
field :policy_number
|
33
|
+
|
34
|
+
# The flag, which indicates the registration of a trip on the exchange form.
|
35
|
+
# true – in case of the registration with the exchange form
|
36
|
+
# false – in case of ticket registration
|
37
|
+
field :exchange_blank, :bool
|
38
|
+
|
39
|
+
# => Surname Firstname
|
40
|
+
field :passenger_full_name
|
41
|
+
|
42
|
+
# => Firstname
|
43
|
+
field :passenger_first_name
|
44
|
+
|
45
|
+
# => Surname
|
46
|
+
field :passenger_last_name
|
47
|
+
|
48
|
+
field :passenger_birthday, :date
|
49
|
+
|
50
|
+
field :passenger_student_ticket
|
51
|
+
|
52
|
+
# The passenger contact phone number
|
53
|
+
# => 380000000000
|
54
|
+
field :passenger_phone
|
55
|
+
|
56
|
+
field :passenger_passport
|
57
|
+
|
58
|
+
# The agent name, which sold the ticket
|
59
|
+
# => ТОВ"Юпітер
|
60
|
+
field :agent_name
|
61
|
+
|
62
|
+
# => +00(044)496-08-00
|
63
|
+
field :agent_phone
|
64
|
+
|
65
|
+
# => ТОВ"Юпітер
|
66
|
+
field :carrier_name
|
67
|
+
|
68
|
+
# => +00(044)496-08-00
|
69
|
+
field :carrier_phone
|
70
|
+
|
71
|
+
# => Setra
|
72
|
+
field :bus_model
|
73
|
+
|
74
|
+
field :carriage_number
|
75
|
+
|
76
|
+
# => 16
|
77
|
+
field :number_seat
|
78
|
+
|
79
|
+
# => ДЕМ059
|
80
|
+
field :trip_number
|
81
|
+
|
82
|
+
# The trip mode. See the returned parameters description of the /online2/searchTrips command.
|
83
|
+
# => 1
|
84
|
+
field :trip_mode, :int
|
85
|
+
|
86
|
+
# => false
|
87
|
+
field :international_trip, :bool
|
88
|
+
|
89
|
+
# => Донецк
|
90
|
+
field :start_city
|
91
|
+
|
92
|
+
# => 20.02.2013
|
93
|
+
field :start_date, :date
|
94
|
+
|
95
|
+
# => 14:40
|
96
|
+
field :start_time, :time
|
97
|
+
|
98
|
+
# => Одесса
|
99
|
+
field :end_city
|
100
|
+
|
101
|
+
# => 06:35
|
102
|
+
field :end_time, :time
|
103
|
+
|
104
|
+
# Tariff short name
|
105
|
+
# => Y
|
106
|
+
field :type_tariff_name
|
107
|
+
|
108
|
+
# The tariff inside the country (country – France for example)
|
109
|
+
# => 75.0
|
110
|
+
field :tariff, :decimal
|
111
|
+
|
112
|
+
# The tariff VAT inside the country
|
113
|
+
# => 15.0
|
114
|
+
field :tariff_vat, :decimal
|
115
|
+
|
116
|
+
# The tariff outside the country
|
117
|
+
# => 0.0
|
118
|
+
field :foreign_tariff, :decimal
|
119
|
+
|
120
|
+
# The tariff VAT outside the country
|
121
|
+
# => 0.0
|
122
|
+
field :foreign_tariff_vat, :decimal
|
123
|
+
|
124
|
+
field :note
|
125
|
+
|
126
|
+
# Ticket barcode
|
127
|
+
# => ЮПТ000008472ЮПТ
|
128
|
+
field :barcode
|
129
|
+
|
130
|
+
# => 21.02.2013
|
131
|
+
field :end_date, :date
|
132
|
+
|
133
|
+
# Departure station name
|
134
|
+
# => Залізн. вокзал
|
135
|
+
field :station_name
|
136
|
+
|
137
|
+
# => БрокБізнесБанк
|
138
|
+
field :insurance_name
|
139
|
+
|
140
|
+
# => +33(333)333-33-33
|
141
|
+
field :insurance_phone
|
142
|
+
|
143
|
+
# Agent government registration ID
|
144
|
+
# => 132123
|
145
|
+
field :agent_reg
|
146
|
+
|
147
|
+
# Carrier government registration ID
|
148
|
+
# => 132123
|
149
|
+
field :carrier_reg
|
150
|
+
|
151
|
+
# => 232323223
|
152
|
+
field :insurance_reg
|
153
|
+
|
154
|
+
# The tariff full cost (sale currency)
|
155
|
+
# => 75.0
|
156
|
+
field :total_tariff, :money
|
157
|
+
|
158
|
+
# The blanket (full) tariff in currency in which the tariff is brought
|
159
|
+
# => 75.0
|
160
|
+
field :total_tariff_in_currency, :tariff_money
|
161
|
+
|
162
|
+
# The tariff full cost VAT (sale currency)
|
163
|
+
# => 15.0
|
164
|
+
field :total_tariff_vat, :money
|
165
|
+
|
166
|
+
# The blanket (full) tariff VAT in currency in which the tariff is brought
|
167
|
+
# => 15.0
|
168
|
+
field :total_tariff_vat_in_currency, :tariff_money
|
169
|
+
|
170
|
+
# The return amount from the common tariff in the sale currency (w/o VAT)
|
171
|
+
field :return_total_tariff, :money
|
172
|
+
|
173
|
+
# The return amount from the common tariff in currency in which the tariff is brought (w/o VAT)
|
174
|
+
field :return_total_tariff_in_currency, :tariff_money
|
175
|
+
|
176
|
+
# The return amount from the VAT from common tariff in the sale currency
|
177
|
+
field :return_total_tariff_vat, :money
|
178
|
+
|
179
|
+
# The return amount from the VAT from common tariff in currency in which the tariff is brought.
|
180
|
+
field :return_total_tariff_vat_in_currency, :tariff_money
|
181
|
+
|
182
|
+
# The description of the returning conditions
|
183
|
+
field :return_condition
|
184
|
+
|
185
|
+
# Sale currency
|
186
|
+
# => UAH
|
187
|
+
field :sale_cur_code
|
188
|
+
|
189
|
+
# The currency in which the tariff is brought
|
190
|
+
# => UAH
|
191
|
+
field :tariff_cur_code
|
192
|
+
|
193
|
+
# Sale exchange rate to currency in which the tariff is brought
|
194
|
+
field :tariff_cur_rate
|
195
|
+
|
196
|
+
# The total ticket cost, incliding service charge
|
197
|
+
# => 110.0
|
198
|
+
field :total_amount, :money
|
199
|
+
|
200
|
+
# The total ticket returning amount
|
201
|
+
field :return_total_amount, :money
|
202
|
+
|
203
|
+
# => 18.33
|
204
|
+
field :total_amount_vat, :tariff_money
|
205
|
+
|
206
|
+
field :customer_name
|
207
|
+
|
208
|
+
field :customer_phone
|
209
|
+
|
210
|
+
field :customer_address
|
211
|
+
|
212
|
+
# => м Київ, вул Якіра, д 13-б
|
213
|
+
field :agent_address
|
214
|
+
|
215
|
+
# => м Київ, вул Якіра, д 13-б
|
216
|
+
field :carrier_address
|
217
|
+
|
218
|
+
# => м. Донецьк. вул. Донецька
|
219
|
+
field :station_address
|
220
|
+
|
221
|
+
# => м Київ
|
222
|
+
field :insurance_address
|
223
|
+
|
224
|
+
# => ЮПТ
|
225
|
+
field :agent_code
|
226
|
+
|
227
|
+
# => Київ
|
228
|
+
field :agent_city
|
229
|
+
|
230
|
+
# => ЮПТ
|
231
|
+
field :carrier_code
|
232
|
+
|
233
|
+
# => DOK
|
234
|
+
field :begin_aviacode
|
235
|
+
|
236
|
+
# => ODS
|
237
|
+
field :end_aviacode
|
238
|
+
|
239
|
+
# The sum of all collecting over the tariff
|
240
|
+
# => 0.0
|
241
|
+
field :xt, :money
|
242
|
+
|
243
|
+
# The sum of all collecting VAT over the tariff
|
244
|
+
# => 0.0
|
245
|
+
field :xt_vat, :money
|
246
|
+
|
247
|
+
# Array of commissions
|
248
|
+
field :commissions, [Commission], key: 'COMMISSION'
|
249
|
+
|
250
|
+
field :return_causes, [:return_cause], key: 'RETURN_CAUSE'
|
251
|
+
|
252
|
+
# Date to pay reserved ticket
|
253
|
+
field :date_to_pay, :datetime
|
254
|
+
|
255
|
+
# Minutes to pay booked ticket
|
256
|
+
field :minutes_for_buyout, :int
|
257
|
+
|
258
|
+
parser do
|
259
|
+
def ticket_status(value)
|
260
|
+
{
|
261
|
+
'1' => :reserved, # ticket booked;
|
262
|
+
'2' => :ticketed, # ticket sold;
|
263
|
+
'3' => :ordered, # the booking, that waiting for the confirmation;
|
264
|
+
'4' => :returned, # ticket returned;
|
265
|
+
'5' => :canceled, # booking cancelled;
|
266
|
+
'6' => :voided, # ticket cancelled;
|
267
|
+
'8' => :booked, # the sale, that waiting for the confirmation
|
268
|
+
}[value]
|
269
|
+
end
|
270
|
+
|
271
|
+
def money(val)
|
272
|
+
Monetize.parse(val, doc['SALE_CUR_CODE'])
|
273
|
+
end
|
274
|
+
|
275
|
+
def tariff_money(val)
|
276
|
+
Monetize.parse(val, doc['TARIFF_CUR_CODE'])
|
277
|
+
end
|
278
|
+
|
279
|
+
def return_cause(val)
|
280
|
+
ReturnCause.parse(val.merge(_currency: doc['SALE_CUR_CODE']))
|
281
|
+
end
|
282
|
+
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class TimetableSegment
|
3
|
+
extend Fields
|
4
|
+
include UpdateAttrs
|
5
|
+
|
6
|
+
# => Киев
|
7
|
+
field :start_name
|
8
|
+
|
9
|
+
# => Київський Центральний Автовокзал
|
10
|
+
field :start_station_name
|
11
|
+
|
12
|
+
# => Московська площа, 2/1
|
13
|
+
field :start_station_address
|
14
|
+
|
15
|
+
# => 0123456789ABCDEF0123456789ABCDEF
|
16
|
+
field :start_station_id
|
17
|
+
|
18
|
+
# => Одесса
|
19
|
+
field :end_name
|
20
|
+
|
21
|
+
# => Автовокзал
|
22
|
+
field :end_station_name
|
23
|
+
|
24
|
+
# => Балківська вулиця
|
25
|
+
field :end_station_address
|
26
|
+
|
27
|
+
# => 0123456789ABCDEF0123456789ABCDEF
|
28
|
+
field :end_station_id
|
29
|
+
|
30
|
+
# => 07:30
|
31
|
+
field :start_time, :time
|
32
|
+
|
33
|
+
# => 12:55
|
34
|
+
field :end_time, :time
|
35
|
+
|
36
|
+
# => 0
|
37
|
+
field :days, :int
|
38
|
+
|
39
|
+
# => 1400
|
40
|
+
field :time_in_road, :int
|
41
|
+
|
42
|
+
# => "270.5"
|
43
|
+
field :base_cost, :money
|
44
|
+
|
45
|
+
parser do
|
46
|
+
def money(val)
|
47
|
+
Monetize.parse(val, doc['CUR_CODE'])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class TimetableTrip
|
3
|
+
extend Fields
|
4
|
+
include UpdateAttrs
|
5
|
+
|
6
|
+
# => "ЯРМ005 Киев-Коблево"
|
7
|
+
field :number
|
8
|
+
|
9
|
+
# => "Киев"
|
10
|
+
field :start_city_name
|
11
|
+
|
12
|
+
# => "Коблево"
|
13
|
+
field :end_city_name
|
14
|
+
|
15
|
+
# => "24.07.2015"
|
16
|
+
field :start_date, :date
|
17
|
+
|
18
|
+
# => "31.08.2015"
|
19
|
+
field :end_date, :date
|
20
|
+
|
21
|
+
# => "07:30"
|
22
|
+
field :start_time, :time
|
23
|
+
|
24
|
+
# => "14:30"
|
25
|
+
field :end_time, :time
|
26
|
+
|
27
|
+
# => "Neoplan 313 SHD"
|
28
|
+
field :bus_model
|
29
|
+
|
30
|
+
# => "38"
|
31
|
+
field :number_seats, :int
|
32
|
+
|
33
|
+
# => ""Ярмола А.Г." ФОП +38(044)5965112"
|
34
|
+
field :carrier_info
|
35
|
+
|
36
|
+
# => "3"
|
37
|
+
field :frequency, :int
|
38
|
+
|
39
|
+
# => "false"
|
40
|
+
field :international, :bool
|
41
|
+
|
42
|
+
# => "1"
|
43
|
+
field :trip_mode, :int
|
44
|
+
|
45
|
+
field :segments, [TimetableSegment], key: "SEGMENT"
|
46
|
+
|
47
|
+
field :days_of_week, :days_of_week, key: "DAY_OR_DATE"
|
48
|
+
|
49
|
+
field :dates, :dates, key: "DAY_OR_DATE"
|
50
|
+
|
51
|
+
parser do
|
52
|
+
DAYS_INTO_WEEK = {
|
53
|
+
1 => :sunday,
|
54
|
+
2 => :monday,
|
55
|
+
3 => :tuesday,
|
56
|
+
4 => :wednesday,
|
57
|
+
5 => :thursday,
|
58
|
+
6 => :friday,
|
59
|
+
7 => :saturday,
|
60
|
+
}
|
61
|
+
|
62
|
+
def days_of_week(value)
|
63
|
+
return unless instance.frequency == 3
|
64
|
+
Array(value).map { |v| day_of_week(v) }
|
65
|
+
end
|
66
|
+
|
67
|
+
def dates(value)
|
68
|
+
return unless instance.frequency == 2
|
69
|
+
Array(value).map { |v| date(v) }
|
70
|
+
end
|
71
|
+
|
72
|
+
def day_of_week(day)
|
73
|
+
DAYS_INTO_WEEK[day.to_i]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class Trip
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# => "393409381686201016"
|
8
|
+
field :id
|
9
|
+
|
10
|
+
# Идентификатор стороннего поставщика. 0 - gillbus
|
11
|
+
# => "0"
|
12
|
+
field :res_id
|
13
|
+
|
14
|
+
# => "Москва-Санкт-Петербург"
|
15
|
+
field :number
|
16
|
+
|
17
|
+
# => "Москва"
|
18
|
+
field :start_city_name
|
19
|
+
|
20
|
+
# => "Санкт-Петербург"
|
21
|
+
field :end_city_name
|
22
|
+
|
23
|
+
# => "10.10.2014"
|
24
|
+
field :start_date, :date
|
25
|
+
|
26
|
+
# => "11.10.2014"
|
27
|
+
field :end_date, :date
|
28
|
+
|
29
|
+
# => "22:50"
|
30
|
+
field :start_time, :time
|
31
|
+
|
32
|
+
# => "08:00"
|
33
|
+
field :end_time, :time
|
34
|
+
|
35
|
+
# => "Сетра S 315 НDH"
|
36
|
+
field :bus_model
|
37
|
+
|
38
|
+
# => "VIP"
|
39
|
+
field :bus_class
|
40
|
+
|
41
|
+
# => true
|
42
|
+
field :has_transfer, :bool
|
43
|
+
|
44
|
+
# => true
|
45
|
+
field :trip_seats_map, :bool
|
46
|
+
|
47
|
+
# => "49"
|
48
|
+
field :places_count, :int
|
49
|
+
|
50
|
+
# => "10"
|
51
|
+
field :free_places_count, :int
|
52
|
+
|
53
|
+
# => "10/49"
|
54
|
+
field :free_busy_places
|
55
|
+
|
56
|
+
# => "ABCDEE23413"
|
57
|
+
field :carrier_id
|
58
|
+
|
59
|
+
# => "RU \"ПЕТРОКОМ - АВТО ПЛЮС\" ООО"
|
60
|
+
field :carrier_name
|
61
|
+
|
62
|
+
# => "09:10"
|
63
|
+
field :time_in_road, :time
|
64
|
+
|
65
|
+
# => D547A366D02526A7E040B85960523246
|
66
|
+
field :station_begin_id
|
67
|
+
|
68
|
+
# => "м. \"Речной Вокзал\""
|
69
|
+
field :station_begin_name
|
70
|
+
|
71
|
+
# => "ул. Фестивальная, дом 11, метро \"Речной Вокзал\""
|
72
|
+
field :station_begin_address
|
73
|
+
|
74
|
+
# => D547A366D02526A7E040B85960523246
|
75
|
+
field :station_end_id
|
76
|
+
|
77
|
+
# => "м. \"Бухарестская\""
|
78
|
+
field :station_end_name
|
79
|
+
|
80
|
+
# => "ул. Бухарестская, 30/32 торговый дом \"Континент\", метро \"Бухарестская\""
|
81
|
+
field :station_end_address
|
82
|
+
|
83
|
+
# => "true"
|
84
|
+
field :reservation_enabled, :bool
|
85
|
+
|
86
|
+
# => "true"
|
87
|
+
field :sale_enabled, :bool
|
88
|
+
|
89
|
+
# => "false"
|
90
|
+
field :return_enabled, :bool
|
91
|
+
|
92
|
+
# => "25"
|
93
|
+
field :time_for_cancel, :int
|
94
|
+
|
95
|
+
# => "false"
|
96
|
+
field :trip_full_sale, :bool
|
97
|
+
|
98
|
+
# => "true"
|
99
|
+
field :can_discount, :bool
|
100
|
+
|
101
|
+
# => "false"
|
102
|
+
field :international, :bool
|
103
|
+
|
104
|
+
# => "false"
|
105
|
+
field :join_book_buy, :bool
|
106
|
+
|
107
|
+
# => "1"
|
108
|
+
field :trip_mode, :int
|
109
|
+
|
110
|
+
# => "null"
|
111
|
+
field :image_url
|
112
|
+
|
113
|
+
# => "null"
|
114
|
+
field :start_point_type
|
115
|
+
|
116
|
+
# => "null"
|
117
|
+
field :vehicle_description
|
118
|
+
|
119
|
+
# => "null"
|
120
|
+
field :vehicle_features
|
121
|
+
|
122
|
+
# => "false"
|
123
|
+
field :branded, :bool
|
124
|
+
|
125
|
+
# => "1100"
|
126
|
+
field :total_cost, :money
|
127
|
+
|
128
|
+
# => "RUB"
|
129
|
+
field :currency
|
130
|
+
|
131
|
+
# => "643"
|
132
|
+
field :currency_code
|
133
|
+
|
134
|
+
field :tariffs, [:tariff], key: "TARIFF"
|
135
|
+
|
136
|
+
field :points, [Point], key: "POINT"
|
137
|
+
|
138
|
+
field :segments, [Segment], key: "SEGMENT"
|
139
|
+
|
140
|
+
def start_at
|
141
|
+
ActiveSupport::TimeZone["Europe/Kiev"].parse("#{data["START_DATE"]} #{data["START_TIME"]}")
|
142
|
+
end
|
143
|
+
|
144
|
+
parser do
|
145
|
+
def money(val)
|
146
|
+
Monetize.parse(val, doc['CURRENCY'])
|
147
|
+
end
|
148
|
+
|
149
|
+
def tariff(val)
|
150
|
+
Tariff.parse(val.merge(_currency: doc['CURRENCY']))
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# to hold unserialized data
|
155
|
+
attr_accessor :data
|
156
|
+
|
157
|
+
def self.parse(doc)
|
158
|
+
instance = super
|
159
|
+
instance.data = doc
|
160
|
+
instance
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
end
|