gillbus 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +10 -0
  5. data/Guardfile +29 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +140 -0
  8. data/Rakefile +9 -0
  9. data/gillbus.gemspec +31 -0
  10. data/lib/gillbus/base_request.rb +99 -0
  11. data/lib/gillbus/base_response.rb +43 -0
  12. data/lib/gillbus/buy_booking.rb +74 -0
  13. data/lib/gillbus/buy_tickets.rb +36 -0
  14. data/lib/gillbus/cancel_order.rb +55 -0
  15. data/lib/gillbus/drivers/faraday_response_file_logger.rb +19 -0
  16. data/lib/gillbus/find_order.rb +37 -0
  17. data/lib/gillbus/get_all_cities.rb +24 -0
  18. data/lib/gillbus/get_cities.rb +34 -0
  19. data/lib/gillbus/get_countries.rb +24 -0
  20. data/lib/gillbus/get_dates_new.rb +35 -0
  21. data/lib/gillbus/get_order_status.rb +28 -0
  22. data/lib/gillbus/get_order_ticket.rb +62 -0
  23. data/lib/gillbus/get_required_fields.rb +32 -0
  24. data/lib/gillbus/get_time_table.rb +33 -0
  25. data/lib/gillbus/get_trip_seats.rb +61 -0
  26. data/lib/gillbus/get_trips.rb +13 -0
  27. data/lib/gillbus/helpers/fields.rb +47 -0
  28. data/lib/gillbus/helpers/parser.rb +100 -0
  29. data/lib/gillbus/helpers/update_attrs.rb +15 -0
  30. data/lib/gillbus/lock_seats.rb +82 -0
  31. data/lib/gillbus/logout.rb +19 -0
  32. data/lib/gillbus/parse_error.rb +11 -0
  33. data/lib/gillbus/reserve_tickets.rb +13 -0
  34. data/lib/gillbus/search_trips.rb +96 -0
  35. data/lib/gillbus/session_login.rb +32 -0
  36. data/lib/gillbus/structs/commission.rb +54 -0
  37. data/lib/gillbus/structs/item.rb +14 -0
  38. data/lib/gillbus/structs/passenger_discount.rb +37 -0
  39. data/lib/gillbus/structs/point.rb +38 -0
  40. data/lib/gillbus/structs/return_cause.rb +23 -0
  41. data/lib/gillbus/structs/seat.rb +38 -0
  42. data/lib/gillbus/structs/segment.rb +161 -0
  43. data/lib/gillbus/structs/tariff.rb +59 -0
  44. data/lib/gillbus/structs/ticket.rb +285 -0
  45. data/lib/gillbus/structs/timetable_segment.rb +51 -0
  46. data/lib/gillbus/structs/timetable_trip.rb +77 -0
  47. data/lib/gillbus/structs/trip.rb +164 -0
  48. data/lib/gillbus/tickets_booking.rb +182 -0
  49. data/lib/gillbus/unlock_seats.rb +15 -0
  50. data/lib/gillbus/version.rb +3 -0
  51. data/lib/gillbus.rb +86 -0
  52. data/script/example_booking.rb +82 -0
  53. data/script/example_booking_with_segments.rb +90 -0
  54. data/script/example_canceling_booking.rb +67 -0
  55. data/script/example_canceling_reservation.rb +69 -0
  56. data/script/example_reservation.rb +88 -0
  57. data/test/buy_booking_test.rb +32 -0
  58. data/test/buy_tickets_test.rb +12 -0
  59. data/test/cancel_order_test.rb +12 -0
  60. data/test/error_test.rb +31 -0
  61. data/test/find_order_test.rb +24 -0
  62. data/test/get_cities_test.rb +12 -0
  63. data/test/get_countries_test.rb +12 -0
  64. data/test/get_dates_new_test.rb +12 -0
  65. data/test/get_order_ticket_test.rb +12 -0
  66. data/test/get_time_table_test.rb +21 -0
  67. data/test/get_trip_seats_test.rb +40 -0
  68. data/test/lock_seats_test.rb +70 -0
  69. data/test/reserve_tickets_test.rb +22 -0
  70. data/test/responses/buyBooking.xml +9 -0
  71. data/test/responses/buyTickets.xml +7 -0
  72. data/test/responses/cancelOrder.xml +8 -0
  73. data/test/responses/error.xml +1 -0
  74. data/test/responses/findOrder.xml +296 -0
  75. data/test/responses/getCities.xml +266 -0
  76. data/test/responses/getCountries.xml +90 -0
  77. data/test/responses/getOrderTicket.xml +3 -0
  78. data/test/responses/getTimeTable.xml +81 -0
  79. data/test/responses/getTripSeats-one-empty-segment.xml +562 -0
  80. data/test/responses/getTripSeats-segments.xml +1052 -0
  81. data/test/responses/getTripSeats.xml +492 -0
  82. data/test/responses/lockSeats.xml +23 -0
  83. data/test/responses/reserveTickets.xml +76 -0
  84. data/test/responses/searchTrips-empty.xml +3 -0
  85. data/test/responses/searchTrips-prod.xml +193 -0
  86. data/test/responses/searchTrips-segments-roundtrip.xml +15812 -0
  87. data/test/responses/searchTrips-segments.xml +808 -0
  88. data/test/responses/sessionLogin.xml +3 -0
  89. data/test/responses/ticketsBooking.xml +75 -0
  90. data/test/responses/very_empty.xml +1 -0
  91. data/test/search_trips_test.rb +71 -0
  92. data/test/session_login_test.rb +12 -0
  93. data/test/test_helper.rb +3 -0
  94. data/test/tickets_booking_test.rb +16 -0
  95. metadata +303 -0
@@ -0,0 +1,193 @@
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
+ <END_TIME>06:30</END_TIME>
13
+ <BUS_MODEL/>
14
+ <PLACES_COUNT>18</PLACES_COUNT>
15
+ <FREE_PLACES_COUNT>3</FREE_PLACES_COUNT>
16
+ <FREE_BUSY_PLACES>3/18</FREE_BUSY_PLACES>
17
+ <CARRIER_NAME>ИП Унанян И.А.</CARRIER_NAME>
18
+ <TIME_IN_ROAD>11:30</TIME_IN_ROAD>
19
+ <STATION_BEGIN_NAME>Москва</STATION_BEGIN_NAME>
20
+ <STATION_BEGIN_ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</STATION_BEGIN_ADDRESS>
21
+ <STATION_END_NAME>Санкт-Петербург</STATION_END_NAME>
22
+ <STATION_END_ADDRESS>м. Купчино </STATION_END_ADDRESS>
23
+ <RESERVATION_ENABLED>true</RESERVATION_ENABLED>
24
+ <SALE_ENABLED>true</SALE_ENABLED>
25
+ <RETURN_ENABLED>false</RETURN_ENABLED>
26
+ <TIME_FOR_CANCEL>25</TIME_FOR_CANCEL>
27
+ <TRIP_FULL_SALE>false</TRIP_FULL_SALE>
28
+ <CAN_DISCOUNT>true</CAN_DISCOUNT>
29
+ <INTERNATIONAL>false</INTERNATIONAL>
30
+ <JOIN_BOOK_BUY>false</JOIN_BOOK_BUY>
31
+ <TRIP_MODE>1</TRIP_MODE>
32
+ <IMAGE_URL>null</IMAGE_URL>
33
+ <START_POINT_TYPE>null</START_POINT_TYPE>
34
+ <VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
35
+ <VEHICLE_FEATURES>null</VEHICLE_FEATURES>
36
+ <TOTAL_COST>1410.0</TOTAL_COST>
37
+ <CURRENCY>RUB</CURRENCY>
38
+ <CURRENCY_CODE>643</CURRENCY_CODE>
39
+ <TARIFF>
40
+ <SHORT_NAME>Y</SHORT_NAME>
41
+ <FULL_NAME/>
42
+ <START_DATE/>
43
+ <END_DATE/>
44
+ <DESCRIPTION/>
45
+ <TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
46
+ <TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
47
+ <COST>1410</COST>
48
+ <AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
49
+ <PASSENGER_BIRTHDAY/>
50
+ <PASSENGER_ISIC_NUMBER/>
51
+ <PASSENGER_STUDENT_TICKET/>
52
+ </TARIFF>
53
+ <POINT>
54
+ <NUMBER>0</NUMBER>
55
+ <GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
56
+ <NAME>Москва</NAME>
57
+ <ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
58
+ <ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
59
+ <ARRIVAL_TIME>19:00</ARRIVAL_TIME>
60
+ <DISPATCH_DATE/>
61
+ <DISPATCH_TIME/>
62
+ <CHECK_POINT>false</CHECK_POINT>
63
+ </POINT>
64
+ <POINT>
65
+ <NUMBER>1</NUMBER>
66
+ <GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
67
+ <NAME>Вышний Волочек</NAME>
68
+ <ADDRESS>трасса (М10)</ADDRESS>
69
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
70
+ <ARRIVAL_TIME>00:00</ARRIVAL_TIME>
71
+ <DISPATCH_DATE/>
72
+ <DISPATCH_TIME/>
73
+ <CHECK_POINT>false</CHECK_POINT>
74
+ </POINT>
75
+ <POINT>
76
+ <NUMBER>2</NUMBER>
77
+ <GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
78
+ <NAME>Великий Новгород</NAME>
79
+ <ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
80
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
81
+ <ARRIVAL_TIME>03:30</ARRIVAL_TIME>
82
+ <DISPATCH_DATE/>
83
+ <DISPATCH_TIME/>
84
+ <CHECK_POINT>false</CHECK_POINT>
85
+ </POINT>
86
+ <POINT>
87
+ <NUMBER>3</NUMBER>
88
+ <GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
89
+ <NAME>Санкт-Петербург</NAME>
90
+ <ADDRESS>м. Купчино </ADDRESS>
91
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
92
+ <ARRIVAL_TIME>06:30</ARRIVAL_TIME>
93
+ <DISPATCH_DATE/>
94
+ <DISPATCH_TIME/>
95
+ <CHECK_POINT>false</CHECK_POINT>
96
+ </POINT>
97
+ </TRIP>
98
+ <TRIP>
99
+ <ID>-3986171261205069729</ID>
100
+ <RES_ID>10</RES_ID>
101
+ <NUMBER>2093</NUMBER>
102
+ <START_CITY_NAME>Москва</START_CITY_NAME>
103
+ <END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
104
+ <START_DATE>23.08.2014</START_DATE>
105
+ <END_DATE>24.08.2014</END_DATE>
106
+ <START_TIME>21:10</START_TIME>
107
+ <END_TIME>08:40</END_TIME>
108
+ <BUS_MODEL/>
109
+ <PLACES_COUNT>18</PLACES_COUNT>
110
+ <FREE_PLACES_COUNT>10</FREE_PLACES_COUNT>
111
+ <FREE_BUSY_PLACES>10/18</FREE_BUSY_PLACES>
112
+ <CARRIER_NAME>ИП Унанян И.А.</CARRIER_NAME>
113
+ <TIME_IN_ROAD>11:30</TIME_IN_ROAD>
114
+ <STATION_BEGIN_NAME>Москва</STATION_BEGIN_NAME>
115
+ <STATION_BEGIN_ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</STATION_BEGIN_ADDRESS>
116
+ <STATION_END_NAME>Санкт-Петербург</STATION_END_NAME>
117
+ <STATION_END_ADDRESS>м. Купчино </STATION_END_ADDRESS>
118
+ <RESERVATION_ENABLED>true</RESERVATION_ENABLED>
119
+ <SALE_ENABLED>true</SALE_ENABLED>
120
+ <RETURN_ENABLED>false</RETURN_ENABLED>
121
+ <TIME_FOR_CANCEL>25</TIME_FOR_CANCEL>
122
+ <TRIP_FULL_SALE>false</TRIP_FULL_SALE>
123
+ <CAN_DISCOUNT>true</CAN_DISCOUNT>
124
+ <INTERNATIONAL>false</INTERNATIONAL>
125
+ <JOIN_BOOK_BUY>false</JOIN_BOOK_BUY>
126
+ <TRIP_MODE>1</TRIP_MODE>
127
+ <IMAGE_URL>null</IMAGE_URL>
128
+ <START_POINT_TYPE>null</START_POINT_TYPE>
129
+ <VEHICLE_DESCRIPTION>null</VEHICLE_DESCRIPTION>
130
+ <VEHICLE_FEATURES>null</VEHICLE_FEATURES>
131
+ <TOTAL_COST>1410</TOTAL_COST>
132
+ <CURRENCY>RUB</CURRENCY>
133
+ <CURRENCY_CODE>643</CURRENCY_CODE>
134
+ <TARIFF>
135
+ <SHORT_NAME>Y</SHORT_NAME>
136
+ <FULL_NAME/>
137
+ <START_DATE/>
138
+ <END_DATE/>
139
+ <DESCRIPTION/>
140
+ <TIME_TO_BUY_RESERVED>0</TIME_TO_BUY_RESERVED>
141
+ <TIME_TO_STOP_BOOKING>0</TIME_TO_STOP_BOOKING>
142
+ <COST>1410</COST>
143
+ <AFTER_DISPATCH_NO_RETURN>false</AFTER_DISPATCH_NO_RETURN>
144
+ <PASSENGER_BIRTHDAY/>
145
+ <PASSENGER_ISIC_NUMBER/>
146
+ <PASSENGER_STUDENT_TICKET/>
147
+ </TARIFF>
148
+ <POINT>
149
+ <NUMBER>0</NUMBER>
150
+ <GEOGRAPHY_NAME>Москва</GEOGRAPHY_NAME>
151
+ <NAME>Москва</NAME>
152
+ <ADDRESS>Москва, Рязанский переулок, д. 13, стр. 1</ADDRESS>
153
+ <ARRIVAL_DATE>23.08.2014</ARRIVAL_DATE>
154
+ <ARRIVAL_TIME>21:10</ARRIVAL_TIME>
155
+ <DISPATCH_DATE/>
156
+ <DISPATCH_TIME/>
157
+ <CHECK_POINT>false</CHECK_POINT>
158
+ </POINT>
159
+ <POINT>
160
+ <NUMBER>1</NUMBER>
161
+ <GEOGRAPHY_NAME>Вышний Волочек</GEOGRAPHY_NAME>
162
+ <NAME>Вышний Волочек</NAME>
163
+ <ADDRESS>трасса (М10)</ADDRESS>
164
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
165
+ <ARRIVAL_TIME>02:10</ARRIVAL_TIME>
166
+ <DISPATCH_DATE/>
167
+ <DISPATCH_TIME/>
168
+ <CHECK_POINT>false</CHECK_POINT>
169
+ </POINT>
170
+ <POINT>
171
+ <NUMBER>2</NUMBER>
172
+ <GEOGRAPHY_NAME>Великий Новгород</GEOGRAPHY_NAME>
173
+ <NAME>Великий Новгород</NAME>
174
+ <ADDRESS>трасса (Подберезье, поворот на Великий Новгород)</ADDRESS>
175
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
176
+ <ARRIVAL_TIME>05:40</ARRIVAL_TIME>
177
+ <DISPATCH_DATE/>
178
+ <DISPATCH_TIME/>
179
+ <CHECK_POINT>false</CHECK_POINT>
180
+ </POINT>
181
+ <POINT>
182
+ <NUMBER>3</NUMBER>
183
+ <GEOGRAPHY_NAME>Санкт-Петербург</GEOGRAPHY_NAME>
184
+ <NAME>Санкт-Петербург</NAME>
185
+ <ADDRESS>м. Купчино </ADDRESS>
186
+ <ARRIVAL_DATE>24.08.2014</ARRIVAL_DATE>
187
+ <ARRIVAL_TIME>08:40</ARRIVAL_TIME>
188
+ <DISPATCH_DATE/>
189
+ <DISPATCH_TIME/>
190
+ <CHECK_POINT>false</CHECK_POINT>
191
+ </POINT>
192
+ </TRIP>
193
+ </DATA>