gillbus 0.20.8 → 0.20.9

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
  SHA256:
3
- metadata.gz: f8361c79694f78a6bf0e69712d72128d8ece89e53677eab24b5534b5662e096b
4
- data.tar.gz: 4e0efe0e59ffd350698ded2cc7a6fbd70ec097703e6ff84f69a56ed0bfb0766f
3
+ metadata.gz: 161f8a17f94402b8ca20cd20a4db0c512f6dc127d8335c2ac2af83e55a3d515a
4
+ data.tar.gz: 572967b18f23751e5c0932e16943a838d4f0ef1630aae9f08a281d9a2b693f20
5
5
  SHA512:
6
- metadata.gz: fb84cdcebde50aa95fc7a0d181c9e3ae93817921d0630e09a296b7995acc25cb3646f76801f8b81da31db792178bd21fbeb67695c1dd12b3cd4c79f075362879
7
- data.tar.gz: 4e4b7b34efd3975617d71e788dc885b901ab1a320551364f818826169b5e552bae95d1fc125cda57ace11e8e55365cc1a3272f1b670da8ccb7aab4f42e6aa296
6
+ metadata.gz: bcba1738e7f4bb40644d0f9fe191367241910e7e69d3e330d6a831f24aa92c95b4e6c9993c34b0b43cd0f28b7abb2de679194d3bfba242e3773d5e6e163e7b3a
7
+ data.tar.gz: b0a62ce474a083e012e28c8ded9c2ade5d941a9f7e1b34277801cc54047d38e63158b0e2a3815c8a2148c387fd75e452cfbfd0e9de19f62f4ca20715f26a233a
@@ -87,7 +87,7 @@ class Gillbus
87
87
  require 'gillbus/structs/item'
88
88
  require 'gillbus/structs/carrier'
89
89
  require 'gillbus/structs/nearby_cities_trip'
90
- require 'gillbus/structs/baggage'
90
+ require 'gillbus/structs/luggage'
91
91
 
92
92
  require 'gillbus/parse_error'
93
93
  require 'gillbus/base_request'
@@ -16,7 +16,7 @@ class Gillbus
16
16
 
17
17
  class Response < BaseResponse
18
18
  field :dictionary, :bool_dict
19
- field :baggage, Baggage
19
+ field :luggage, Luggage, key: 'BAGGAGE'
20
20
 
21
21
  parser do
22
22
  def bool_dict(val)
@@ -0,0 +1,19 @@
1
+ class Gillbus
2
+ class Luggage
3
+ extend Fields
4
+
5
+ # => "0"
6
+ field :segment_number, :int
7
+
8
+ # => "true"
9
+ field :is_buy, :bool
10
+
11
+ # => "50.5"
12
+ field :luggage_tariff, :decimal, key: 'BAGGAGE_TARIFF'
13
+
14
+ # => "2"
15
+ field :luggage_limit, :int, key: 'BAGGAGE_LIMIT'
16
+
17
+ field :segments, [Luggage], key: 'SEGMENT'
18
+ end
19
+ end
@@ -283,7 +283,7 @@ class Gillbus
283
283
 
284
284
  field :is_online_refund, :bool
285
285
 
286
- field :is_baggage, :bool
286
+ field :is_luggage, :bool, key: 'IS_BAGGAGE'
287
287
 
288
288
  parser do
289
289
  def ticket_status(value)
@@ -150,22 +150,22 @@ class Gillbus
150
150
  # passenger0baggageCount... passengerNbaggageCount (не обязательный)
151
151
  # На рейс без сегментов
152
152
  # Количество мест багажа для пассажира с порядковым номером 0...N.
153
- attr_accessor :baggage
153
+ attr_accessor :luggage
154
154
 
155
155
  # passenger0segment0baggageCount... passengerNsegmentMbaggageCount
156
156
  # На рейс с сегментами
157
157
  # Количество мест багажа для пассажира 0...N на сегмент 0...M
158
- attr_accessor :segments_baggage
158
+ attr_accessor :segments_luggage
159
159
 
160
160
  attr_accessor :insurance_id
161
161
  attr_accessor :insurance_cost
162
162
 
163
163
  def params(prefix = '')
164
164
  # [0, 1] => {'segment0baggageCount' => 0, 'segment1baggageCount' => 1}
165
- prepared_segments_baggage =
166
- if segments_baggage
167
- segments_baggage.map.with_index do |baggage_count, index|
168
- ["segment#{index}baggageCount".to_sym, baggage_count]
165
+ prepared_segments_luggage =
166
+ if segments_luggage
167
+ segments_luggage.map.with_index do |luggage_count, index|
168
+ ["segment#{index}baggageCount".to_sym, luggage_count]
169
169
  end.to_h
170
170
  else
171
171
  {}
@@ -186,8 +186,8 @@ class Gillbus
186
186
  discountValue: discount.to_f.to_s,
187
187
  insuranceId: insurance_id,
188
188
  insurance: insurance_cost,
189
- baggageCount: baggage&.first, # baggage используется для односегментных
190
- **prepared_segments_baggage,
189
+ baggageCount: luggage&.first, # luggage используется для односегментных
190
+ **prepared_segments_luggage,
191
191
  ).map { |k, v| [:"#{prefix}#{k}", v] }.to_h
192
192
  end
193
193
 
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = '0.20.8'.freeze
2
+ VERSION = '0.20.9'.freeze
3
3
  end
@@ -1,25 +1,25 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class GetRequiredFieldsTest < Minitest::Test
4
- def get_required_fields_without_baggage
5
- response_xml = File.read('test/responses/getRequiredFieldsWithoutBaggage.xml')
4
+ def get_required_fields_without_luggage
5
+ response_xml = File.read('test/responses/getRequiredFieldsWithoutLuggage.xml')
6
6
  Gillbus::GetRequiredFields::Response.parse_string(response_xml)
7
7
  end
8
8
 
9
- def get_required_fields_with_one_baggage
10
- response_xml = File.read('test/responses/getRequiredFieldsWithOneBaggage.xml')
9
+ def get_required_fields_with_one_luggage
10
+ response_xml = File.read('test/responses/getRequiredFieldsWithOneLuggage.xml')
11
11
  Gillbus::GetRequiredFields::Response.parse_string(response_xml)
12
12
  end
13
13
 
14
- def get_required_fields_with_two_baggage_segments
15
- response_xml = File.read('test/responses/getRequiredFieldsWithTwoBaggageSegments.xml')
14
+ def get_required_fields_with_two_luggage_segments
15
+ response_xml = File.read('test/responses/getRequiredFieldsWithTwoLuggageSegments.xml')
16
16
  Gillbus::GetRequiredFields::Response.parse_string(response_xml)
17
17
  end
18
18
 
19
- def test_required_fields_without_baggage
20
- result = get_required_fields_without_baggage
19
+ def test_required_fields_without_luggage
20
+ result = get_required_fields_without_luggage
21
21
 
22
- assert_nil result.baggage
22
+ assert_nil result.luggage
23
23
 
24
24
  dictionary = result.dictionary
25
25
  assert_equal false, dictionary[:student_ticket]
@@ -41,37 +41,37 @@ class GetRequiredFieldsTest < Minitest::Test
41
41
  assert_equal true, dictionary[:only_latin_symbols]
42
42
  end
43
43
 
44
- def test_required_fields_with_one_baggage
45
- result = get_required_fields_with_one_baggage
46
- baggage = result.baggage
44
+ def test_required_fields_with_one_luggage
45
+ result = get_required_fields_with_one_luggage
46
+ luggage = result.luggage
47
47
 
48
- assert_equal true, baggage.is_buy
49
- assert_equal 50.5, baggage.baggage_tariff
48
+ assert_equal true, luggage.is_buy
49
+ assert_equal 50.5, luggage.luggage_tariff
50
50
 
51
- assert_equal [], baggage.segments
52
- assert_nil baggage.segment_number
51
+ assert_equal [], luggage.segments
52
+ assert_nil luggage.segment_number
53
53
  end
54
54
 
55
- def test_required_fields_with_two_baggage_segments
56
- result = get_required_fields_with_two_baggage_segments
57
- baggage = result.baggage
55
+ def test_required_fields_with_two_luggage_segments
56
+ result = get_required_fields_with_two_luggage_segments
57
+ luggage = result.luggage
58
58
 
59
- assert_nil baggage.is_buy
60
- assert_nil baggage.baggage_tariff
61
- assert_nil baggage.baggage_limit
59
+ assert_nil luggage.is_buy
60
+ assert_nil luggage.luggage_tariff
61
+ assert_nil luggage.luggage_limit
62
62
 
63
- assert_equal 2, baggage.segments.count
64
- first_baggage_segment = baggage.segments[0]
65
- second_baggage_segment = baggage.segments[1]
63
+ assert_equal 2, luggage.segments.count
64
+ first_luggage_segment = luggage.segments[0]
65
+ second_luggage_segment = luggage.segments[1]
66
66
 
67
- assert_equal 0, first_baggage_segment.segment_number
68
- assert_equal true, first_baggage_segment.is_buy
69
- assert_equal 70.7, first_baggage_segment.baggage_tariff
70
- assert_equal 2, first_baggage_segment.baggage_limit
67
+ assert_equal 0, first_luggage_segment.segment_number
68
+ assert_equal true, first_luggage_segment.is_buy
69
+ assert_equal 70.7, first_luggage_segment.luggage_tariff
70
+ assert_equal 2, first_luggage_segment.luggage_limit
71
71
 
72
- assert_equal 1, second_baggage_segment.segment_number
73
- assert_equal false, second_baggage_segment.is_buy
74
- assert_nil second_baggage_segment.baggage_tariff
75
- assert_nil second_baggage_segment.baggage_limit
72
+ assert_equal 1, second_luggage_segment.segment_number
73
+ assert_equal false, second_luggage_segment.is_buy
74
+ assert_nil second_luggage_segment.luggage_tariff
75
+ assert_nil second_luggage_segment.luggage_limit
76
76
  end
77
77
  end
@@ -13,7 +13,7 @@ class TicketsBookingTest < Minitest::Test
13
13
  assert_equal(Money.new(110_00, 'UAH'), tickets_booking.tickets.first.total_amount)
14
14
  end
15
15
 
16
- def test_params_generation_with_no_baggage
16
+ def test_params_generation_with_no_luggage
17
17
  request = Gillbus::TicketsBooking::Request.new(
18
18
  passengers: [
19
19
  { },
@@ -27,14 +27,14 @@ class TicketsBookingTest < Minitest::Test
27
27
  assert_equal expected_params, request.params
28
28
  end
29
29
 
30
- def test_params_generation_with_baggage_with_one_segment
30
+ def test_params_generation_with_luggage_with_one_segment
31
31
  request = Gillbus::TicketsBooking::Request.new(
32
32
  passengers: [
33
33
  {
34
- baggage: [1],
34
+ luggage: [1],
35
35
  },
36
36
  {
37
- baggage: [2],
37
+ luggage: [2],
38
38
  }
39
39
  ],
40
40
  )
@@ -51,10 +51,10 @@ class TicketsBookingTest < Minitest::Test
51
51
  request = Gillbus::TicketsBooking::Request.new(
52
52
  passengers: [
53
53
  {
54
- segments_baggage: [0, 1],
54
+ segments_luggage: [0, 1],
55
55
  },
56
56
  {
57
- segments_baggage: [1, 0],
57
+ segments_luggage: [1, 0],
58
58
  }
59
59
  ],
60
60
  )
@@ -69,10 +69,10 @@ class TicketsBookingTest < Minitest::Test
69
69
  assert_equal expected_params, request.params
70
70
  end
71
71
 
72
- def test_parse_is_baggage_field
72
+ def test_parse_is_luggage_field
73
73
  response = tickets_booking
74
74
  ticket = response.tickets.first
75
75
 
76
- assert_equal true, ticket.is_baggage
76
+ assert_equal true, ticket.is_luggage
77
77
  end
78
78
  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.20.8
4
+ version: 0.20.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey "codesnik" Trofimenko
@@ -201,11 +201,11 @@ files:
201
201
  - lib/gillbus/search_nearby_trips.rb
202
202
  - lib/gillbus/search_trips.rb
203
203
  - lib/gillbus/session_login.rb
204
- - lib/gillbus/structs/baggage.rb
205
204
  - lib/gillbus/structs/bus_photo.rb
206
205
  - lib/gillbus/structs/carrier.rb
207
206
  - lib/gillbus/structs/commission.rb
208
207
  - lib/gillbus/structs/item.rb
208
+ - lib/gillbus/structs/luggage.rb
209
209
  - lib/gillbus/structs/nearby_cities_trip.rb
210
210
  - lib/gillbus/structs/passenger_discount.rb
211
211
  - lib/gillbus/structs/point.rb
@@ -257,9 +257,9 @@ files:
257
257
  - test/responses/getCities.xml
258
258
  - test/responses/getCountries.xml
259
259
  - test/responses/getOrderTicket.xml
260
- - test/responses/getRequiredFieldsWithOneBaggage.xml
261
- - test/responses/getRequiredFieldsWithTwoBaggageSegments.xml
262
- - test/responses/getRequiredFieldsWithoutBaggage.xml
260
+ - test/responses/getRequiredFieldsWithOneLuggage.xml
261
+ - test/responses/getRequiredFieldsWithTwoLuggageSegments.xml
262
+ - test/responses/getRequiredFieldsWithoutLuggage.xml
263
263
  - test/responses/getTimeTable.xml
264
264
  - test/responses/getTripSeats-back-seats.xml
265
265
  - test/responses/getTripSeats-one-empty-segment.xml
@@ -345,9 +345,9 @@ test_files:
345
345
  - test/responses/getCities.xml
346
346
  - test/responses/getCountries.xml
347
347
  - test/responses/getOrderTicket.xml
348
- - test/responses/getRequiredFieldsWithOneBaggage.xml
349
- - test/responses/getRequiredFieldsWithTwoBaggageSegments.xml
350
- - test/responses/getRequiredFieldsWithoutBaggage.xml
348
+ - test/responses/getRequiredFieldsWithOneLuggage.xml
349
+ - test/responses/getRequiredFieldsWithTwoLuggageSegments.xml
350
+ - test/responses/getRequiredFieldsWithoutLuggage.xml
351
351
  - test/responses/getTimeTable.xml
352
352
  - test/responses/getTripSeats-back-seats.xml
353
353
  - test/responses/getTripSeats-one-empty-segment.xml
@@ -1,19 +0,0 @@
1
- class Gillbus
2
- class Baggage
3
- extend Fields
4
-
5
- # => "0"
6
- field :segment_number, :int
7
-
8
- # => "true"
9
- field :is_buy, :bool
10
-
11
- # => "50.5"
12
- field :baggage_tariff, :decimal
13
-
14
- # => "2"
15
- field :baggage_limit, :int
16
-
17
- field :segments, [Baggage], key: 'SEGMENT'
18
- end
19
- end