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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1f9c1f664641532022e161da84efda95e922158
4
- data.tar.gz: 766f12829e5cd9c73da4c68ae71dc37460cc07c1
3
+ metadata.gz: d57a0b689c5f11218c4bb5189c1493646d577718
4
+ data.tar.gz: eb0a3092834e8416ff3386caf86d13a04ec79371
5
5
  SHA512:
6
- metadata.gz: 37cbb7cc1895c820d3ca9aced318b7c5fbb862e6e5b7a0473b7767f0a9360e310e6b7d188f4ee07f1a9bfc1657d285b397da52ad37619b88cb30e191a53a1df6
7
- data.tar.gz: ac9a90945e9dabe5a62c0b483476a98a504c22c84549f8e9c588c4050fc617ef698bf8c7bb5bb1f28ed9197fd85593dd450b1c819f9d03ee94b2ce7bf0d941e0
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = "0.14.3"
2
+ VERSION = "0.14.4"
3
3
  end
@@ -97,6 +97,10 @@
97
97
  <DISPATCH_TIME/>
98
98
  <CHECK_POINT>false</CHECK_POINT>
99
99
  </POINT>
100
+ <OPTIONS>
101
+ <OPTION>Кофе</OPTION>
102
+ <OPTION>Wi-Fi</OPTION>
103
+ </OPTIONS>
100
104
  </TRIP>
101
105
  <TRIP>
102
106
  <ID>-3986171261205069729</ID>
@@ -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.3
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-04-13 00:00:00.000000000 Z
12
+ date: 2017-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_xml