gillbus 0.16.6 → 0.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59ba7f74bfb1405a3b0534c05f21836f7bd06cdf
4
- data.tar.gz: 44c2488a9950d8ab972069e30ef4737e5ba9c06c
3
+ metadata.gz: dfd0ac869d9d605b0344ae93bc7c0f26c8dce47a
4
+ data.tar.gz: c625a743ef866ce2cdd2671696afca22b29c396b
5
5
  SHA512:
6
- metadata.gz: f18105410cc98948f506a8db5ed5922332548ad12b58d2db56c56a7d4f466ab67ff483f3736cfe57b581505696da66a46ed1233dc8761ceb5687edc404457a09
7
- data.tar.gz: a234a9ba1c3c4e451dbf099f98bdc275ae07e7af34061c4feb57cb02e2646a7d87d2b15d329c11ccb4efe14bbf8da0035c8a81b682bed6c111b1a957d4169caa
6
+ metadata.gz: 857e79e6e0b3865f781693b3ad69cde047afacb98a344b2419348f25facfe3fd1ed3898012de843688c6ab2281bacdce2aa2da489688f6527d1d4eec3b079145
7
+ data.tar.gz: f7b1c07c2cef34801f585b497069228c10f144a766d2a2ccc829079cce93fcdfcc07bf89ee85293e3727ae3cdd2afbbd2182ff1a07413e7c09bb39d092521af1
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ require 'rake/testtask'
4
4
  Rake::TestTask.new do |t|
5
5
  t.libs << 'test'
6
6
  t.pattern = "test/*_test.rb"
7
+ t.warning = false
7
8
  end
8
9
 
9
10
  task :default => :test
@@ -38,9 +38,15 @@ class Gillbus
38
38
  # => "22:50"
39
39
  field :start_time, :time
40
40
 
41
+ # => "Europe/Moscow"
42
+ field :start_timezone
43
+
41
44
  # => "08:00"
42
45
  field :end_time, :time
43
46
 
47
+ # => "Europe/Kiev"
48
+ field :end_timezone
49
+
44
50
  # => "Сетра S 315 НDH"
45
51
  field :bus_model
46
52
 
@@ -140,7 +146,9 @@ class Gillbus
140
146
  field :options, TripOptions, key: 'OPTIONS'
141
147
 
142
148
  def start_at
143
- ActiveSupport::TimeZone["Europe/Kiev"].parse("#{data["START_DATE"]} #{data["START_TIME"]}")
149
+ timezone = data['START_TIMEZONE'] || 'Europe/Kiev'
150
+ datetime_string = "#{data['START_DATE']} #{data['START_TIME']}"
151
+ ActiveSupport::TimeZone[timezone].parse(datetime_string)
144
152
  end
145
153
 
146
154
  parser do
@@ -160,7 +160,9 @@ class Gillbus
160
160
  field :options, TripOptions, key: 'OPTIONS'
161
161
 
162
162
  def start_at
163
- ActiveSupport::TimeZone["Europe/Kiev"].parse("#{data["START_DATE"]} #{data["START_TIME"]}")
163
+ timezone = data['START_TIMEZONE'] || 'Europe/Kiev'
164
+ datetime_string = "#{data['START_DATE']} #{data['START_TIME']}"
165
+ ActiveSupport::TimeZone[timezone].parse(datetime_string)
164
166
  end
165
167
 
166
168
  parser do
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = "0.16.6"
2
+ VERSION = "0.16.7"
3
3
  end
@@ -98,6 +98,16 @@ class SearchTripsResponseTest < Minitest::Test
98
98
  assert_equal 'http://example.com/123', response.trips.first.redirect_url
99
99
  end
100
100
 
101
+ def test_start_at_parsing
102
+ response = get_successful_search_trips
103
+
104
+ trip1_start_at = ActiveSupport::TimeZone['Europe/Moscow'].parse('23.08.2014 19:00')
105
+ trip2_start_at = ActiveSupport::TimeZone['Europe/Kiev'].parse('23.08.2014 21:10')
106
+
107
+ assert_equal trip1_start_at, response.trips[0].start_at
108
+ assert_equal trip2_start_at, response.trips[1].start_at
109
+ end
110
+
101
111
  def test_options_parsing
102
112
  response = get_successful_search_trips
103
113
  options = response.trips.first.options
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.16.6
4
+ version: 0.16.7
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-11-09 00:00:00.000000000 Z
12
+ date: 2017-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_xml