gillbus 0.14.3 → 0.14.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gillbus/helpers/fields.rb +2 -2
- data/lib/gillbus/helpers/parser.rb +4 -2
- data/lib/gillbus/structs/trip.rb +2 -0
- data/lib/gillbus/version.rb +1 -1
- data/test/responses/searchTrips-prod.xml +4 -0
- data/test/search_trips_test.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d57a0b689c5f11218c4bb5189c1493646d577718
|
4
|
+
data.tar.gz: eb0a3092834e8416ff3386caf86d13a04ec79371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f641884fc5ab6c4764c5c252cd530fbf1cb8583871aef9a27e73421744cf3069f413bf253ee8d12a4831d25c73e9502a05c9415319293c7c70267672cf6a1aaa
|
7
|
+
data.tar.gz: 469a792ff28013ecd4177c91831bf9e19bc28140a67fdbb6add44d048d971c7aaa4b3b7f52b2e124ad63059844e390f2ac4739b94ea558693239e7fa2560b1e8
|
@@ -41,8 +41,8 @@ class Gillbus
|
|
41
41
|
@fields ||= []
|
42
42
|
end
|
43
43
|
|
44
|
-
def field(name, type=:string, key: name.to_s.upcase)
|
45
|
-
field_definitions << {name: name, key: key, type: type}
|
44
|
+
def field(name, type=:string, key: name.to_s.upcase, root: nil)
|
45
|
+
field_definitions << {name: name, key: key, type: type, root: root}
|
46
46
|
attr_accessor name
|
47
47
|
end
|
48
48
|
|
@@ -15,10 +15,12 @@ class Gillbus
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def parse
|
18
|
-
fields.each do |name:, key:, type:|
|
18
|
+
fields.each do |name:, key:, type:, root:|
|
19
19
|
raw_value =
|
20
20
|
if key.is_a?(Regexp)
|
21
21
|
doc.select { |k| k =~ key }
|
22
|
+
elsif root
|
23
|
+
doc[root] && doc[root][key]
|
22
24
|
else
|
23
25
|
doc[key]
|
24
26
|
end
|
@@ -97,4 +99,4 @@ class Gillbus
|
|
97
99
|
end
|
98
100
|
|
99
101
|
end
|
100
|
-
end
|
102
|
+
end
|
data/lib/gillbus/structs/trip.rb
CHANGED
@@ -146,6 +146,8 @@ class Gillbus
|
|
146
146
|
|
147
147
|
field :segments, [Segment], key: "SEGMENT"
|
148
148
|
|
149
|
+
field :options, [:string], root: 'OPTIONS', key: 'OPTION'
|
150
|
+
|
149
151
|
def start_at
|
150
152
|
ActiveSupport::TimeZone["Europe/Kiev"].parse("#{data["START_DATE"]} #{data["START_TIME"]}")
|
151
153
|
end
|
data/lib/gillbus/version.rb
CHANGED
data/test/search_trips_test.rb
CHANGED
@@ -80,6 +80,7 @@ class SearchTripsResponseTest < Minitest::Test
|
|
80
80
|
assert_equal 'Europe/Moscow', response.trips.first.start_timezone
|
81
81
|
assert_equal 'Europe/Moscow', response.trips.first.end_timezone
|
82
82
|
assert_equal true, response.trips.first.fake_time_in_road
|
83
|
+
assert_equal ['Кофе', 'Wi-Fi'], response.trips.first.options
|
83
84
|
end
|
84
85
|
|
85
86
|
def test_faking_response
|
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.14.
|
4
|
+
version: 0.14.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-
|
12
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_xml
|