gillbus 0.18.6 → 0.18.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: 1699eb5ff3908c54ba839df8d767d6a17ae0766c
4
- data.tar.gz: f12d971f95d3a0abee3a4732dceedaf69c966f7b
3
+ metadata.gz: 9b5254d67655669e73b597bb31908f098ef5809d
4
+ data.tar.gz: 6d6fb0a7f94fb778abf7b7e1bbbc19257cbd45e6
5
5
  SHA512:
6
- metadata.gz: e9e65bb084aad8a42b2f660c4fc32faba44d9743ea2bf971ff1824ea18fa56e08d2343c46c5a52a0e4ab271016077cd8d115458d35e9f4821ca5ab5ad18e88b5
7
- data.tar.gz: 95d2330c94a6a1ba407a98ebe98cf6f03b5000476ce97ad8006eed4dd9a574a52934a288a8d68ab378b8b808bffd801718e746fb54961c06a978e8239db1f0c5
6
+ metadata.gz: b668d5237ca23a6e8eb407615355d16d49f841f8024e4e98673b30aa479857a1c5e9ec32fff0270a91b7c37d271fe03832b19eb3f69acc320aad2aeecc4b3e09
7
+ data.tar.gz: 8c496874341822e74fa4091db0b6973c3197757cf08978a8550b65203f992997b0418f4a3041a4d25c03a6e76eb78b4a7078e6fbdfd57277edd61ebec03afda8
@@ -91,6 +91,9 @@ class Gillbus
91
91
 
92
92
  attr_accessor :insurance_id
93
93
 
94
+ # extendedSearch number Признак отображения в результате поиска соседних городов
95
+ attr_accessor :extended_search
96
+
94
97
  def params
95
98
  compact(
96
99
  selectedModes: modes(selected_modes),
@@ -107,6 +110,7 @@ class Gillbus
107
110
  onlyBranded: bool(only_branded),
108
111
  tripOptions: bool(trip_options),
109
112
  insuranceId: insurance_id,
113
+ extendedSearch: extended_search,
110
114
  **passengers_data,
111
115
  )
112
116
  end
@@ -132,6 +136,7 @@ class Gillbus
132
136
  class Response < BaseResponse
133
137
  field :completed, :bool
134
138
  field :trips, [Trip], key: 'TRIP'
139
+ field :nearby_trips, [NearbyTrip], key: 'TRIP', root: 'NEARBY_CITIES'
135
140
  end
136
141
  end
137
142
  end
@@ -0,0 +1,58 @@
1
+ # результаты поиска по соседним городам, берется из кеша и содержит меньше данных, чем поездка из выдачи
2
+ class Gillbus
3
+ class NearbyTrip
4
+ extend Fields
5
+ include UpdateAttrs
6
+
7
+ # => "Москва"
8
+ field :start_city_name
9
+
10
+ # => "A7CD147C07E7CD1BE040A8C0630328EC"
11
+ field :start_city_guid
12
+
13
+ # => "Europe/Moscow"
14
+ field :start_timezone
15
+
16
+ # => 20
17
+ field :distance_to_start
18
+
19
+ # => "Смоленск"
20
+ field :end_city_name
21
+
22
+ # => "DD253CDEE7D1555EE040B8596052093F"
23
+ field :end_city_guid
24
+
25
+ # => "Europe/Moscow"
26
+ field :end_timezone
27
+
28
+ # => "22:50"
29
+ field :start_time, :time # XXX
30
+
31
+ # => "08:00"
32
+ field :end_time, :time # XXX
33
+
34
+ # => ""Автофлот Автоколонна-1601" ООО"
35
+ field :carrier_name # XXX
36
+
37
+ # => "RU "Автофлот Автоколонна-1601" ООО"
38
+ field :carrier_legal_name # XXX
39
+
40
+ # => "390"
41
+ field :time_in_road
42
+
43
+ # => "1100"
44
+ field :total_cost, :money
45
+
46
+ # => "RUB"
47
+ field :currency
48
+
49
+ parser do
50
+ def money(val)
51
+ Monetize.parse(val, doc['CURRENCY'])
52
+ end
53
+ end
54
+
55
+ # to hold unserialized data
56
+ attr_accessor :data
57
+ end
58
+ end
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = '0.18.6'.freeze
2
+ VERSION = '0.18.7'.freeze
3
3
  end
data/lib/gillbus.rb CHANGED
@@ -66,6 +66,7 @@ class Gillbus
66
66
  require 'gillbus/structs/seat'
67
67
  require 'gillbus/structs/item'
68
68
  require 'gillbus/structs/carrier'
69
+ require 'gillbus/structs/nearby_trip'
69
70
 
70
71
  require 'gillbus/parse_error'
71
72
  require 'gillbus/base_request'
@@ -0,0 +1,41 @@
1
+ <DATA>
2
+ <COMPLETED>true</COMPLETED>
3
+ <NEARBY_CITIES>
4
+ <TRIP>
5
+ <START_CITY_NAME>Москва</START_CITY_NAME>
6
+ <START_CITY_GUID>A7CD147C07E7CD1BE040A8C0630328EC</START_CITY_GUID>
7
+ <START_TIMEZONE>Europe/Moscow</START_TIMEZONE>
8
+ <DISTANCE_TO_START>20</DISTANCE_TO_START>
9
+ <END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
10
+ <END_CITY_GUID>CA975BC2ACDBCF7FE040B859C14327B3</END_CITY_GUID>
11
+ <END_TIMEZONE>Europe/Moscow</END_TIMEZONE>
12
+ <DISTANCE_TO_END>0</DISTANCE_TO_END>
13
+ <START_TIME>21:30</START_TIME>
14
+ <END_TIME>08:45</END_TIME>
15
+ <CARRIER_NAME>"Авто-Транс-Ком" ООО </CARRIER_NAME>
16
+ <CARRIER_LEGAL_NAME>RU "Авто-Транс-Ком" ООО </CARRIER_LEGAL_NAME>
17
+ <TIME_IN_ROAD>675</TIME_IN_ROAD>
18
+ <TOTAL_COST>1200</TOTAL_COST>
19
+ <CURRENCY>RUB</CURRENCY>
20
+ <CURRENCY_CODE>643</CURRENCY_CODE>
21
+ </TRIP>
22
+ <TRIP>
23
+ <START_CITY_NAME>Москва</START_CITY_NAME>
24
+ <START_CITY_GUID>A7CD147C07E7CD1BE040A8C0630328EC</START_CITY_GUID>
25
+ <START_TIMEZONE>Europe/Moscow</START_TIMEZONE>
26
+ <DISTANCE_TO_START>20</DISTANCE_TO_START>
27
+ <END_CITY_NAME>Санкт-Петербург</END_CITY_NAME>
28
+ <END_CITY_GUID>CA975BC2ACDBCF7FE040B859C14327B3</END_CITY_GUID>
29
+ <END_TIMEZONE>Europe/Moscow</END_TIMEZONE>
30
+ <DISTANCE_TO_END>0</DISTANCE_TO_END>
31
+ <START_TIME>21:30</START_TIME>
32
+ <END_TIME>09:00</END_TIME>
33
+ <CARRIER_NAME>"Автофлот Автоколонна-1601" ООО</CARRIER_NAME>
34
+ <CARRIER_LEGAL_NAME>RU "Автофлот Автоколонна-1601" ООО</CARRIER_LEGAL_NAME>
35
+ <TIME_IN_ROAD>690</TIME_IN_ROAD>
36
+ <TOTAL_COST>1000</TOTAL_COST>
37
+ <CURRENCY>RUB</CURRENCY>
38
+ <CURRENCY_CODE>643</CURRENCY_CODE>
39
+ </TRIP>
40
+ </NEARBY_CITIES>
41
+ </DATA>
@@ -65,6 +65,10 @@ class SearchTripsResponseTest < Minitest::Test
65
65
  Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-insurance.xml'))
66
66
  end
67
67
 
68
+ def get_trips_with_nearby_cities
69
+ Gillbus::SearchTrips::Response.parse_string(File.read('test/responses/searchTrips-nearby.xml'))
70
+ end
71
+
68
72
  def test_empty_completed
69
73
  response = get_empty_search_trips
70
74
  assert response.completed
@@ -235,4 +239,15 @@ class SearchTripsResponseTest < Minitest::Test
235
239
  assert_equal 1, tariff.insurance_id
236
240
  assert_equal '100000 RUB'.to_money, tariff.insurance_sum
237
241
  end
242
+
243
+ def test_trips_with_nearby_cities
244
+ response = get_trips_with_nearby_cities
245
+ assert response.completed
246
+ trip = response.nearby_trips.first
247
+ assert_equal 'Москва', trip.start_city_name
248
+ assert_equal 'Санкт-Петербург', trip.end_city_name
249
+ assert_equal '1200 RUB'.to_money, trip.total_cost
250
+ assert_equal '"Авто-Транс-Ком" ООО ', trip.carrier_name
251
+ assert_equal '21:30', trip.start_time
252
+ end
238
253
  end
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.6
4
+ version: 0.18.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: 2018-08-07 00:00:00.000000000 Z
12
+ date: 2018-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -204,6 +204,7 @@ files:
204
204
  - lib/gillbus/structs/carrier.rb
205
205
  - lib/gillbus/structs/commission.rb
206
206
  - lib/gillbus/structs/item.rb
207
+ - lib/gillbus/structs/nearby_trip.rb
207
208
  - lib/gillbus/structs/passenger_discount.rb
208
209
  - lib/gillbus/structs/point.rb
209
210
  - lib/gillbus/structs/return_cause.rb
@@ -265,6 +266,7 @@ files:
265
266
  - test/responses/returnPositionSuccess.xml
266
267
  - test/responses/searchTrips-empty.xml
267
268
  - test/responses/searchTrips-insurance.xml
269
+ - test/responses/searchTrips-nearby.xml
268
270
  - test/responses/searchTrips-prod-invalid.xml
269
271
  - test/responses/searchTrips-prod.xml
270
272
  - test/responses/searchTrips-segments-roundtrip.xml
@@ -343,6 +345,7 @@ test_files:
343
345
  - test/responses/returnPositionSuccess.xml
344
346
  - test/responses/searchTrips-empty.xml
345
347
  - test/responses/searchTrips-insurance.xml
348
+ - test/responses/searchTrips-nearby.xml
346
349
  - test/responses/searchTrips-prod-invalid.xml
347
350
  - test/responses/searchTrips-prod.xml
348
351
  - test/responses/searchTrips-segments-roundtrip.xml