gillbus 0.15.3 → 0.15.4

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: c9ec4d134411b18ab82dd204351755d9134dc460
4
- data.tar.gz: 1c5e9497ad029d1e971b4d18b2ea5e0c5c4c0982
3
+ metadata.gz: 65defff51439efea9789ea6e456bdc01528377c0
4
+ data.tar.gz: 588b997611fcf1a1ce5d0baaa2d686f736cd0a5c
5
5
  SHA512:
6
- metadata.gz: 3e49925f4ff7ee27596134884339f222a0f15519c6edd4fc3943a1986250599e90d7a3a4e3440ab826eeb980c76b748d57382105696344060119e13959370de1
7
- data.tar.gz: d340113730b7092c07e3ab2d12b3fd42e7da88f0a40c2100a57540e385c0e87f75d3eff32ba592bfa5f7edda00200122b89823d2063ec207f116d680b95da917
6
+ metadata.gz: '08f4beb09430e0b53a2da5309dea506d71fbe6aba637de44e988068a6a88f7c0b50ae950de4e469cd694f86837bcf62b02f657ba59a4414a54120b2e004834ef'
7
+ data.tar.gz: 1f8601ed9bc4eb824fb174bc7b3f0529fb59848805c252a83827409577004df9f1325849e38ac618859e7ecc516245bb93c472f593fdacbbe5e1d90bd32b9ca8
@@ -44,6 +44,7 @@ class Gillbus
44
44
  require 'gillbus/structs/trip_service'
45
45
  require 'gillbus/structs/trip_options'
46
46
  require 'gillbus/structs/point'
47
+ require 'gillbus/structs/tariff/return_cause'
47
48
  require 'gillbus/structs/tariff'
48
49
  require 'gillbus/structs/segment'
49
50
  require 'gillbus/structs/timetable_segment'
@@ -44,7 +44,7 @@ class Gillbus
44
44
  field :passenger_student_ticket
45
45
 
46
46
  # => "..."
47
- field :return_cause, :string_with_possible_attributes
47
+ field :return_cause, [ReturnCause]
48
48
 
49
49
  # => "66.61"
50
50
  field :note
@@ -66,6 +66,5 @@ class Gillbus
66
66
  end
67
67
  end
68
68
  end
69
-
70
69
  end
71
70
  end
@@ -0,0 +1,25 @@
1
+ class Gillbus
2
+ class Tariff
3
+ class ReturnCause
4
+
5
+ extend Fields
6
+ include UpdateAttrs
7
+
8
+ field :lossless, :bool
9
+
10
+ field :cause, :string
11
+
12
+ def self.parse(doc)
13
+ instance = super
14
+ if doc.kind_of? Hash
15
+ instance.cause = doc['__content__']
16
+ instance.lossless = doc['lossless'] == 'true'
17
+ else
18
+ instance.cause = doc
19
+ instance.lossless = false
20
+ end
21
+ instance
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = "0.15.3"
2
+ VERSION = "0.15.4"
3
3
  end
@@ -54,8 +54,9 @@
54
54
  <PASSENGER_BIRTHDAY/>
55
55
  <PASSENGER_ISIC_NUMBER/>
56
56
  <PASSENGER_STUDENT_TICKET/>
57
- <RETURN_CAUSE>cause 1</RETURN_CAUSE>
57
+ <RETURN_CAUSE lossless='true'>cause 1</RETURN_CAUSE>
58
58
  <RETURN_CAUSE id='asdasd'>cause 2</RETURN_CAUSE>
59
+ <RETURN_CAUSE>cause 3</RETURN_CAUSE>
59
60
  </TARIFF>
60
61
  <POINT>
61
62
  <NUMBER>0</NUMBER>
@@ -91,8 +91,9 @@ class SearchTripsResponseTest < Minitest::Test
91
91
  assert_equal true, response.trips.first.fake_time_in_road
92
92
  assert_equal false, response.trips[1].recommended
93
93
  assert_equal true, response.trips.first.recommended
94
- assert_equal ['cause 1', 'cause 2'], response.trips.first.tariffs.first.return_cause
95
- assert_equal ['cause 1'], response.trips[1].tariffs.first.return_cause
94
+ assert_equal ['cause 1', 'cause 2', 'cause 3'], response.trips.first.tariffs.first.return_cause.map(&:cause)
95
+ assert_equal [true, false, false], response.trips.first.tariffs.first.return_cause.map(&:lossless)
96
+ assert_equal ['cause 1'], response.trips[1].tariffs.first.return_cause.map(&:cause)
96
97
  assert_equal true, response.trips[1].tariffs.first.is_exclusive_price
97
98
  end
98
99
 
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.15.3
4
+ version: 0.15.4
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: 2017-08-29 00:00:00.000000000 Z
12
+ date: 2017-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_xml
@@ -190,6 +190,7 @@ files:
190
190
  - lib/gillbus/structs/seat.rb
191
191
  - lib/gillbus/structs/segment.rb
192
192
  - lib/gillbus/structs/tariff.rb
193
+ - lib/gillbus/structs/tariff/return_cause.rb
193
194
  - lib/gillbus/structs/ticket.rb
194
195
  - lib/gillbus/structs/timetable_segment.rb
195
196
  - lib/gillbus/structs/timetable_trip.rb
@@ -311,3 +312,4 @@ test_files:
311
312
  - test/session_login_test.rb
312
313
  - test/test_helper.rb
313
314
  - test/tickets_booking_test.rb
315
+ has_rdoc: