gillbus 0.20.5 → 0.20.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gillbus.rb +1 -0
- data/lib/gillbus/get_required_fields.rb +1 -0
- data/lib/gillbus/structs/baggage.rb +19 -0
- data/lib/gillbus/version.rb +1 -1
- data/test/get_required_fields_test.rb +77 -0
- data/test/responses/getRequiredFieldsWithOneBaggage.xml +28 -0
- data/test/responses/getRequiredFieldsWithTwoBaggageSegments.xml +40 -0
- data/test/responses/getRequiredFieldsWithoutBaggage.xml +23 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c90e21289590b464d26988593ff4c98d6c4c3104558aa57b38c5940b198b901
|
4
|
+
data.tar.gz: b290a7a09612ab1ff28a77bf8ad39066f211e4b8e3b23aad0139b23bf45cb31a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7104cac3934fc6b6b64cfcc2baee8913c9fce8f4f351e6e8ccfae4ca7b8fddc23d78ac37bfe039e403beec2ffd0ff419a7ddbc6ef4fb6ea623b69052281045ea
|
7
|
+
data.tar.gz: 57a1a837c1268d0d43c2b93f81ac41d3412101512b09353e01b2d24ac54874dd38700ec752b2ef8ce7ec5691677d9c6d51157aa9d3fe3e4aee941e48cef5b69d
|
data/lib/gillbus.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
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
|
data/lib/gillbus/version.rb
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class GetRequiredFieldsTest < Minitest::Test
|
4
|
+
def get_required_fields_without_baggage
|
5
|
+
response_xml = File.read('test/responses/getRequiredFieldsWithoutBaggage.xml')
|
6
|
+
Gillbus::GetRequiredFields::Response.parse_string(response_xml)
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_required_fields_with_one_baggage
|
10
|
+
response_xml = File.read('test/responses/getRequiredFieldsWithOneBaggage.xml')
|
11
|
+
Gillbus::GetRequiredFields::Response.parse_string(response_xml)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_required_fields_with_two_baggage_segments
|
15
|
+
response_xml = File.read('test/responses/getRequiredFieldsWithTwoBaggageSegments.xml')
|
16
|
+
Gillbus::GetRequiredFields::Response.parse_string(response_xml)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_required_fields_without_baggage
|
20
|
+
result = get_required_fields_without_baggage
|
21
|
+
|
22
|
+
assert_nil result.baggage
|
23
|
+
|
24
|
+
dictionary = result.dictionary
|
25
|
+
assert_equal false, dictionary[:student_ticket]
|
26
|
+
assert_equal false, dictionary[:isic]
|
27
|
+
assert_equal false, dictionary[:tariff_short_name]
|
28
|
+
assert_equal false, dictionary[:tariff_cost]
|
29
|
+
assert_equal true, dictionary[:document_type]
|
30
|
+
assert_equal true, dictionary[:baggage_count]
|
31
|
+
assert_equal true, dictionary[:phone]
|
32
|
+
assert_equal true, dictionary[:mail]
|
33
|
+
assert_equal true, dictionary[:firstname]
|
34
|
+
assert_equal true, dictionary[:lastname]
|
35
|
+
assert_equal true, dictionary[:birthday]
|
36
|
+
assert_equal true, dictionary[:passport]
|
37
|
+
assert_equal true, dictionary[:citizenship]
|
38
|
+
assert_equal true, dictionary[:gender]
|
39
|
+
assert_equal true, dictionary[:visa]
|
40
|
+
assert_equal true, dictionary[:passdate]
|
41
|
+
assert_equal true, dictionary[:only_latin_symbols]
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_required_fields_with_one_baggage
|
45
|
+
result = get_required_fields_with_one_baggage
|
46
|
+
baggage = result.baggage
|
47
|
+
|
48
|
+
assert_equal true, baggage.is_buy
|
49
|
+
assert_equal 50.5, baggage.baggage_tariff
|
50
|
+
|
51
|
+
assert_equal [], baggage.segments
|
52
|
+
assert_nil baggage.segment_number
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_required_fields_with_two_baggage_segments
|
56
|
+
result = get_required_fields_with_two_baggage_segments
|
57
|
+
baggage = result.baggage
|
58
|
+
|
59
|
+
assert_nil baggage.is_buy
|
60
|
+
assert_nil baggage.baggage_tariff
|
61
|
+
assert_nil baggage.baggage_limit
|
62
|
+
|
63
|
+
assert_equal 2, baggage.segments.count
|
64
|
+
first_baggage_segment = baggage.segments[0]
|
65
|
+
second_baggage_segment = baggage.segments[1]
|
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
|
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
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<DATA>
|
2
|
+
<TIME_LIMIT>0</TIME_LIMIT>
|
3
|
+
<DICTIONARY>
|
4
|
+
<STUDENT_TICKET>false</STUDENT_TICKET>
|
5
|
+
<ISIC>false</ISIC>
|
6
|
+
<TARIFF_SHORT_NAME>false</TARIFF_SHORT_NAME>
|
7
|
+
<TARIFF_COST>false</TARIFF_COST>
|
8
|
+
<DOCUMENT_TYPE>true</DOCUMENT_TYPE>
|
9
|
+
<BAGGAGE_COUNT>true</BAGGAGE_COUNT>
|
10
|
+
<PHONE>true</PHONE>
|
11
|
+
<MAIL>true</MAIL>
|
12
|
+
<FIRSTNAME>true</FIRSTNAME>
|
13
|
+
<LASTNAME>true</LASTNAME>
|
14
|
+
<SECONDNAME>true</SECONDNAME>
|
15
|
+
<BIRTHDAY>true</BIRTHDAY>
|
16
|
+
<PASSPORT>true</PASSPORT>
|
17
|
+
<CITIZENSHIP>true</CITIZENSHIP>
|
18
|
+
<GENDER>true</GENDER>
|
19
|
+
<VISA>true</VISA>
|
20
|
+
<PASSDATE>true</PASSDATE>
|
21
|
+
<ONLY_LATIN_SYMBOLS>true</ONLY_LATIN_SYMBOLS>
|
22
|
+
</DICTIONARY>
|
23
|
+
<BAGGAGE>
|
24
|
+
<IS_BUY>true</IS_BUY>
|
25
|
+
<BAGGAGE_TARIFF>50.5</BAGGAGE_TARIFF>
|
26
|
+
<BAGGAGE_LIMIT>2</BAGGAGE_LIMIT>
|
27
|
+
</BAGGAGE>
|
28
|
+
</DATA>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<DATA>
|
2
|
+
<TIME_LIMIT>0</TIME_LIMIT>
|
3
|
+
<DICTIONARY>
|
4
|
+
<STUDENT_TICKET>false</STUDENT_TICKET>
|
5
|
+
<ISIC>false</ISIC>
|
6
|
+
<TARIFF_SHORT_NAME>false</TARIFF_SHORT_NAME>
|
7
|
+
<TARIFF_COST>false</TARIFF_COST>
|
8
|
+
<DOCUMENT_TYPE>true</DOCUMENT_TYPE>
|
9
|
+
<BAGGAGE_COUNT>true</BAGGAGE_COUNT>
|
10
|
+
<PHONE>true</PHONE>
|
11
|
+
<MAIL>true</MAIL>
|
12
|
+
<FIRSTNAME>true</FIRSTNAME>
|
13
|
+
<LASTNAME>true</LASTNAME>
|
14
|
+
<SECONDNAME>true</SECONDNAME>
|
15
|
+
<BIRTHDAY>true</BIRTHDAY>
|
16
|
+
<PASSPORT>true</PASSPORT>
|
17
|
+
<CITIZENSHIP>true</CITIZENSHIP>
|
18
|
+
<GENDER>true</GENDER>
|
19
|
+
<VISA>true</VISA>
|
20
|
+
<PASSDATE>true</PASSDATE>
|
21
|
+
<ONLY_LATIN_SYMBOLS>true</ONLY_LATIN_SYMBOLS>
|
22
|
+
</DICTIONARY>
|
23
|
+
<BAGGAGE>
|
24
|
+
<IS_BUY></IS_BUY>
|
25
|
+
<BAGGAGE_TARIFF></BAGGAGE_TARIFF>
|
26
|
+
<BAGGAGE_LIMIT></BAGGAGE_LIMIT>
|
27
|
+
<SEGMENT>
|
28
|
+
<SEGMENT_NUMBER>0</SEGMENT_NUMBER>
|
29
|
+
<IS_BUY>true</IS_BUY>
|
30
|
+
<BAGGAGE_TARIFF>70.7</BAGGAGE_TARIFF>
|
31
|
+
<BAGGAGE_LIMIT>2</BAGGAGE_LIMIT>
|
32
|
+
</SEGMENT>
|
33
|
+
<SEGMENT>
|
34
|
+
<SEGMENT_NUMBER>1</SEGMENT_NUMBER>
|
35
|
+
<IS_BUY>false</IS_BUY>
|
36
|
+
<BAGGAGE_TARIFF></BAGGAGE_TARIFF>
|
37
|
+
<BAGGAGE_LIMIT></BAGGAGE_LIMIT>
|
38
|
+
</SEGMENT>
|
39
|
+
</BAGGAGE>
|
40
|
+
</DATA>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<DATA>
|
2
|
+
<TIME_LIMIT>0</TIME_LIMIT>
|
3
|
+
<DICTIONARY>
|
4
|
+
<STUDENT_TICKET>false</STUDENT_TICKET>
|
5
|
+
<ISIC>false</ISIC>
|
6
|
+
<TARIFF_SHORT_NAME>false</TARIFF_SHORT_NAME>
|
7
|
+
<TARIFF_COST>false</TARIFF_COST>
|
8
|
+
<DOCUMENT_TYPE>true</DOCUMENT_TYPE>
|
9
|
+
<BAGGAGE_COUNT>true</BAGGAGE_COUNT>
|
10
|
+
<PHONE>true</PHONE>
|
11
|
+
<MAIL>true</MAIL>
|
12
|
+
<FIRSTNAME>true</FIRSTNAME>
|
13
|
+
<LASTNAME>true</LASTNAME>
|
14
|
+
<SECONDNAME>true</SECONDNAME>
|
15
|
+
<BIRTHDAY>true</BIRTHDAY>
|
16
|
+
<PASSPORT>true</PASSPORT>
|
17
|
+
<CITIZENSHIP>true</CITIZENSHIP>
|
18
|
+
<GENDER>true</GENDER>
|
19
|
+
<VISA>true</VISA>
|
20
|
+
<PASSDATE>true</PASSDATE>
|
21
|
+
<ONLY_LATIN_SYMBOLS>true</ONLY_LATIN_SYMBOLS>
|
22
|
+
</DICTIONARY>
|
23
|
+
</DATA>
|
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.
|
4
|
+
version: 0.20.6
|
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: 2019-
|
12
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -201,6 +201,7 @@ 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
|
204
205
|
- lib/gillbus/structs/bus_photo.rb
|
205
206
|
- lib/gillbus/structs/carrier.rb
|
206
207
|
- lib/gillbus/structs/commission.rb
|
@@ -239,6 +240,7 @@ files:
|
|
239
240
|
- test/get_countries_test.rb
|
240
241
|
- test/get_dates_new_test.rb
|
241
242
|
- test/get_order_ticket_test.rb
|
243
|
+
- test/get_required_fields_test.rb
|
242
244
|
- test/get_time_table_test.rb
|
243
245
|
- test/get_trip_seats_test.rb
|
244
246
|
- test/get_trip_segments_test.rb
|
@@ -255,6 +257,9 @@ files:
|
|
255
257
|
- test/responses/getCities.xml
|
256
258
|
- test/responses/getCountries.xml
|
257
259
|
- test/responses/getOrderTicket.xml
|
260
|
+
- test/responses/getRequiredFieldsWithOneBaggage.xml
|
261
|
+
- test/responses/getRequiredFieldsWithTwoBaggageSegments.xml
|
262
|
+
- test/responses/getRequiredFieldsWithoutBaggage.xml
|
258
263
|
- test/responses/getTimeTable.xml
|
259
264
|
- test/responses/getTripSeats-back-seats.xml
|
260
265
|
- test/responses/getTripSeats-one-empty-segment.xml
|
@@ -322,6 +327,7 @@ test_files:
|
|
322
327
|
- test/get_countries_test.rb
|
323
328
|
- test/get_dates_new_test.rb
|
324
329
|
- test/get_order_ticket_test.rb
|
330
|
+
- test/get_required_fields_test.rb
|
325
331
|
- test/get_time_table_test.rb
|
326
332
|
- test/get_trip_seats_test.rb
|
327
333
|
- test/get_trip_segments_test.rb
|
@@ -338,6 +344,9 @@ test_files:
|
|
338
344
|
- test/responses/getCities.xml
|
339
345
|
- test/responses/getCountries.xml
|
340
346
|
- test/responses/getOrderTicket.xml
|
347
|
+
- test/responses/getRequiredFieldsWithOneBaggage.xml
|
348
|
+
- test/responses/getRequiredFieldsWithTwoBaggageSegments.xml
|
349
|
+
- test/responses/getRequiredFieldsWithoutBaggage.xml
|
341
350
|
- test/responses/getTimeTable.xml
|
342
351
|
- test/responses/getTripSeats-back-seats.xml
|
343
352
|
- test/responses/getTripSeats-one-empty-segment.xml
|