gillbus 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,96 @@
|
|
1
|
+
class Gillbus
|
2
|
+
module SearchTrips
|
3
|
+
|
4
|
+
Gillbus.register self, :search_trips
|
5
|
+
|
6
|
+
class Request < BaseRequest
|
7
|
+
|
8
|
+
def path; '/online2/searchTrips' end
|
9
|
+
|
10
|
+
# selectedModes (не обязательный)
|
11
|
+
# Вид транспорта, который необходимо искать.
|
12
|
+
# @see Gillbus::BaseRequest::MODES
|
13
|
+
attr_accessor :selected_modes
|
14
|
+
|
15
|
+
# connectionIds (не обязательный)
|
16
|
+
# Список предполагаемых идентификаторов пересадочных пунктов, разделенных “;”. Используется если выбран вид транспорта 8, 9.
|
17
|
+
attr_accessor :connection_ids
|
18
|
+
|
19
|
+
# tripFullSale (не обязательный)
|
20
|
+
# Признак определяющий количество возвращаемых рейсов. Если true, то возвращаются заказные и регулярные рейсы. Если false, то возвращаются только регулярные рейсы.
|
21
|
+
attr_accessor :trip_full_sale
|
22
|
+
|
23
|
+
# fullSearch (не обязательный)
|
24
|
+
# Признак полного поиска рейсов, который указывает когда возвращать результат.
|
25
|
+
# Если true, то результат будет возвращен тогда, когда будет окончен поиск всех возможных рейсов.
|
26
|
+
# Если false, то результат будет возвращен сразу, как только будут найдены первые рейсы.
|
27
|
+
attr_accessor :full_search
|
28
|
+
|
29
|
+
# startCityId
|
30
|
+
# ИД пункта отправления
|
31
|
+
attr_accessor :start_city_id
|
32
|
+
|
33
|
+
# endCityId
|
34
|
+
# ИД пункта прибытия
|
35
|
+
attr_accessor :end_city_id
|
36
|
+
|
37
|
+
# startDateSearch
|
38
|
+
# Дата отправления, на которую будет произведен поиск рейсов.
|
39
|
+
attr_accessor :start_date_search
|
40
|
+
|
41
|
+
# roundTrip
|
42
|
+
# Признак поиска рейсов туда-обратно. По-умолчанию false. Если true, то будут искаться рейсы туда-обратно.
|
43
|
+
# Если false, то будут искаться рейсы только в одну сторону.
|
44
|
+
attr_accessor :round_trip
|
45
|
+
|
46
|
+
# backStartDateSearch (обязательный если roundTrip=true)
|
47
|
+
# Дата отправления, на которую будет произведен поиск обратных рейсов.
|
48
|
+
attr_accessor :back_start_date_search
|
49
|
+
|
50
|
+
# ticketCount
|
51
|
+
# Количество оформляемых билетов. От 1 до k.
|
52
|
+
attr_accessor :ticket_count
|
53
|
+
|
54
|
+
# TODO
|
55
|
+
# passenger0studentTicket... passengerNstudentTicket (не обязательный)
|
56
|
+
# Номер студенческого билета пассажира с порядковым номером 0... N.
|
57
|
+
#
|
58
|
+
# passenger0birthday... passengerNbirthday (не обязательный)
|
59
|
+
# Дата рождения пассажира с порядковым номером 0...N.
|
60
|
+
#
|
61
|
+
# passenger0ISIC... passengerNISIC (не обязательный)
|
62
|
+
# Номер ISIC пассажира с порядковым номером 0...N.
|
63
|
+
attr_accessor :passengers
|
64
|
+
|
65
|
+
# waitTimeout
|
66
|
+
# Время ожидания ответа, секунды. Если параметр установлен и поиск рейсов
|
67
|
+
# длится дольше указанного времени, то будет возвращен пустой ответ через указанное время.
|
68
|
+
# Параметр игнорируется, при fullSearch = true.
|
69
|
+
attr_accessor :wait_timeout
|
70
|
+
|
71
|
+
def params
|
72
|
+
pax = (passengers || []).map.with_index { |p, i| PassengerDiscount.wrap(p).params("passenger#{i}") }.reduce({}, :merge)
|
73
|
+
compact(
|
74
|
+
selectedModes: modes(selected_modes),
|
75
|
+
connectionIds: list(connection_ids),
|
76
|
+
tripFullSale: bool(trip_full_sale),
|
77
|
+
fullSearch: bool(full_search),
|
78
|
+
startCityId: start_city_id,
|
79
|
+
endCityId: end_city_id,
|
80
|
+
startDateSearch: date(start_date_search),
|
81
|
+
roundTrip: bool(round_trip),
|
82
|
+
backStartDateSearch: date(back_start_date_search),
|
83
|
+
ticketCount: ticket_count,
|
84
|
+
waitTimeout: wait_timeout,
|
85
|
+
**pax
|
86
|
+
)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class Response < BaseResponse
|
91
|
+
field :completed, :bool
|
92
|
+
field :trips, [Trip], key: 'TRIP'
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Gillbus
|
2
|
+
module SessionLogin
|
3
|
+
|
4
|
+
Gillbus.register self, :session_login
|
5
|
+
|
6
|
+
class Request < BaseRequest
|
7
|
+
|
8
|
+
def initialize(password:, locale: nil)
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :password
|
13
|
+
attr_accessor :locale
|
14
|
+
|
15
|
+
def path
|
16
|
+
"/online2/sessionLogin/online/#{@password}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def params
|
20
|
+
compact(locale: translated_locale(locale))
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
class Response < BaseResponse
|
26
|
+
|
27
|
+
field :logged, :bool
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# FIXME it's possible I got currency for some fields wrong.
|
2
|
+
class Gillbus
|
3
|
+
class Commission
|
4
|
+
|
5
|
+
extend Fields
|
6
|
+
include UpdateAttrs
|
7
|
+
|
8
|
+
# Collecting type
|
9
|
+
field :type
|
10
|
+
|
11
|
+
# Symbolic collecting code
|
12
|
+
field :code
|
13
|
+
|
14
|
+
# Collecting description
|
15
|
+
field :description
|
16
|
+
|
17
|
+
# Value of collecting in sale currency
|
18
|
+
field :value, :money
|
19
|
+
|
20
|
+
# Value of collecting VAT in sale currency
|
21
|
+
field :vat, :money
|
22
|
+
|
23
|
+
# Collecting currency
|
24
|
+
field :currency
|
25
|
+
|
26
|
+
# Exchange rate of collecting to sale currency
|
27
|
+
field :rate
|
28
|
+
|
29
|
+
# Value of collecting in currency in which it is brought
|
30
|
+
field :value_in_currency, :money
|
31
|
+
|
32
|
+
# Value of collecting VAT in currency in which it is brought
|
33
|
+
field :vat_in_currency, :money
|
34
|
+
|
35
|
+
# The return amount from collecting in sale currency (w/o VAT)
|
36
|
+
field :return_value, :money
|
37
|
+
|
38
|
+
# The return amount from collecting VAT in sale currency
|
39
|
+
field :return_vat, :money
|
40
|
+
|
41
|
+
# The return amount from collecting in currency in which it is brought (w/o VAT)
|
42
|
+
field :return_value_in_currency, :money
|
43
|
+
|
44
|
+
# The return amount from collecting VAT in currency in which it is brought.
|
45
|
+
field :return_vat_in_currency, :money
|
46
|
+
|
47
|
+
parser do
|
48
|
+
def money(val)
|
49
|
+
Monetize.parse(val, doc['CURRENCY'])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Gillbus
|
2
|
+
# not a request, neither a response part
|
3
|
+
# just a params record for SearchTrips
|
4
|
+
class PassengerDiscount < BaseRequest
|
5
|
+
|
6
|
+
def self.wrap(passenger_or_params)
|
7
|
+
return passenger_or_params if passenger_or_params.is_a? self
|
8
|
+
new(passenger_or_params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# passenger0birthday... passengerNbirthday (обязательный для авиаперевозки)
|
12
|
+
# Дата рождения пассажира с порядковым номером 0...N.
|
13
|
+
attr_accessor :birthday
|
14
|
+
|
15
|
+
# passenger0studentTicket... passengerNstudentTicket (не обязательный)
|
16
|
+
# Номер студенческого билета пассажира с порядковым номером 0... N.
|
17
|
+
attr_accessor :student_ticket
|
18
|
+
|
19
|
+
# passenger0studentYear... passengerNstudentYear (не обязательный)
|
20
|
+
# Курс, на котором учится пассажир с порядковым номером 0...N, если он студент.
|
21
|
+
# Для просчета более выгодной скидки.
|
22
|
+
attr_accessor :student_year
|
23
|
+
|
24
|
+
# passenger0ISIC...passengerNISIC (не обязательный)
|
25
|
+
# Номер ISIC пассажира с порядковым номером 0...N.
|
26
|
+
attr_accessor :isic
|
27
|
+
|
28
|
+
def params(prefix="")
|
29
|
+
compact(
|
30
|
+
birthday: date(birthday),
|
31
|
+
studentTicket: student_ticket,
|
32
|
+
studentYear: student_year,
|
33
|
+
ISIC: isic,
|
34
|
+
).map {|k, v| [:"#{prefix}#{k}", v] }.to_h
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class Point
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# => "0"
|
8
|
+
field :number
|
9
|
+
|
10
|
+
# => "Москва"
|
11
|
+
field :geography_name
|
12
|
+
|
13
|
+
# => "м. \"Речной Вокзал\""
|
14
|
+
field :name
|
15
|
+
|
16
|
+
# => "ул. Фестивальная, дом 11, метро \"Речной Вокзал\""
|
17
|
+
field :address
|
18
|
+
|
19
|
+
# => "10.10.2014"
|
20
|
+
field :arrival_date, :date
|
21
|
+
|
22
|
+
# => nil
|
23
|
+
field :arrival_time, :time
|
24
|
+
|
25
|
+
# => "10.10.2014"
|
26
|
+
field :dispatch_date, :date
|
27
|
+
|
28
|
+
# => "22:50"
|
29
|
+
field :dispatch_time, :time
|
30
|
+
|
31
|
+
# => "false"
|
32
|
+
field :check_point, :bool
|
33
|
+
|
34
|
+
# Признак наличия пересадки в пункте
|
35
|
+
# => "false"
|
36
|
+
field :transfer_point, :bool
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class ReturnCause
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# The return condition ID
|
8
|
+
field :id
|
9
|
+
|
10
|
+
# Approx. return amount in sale currency
|
11
|
+
field :approximate_amount, :money
|
12
|
+
|
13
|
+
# The return reason’s description.
|
14
|
+
field :cause
|
15
|
+
|
16
|
+
parser do
|
17
|
+
def money(val)
|
18
|
+
Monetize.parse(val, doc[:_currency])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class Seat
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# seat id
|
8
|
+
field :id
|
9
|
+
|
10
|
+
field :number
|
11
|
+
|
12
|
+
# Тип места.
|
13
|
+
# 0 – пустое место, ячейка прохода.
|
14
|
+
# 1 – место заказанное.
|
15
|
+
# 2 – заблокированное.
|
16
|
+
# 3 – свободное.
|
17
|
+
# 4 – забронированное.
|
18
|
+
# 5 – проданное.
|
19
|
+
# 6 – место под спецбронью.
|
20
|
+
# 7 – зарегистрированное.
|
21
|
+
# 8 – место под технической бронью.
|
22
|
+
# 9 – приоритетное место.
|
23
|
+
# Продажи возможно осуществлять только на места типа «3» и «9»
|
24
|
+
field :type, :int
|
25
|
+
|
26
|
+
field :x, :int
|
27
|
+
field :y, :int
|
28
|
+
|
29
|
+
def free?
|
30
|
+
type == 3 || type == 9
|
31
|
+
end
|
32
|
+
|
33
|
+
def isle?
|
34
|
+
type == 0 || type.nil?
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class Segment
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# Порядковый номер сегмента рейса.
|
8
|
+
# => "0"
|
9
|
+
field :segment_number
|
10
|
+
|
11
|
+
# Признак сегмента обратного направления искусственного рейса туда-обратно.
|
12
|
+
# Если TRIP_MODE = 8 и искались обратные рейсы, то параметр будет равен true.
|
13
|
+
# => "false"
|
14
|
+
field :back_segment, :bool
|
15
|
+
|
16
|
+
# => "393409381686201016"
|
17
|
+
field :id
|
18
|
+
|
19
|
+
# Идентификатор стороннего поставщика. 0 - gillbus
|
20
|
+
# => "0"
|
21
|
+
field :res_id
|
22
|
+
|
23
|
+
# => "Москва-Санкт-Петербург"
|
24
|
+
field :number
|
25
|
+
|
26
|
+
# => "Москва"
|
27
|
+
field :start_city_name
|
28
|
+
|
29
|
+
# => "Санкт-Петербург"
|
30
|
+
field :end_city_name
|
31
|
+
|
32
|
+
# => "10.10.2014"
|
33
|
+
field :start_date, :date
|
34
|
+
|
35
|
+
# => "11.10.2014"
|
36
|
+
field :end_date, :date
|
37
|
+
|
38
|
+
# => "22:50"
|
39
|
+
field :start_time, :time
|
40
|
+
|
41
|
+
# => "08:00"
|
42
|
+
field :end_time, :time
|
43
|
+
|
44
|
+
# => "Сетра S 315 НDH"
|
45
|
+
field :bus_model
|
46
|
+
|
47
|
+
# => true
|
48
|
+
field :trip_seats_map, :bool
|
49
|
+
|
50
|
+
# => "49"
|
51
|
+
field :places_count, :int
|
52
|
+
|
53
|
+
# => "10"
|
54
|
+
field :free_places_count, :int
|
55
|
+
|
56
|
+
# => "10/49"
|
57
|
+
field :free_busy_places
|
58
|
+
|
59
|
+
# => "ABCDEE23413"
|
60
|
+
field :carrier_id
|
61
|
+
|
62
|
+
# => "RU \"ПЕТРОКОМ - АВТО ПЛЮС\" ООО"
|
63
|
+
field :carrier_name
|
64
|
+
|
65
|
+
# => "09:10"
|
66
|
+
field :time_in_road, :time
|
67
|
+
|
68
|
+
# => "м. \"Речной Вокзал\""
|
69
|
+
field :station_begin_name
|
70
|
+
|
71
|
+
# => "ул. Фестивальная, дом 11, метро \"Речной Вокзал\""
|
72
|
+
field :station_begin_address
|
73
|
+
|
74
|
+
# => "м. \"Бухарестская\""
|
75
|
+
field :station_end_name
|
76
|
+
|
77
|
+
# => "ул. Бухарестская, 30/32 торговый дом \"Континент\", метро \"Бухарестская\""
|
78
|
+
field :station_end_address
|
79
|
+
|
80
|
+
# => "true"
|
81
|
+
field :reservation_enabled, :bool
|
82
|
+
|
83
|
+
# => "true"
|
84
|
+
field :sale_enabled, :bool
|
85
|
+
|
86
|
+
# => "false"
|
87
|
+
field :return_enabled, :bool
|
88
|
+
|
89
|
+
# => "25"
|
90
|
+
field :time_for_cancel, :int
|
91
|
+
|
92
|
+
# => "false"
|
93
|
+
field :trip_full_sale, :bool
|
94
|
+
|
95
|
+
# => "true"
|
96
|
+
field :can_discount, :bool
|
97
|
+
|
98
|
+
# => "false"
|
99
|
+
field :international, :bool
|
100
|
+
|
101
|
+
# => "false"
|
102
|
+
field :join_book_buy, :bool
|
103
|
+
|
104
|
+
# => "1"
|
105
|
+
field :trip_mode, :int
|
106
|
+
|
107
|
+
# => "null"
|
108
|
+
field :image_url
|
109
|
+
|
110
|
+
# => "null"
|
111
|
+
field :start_point_type
|
112
|
+
|
113
|
+
# => "null"
|
114
|
+
field :vehicle_description
|
115
|
+
|
116
|
+
# => "null"
|
117
|
+
field :vehicle_features
|
118
|
+
|
119
|
+
# => "false"
|
120
|
+
field :branded, :bool
|
121
|
+
|
122
|
+
# => "1100"
|
123
|
+
field :total_cost, :money
|
124
|
+
|
125
|
+
# => "RUB"
|
126
|
+
field :currency
|
127
|
+
|
128
|
+
# => "643"
|
129
|
+
field :currency_code
|
130
|
+
|
131
|
+
field :tariffs, [:tariff], key: "TARIFF"
|
132
|
+
|
133
|
+
field :points, [Point], key: "POINT"
|
134
|
+
|
135
|
+
field :segments, [Segment], key: "SEGMENT"
|
136
|
+
|
137
|
+
def start_at
|
138
|
+
ActiveSupport::TimeZone["Europe/Kiev"].parse("#{data["START_DATE"]} #{data["START_TIME"]}")
|
139
|
+
end
|
140
|
+
|
141
|
+
parser do
|
142
|
+
def money(val)
|
143
|
+
Monetize.parse(val, doc['CURRENCY'])
|
144
|
+
end
|
145
|
+
|
146
|
+
def tariff(val)
|
147
|
+
Tariff.parse(val.merge(_currency: doc['CURRENCY']))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# to hold unserialized data
|
152
|
+
attr_accessor :data
|
153
|
+
|
154
|
+
def self.parse(doc)
|
155
|
+
instance = super
|
156
|
+
instance.data = doc
|
157
|
+
instance
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Gillbus
|
2
|
+
class Tariff
|
3
|
+
|
4
|
+
extend Fields
|
5
|
+
include UpdateAttrs
|
6
|
+
|
7
|
+
# => "Y"
|
8
|
+
field :short_name
|
9
|
+
|
10
|
+
# => "Базовый тариф"
|
11
|
+
field :full_name
|
12
|
+
|
13
|
+
# => nil
|
14
|
+
field :start_date, :date
|
15
|
+
|
16
|
+
# => nil
|
17
|
+
field :end_date, :date
|
18
|
+
|
19
|
+
# => "Базовый тариф стоимости проезда одного пассажиров в одном направлении\n"
|
20
|
+
field :description
|
21
|
+
|
22
|
+
# => "24"
|
23
|
+
field :time_to_buy_reserved, :int
|
24
|
+
|
25
|
+
# => "6"
|
26
|
+
field :time_to_stop_booking, :int
|
27
|
+
|
28
|
+
# Время на выкуп брони, то же что и date_to_pay у ticket'а
|
29
|
+
field :time_to_pay_reservation, :datetime
|
30
|
+
|
31
|
+
# => "1100"
|
32
|
+
field :cost, :money
|
33
|
+
|
34
|
+
# => "true"
|
35
|
+
field :after_dispatch_no_return, :bool
|
36
|
+
|
37
|
+
# => nil
|
38
|
+
field :passenger_birthday
|
39
|
+
|
40
|
+
# => nil
|
41
|
+
field :passenger_isic_number
|
42
|
+
|
43
|
+
# => nil
|
44
|
+
field :passenger_student_ticket
|
45
|
+
|
46
|
+
# => "..."
|
47
|
+
field :return_cause
|
48
|
+
|
49
|
+
# => "66.61"
|
50
|
+
field :note
|
51
|
+
|
52
|
+
parser do
|
53
|
+
def money(val)
|
54
|
+
Monetize.parse(val, doc[:_currency])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|