go_transit 0.7.1 → 0.8.0

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
  SHA256:
3
- metadata.gz: 98ee1b80052d6bb23fc218ea1ff8a49c006a12a2b872d91e93a307641bcef780
4
- data.tar.gz: e02f5adbf916b559cff5789f6bea69533423dc4d8e4caeb393059762ca5c4418
3
+ metadata.gz: 75a803314654232e17915c91c0af5859985172cbeb8c7851377d4e3128bbabc9
4
+ data.tar.gz: '09fbe1f8b08c6ea2d00e5a0c212fda686196a7a00bb4c3fd826d6f7732702acc'
5
5
  SHA512:
6
- metadata.gz: b818cac20f3cba3a4e754b017c25888d7962c9d4e6ce0b89f8a53aca87d23e2356c8e0e15d1f2202481b16247e4696947600f6de7229ca14a5149c8d7c014e02
7
- data.tar.gz: b5fabef81e31a9b962ee701ddf311810af8686edd25a08d5808bed3396f30742bd58c0fd4e51d97cd63f6b7d94ae497f31a4e17be496fb7c8494da41f3ddcf0e
6
+ metadata.gz: d686899e0198bcc3c32d8d38de9fa4f399d25da29b71dd491bde54b6e9c6cada64ea1afd8f2da6fb8aa293ff5172964378da32ba11f49f73bce6a269d57c0344
7
+ data.tar.gz: 9e86b72905dcd6c23460669a6d0dbd59df940ef94ea2a858a3300fe3e3bb56f8e0f4d2bf08e65ab6c19b74f427205ad06ff6994817e6263cbfbc75ef466c48da
@@ -40,5 +40,9 @@ module GoTransit
40
40
  key, data = value.first
41
41
  data.kind_of?(Array)
42
42
  end
43
+
44
+ def to_utc(date)
45
+ date.in_time_zone("America/Toronto").utc
46
+ end
43
47
  end
44
48
  end
@@ -5,5 +5,9 @@ module GoTransit
5
5
  def code
6
6
  error_code.to_i
7
7
  end
8
+
9
+ def time_stamp_utc
10
+ to_utc(time_stamp)
11
+ end
8
12
  end
9
13
  end
@@ -6,4 +6,4 @@ module GoTransit
6
6
  is_major.to_i.positive?
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -1,9 +1,17 @@
1
1
  module GoTransit
2
2
  class Schedule::Journey::SchJourney::Service < ApiResource
3
- attr_accessor :colour, :type, :direction, :code, :start_time, :end_time,
3
+ attr_accessor :colour, :type, :direction, :code, :start_time, :end_time,
4
4
  :duration, :accessible, :trips, :transfers, :links,
5
5
  :start_sort_time, :end_sort_time, :trip_hash, :transfer_count
6
6
 
7
7
  alias :transfer_links :links
8
+
9
+ def start_time_utc
10
+ to_utc(start_time)
11
+ end
12
+
13
+ def end_time_utc
14
+ to_utc(end_time)
15
+ end
8
16
  end
9
- end
17
+ end
@@ -1,5 +1,13 @@
1
1
  module GoTransit
2
2
  class Schedule::Trip::Stop::ArrivalTime < ApiResource
3
3
  attr_accessor :scheduled, :computed, :status
4
+
5
+ def scheduled_utc
6
+ to_utc(scheduled)
7
+ end
8
+
9
+ def computed_utc
10
+ to_utc(computed)
11
+ end
4
12
  end
5
- end
13
+ end
@@ -1,5 +1,13 @@
1
1
  module GoTransit
2
2
  class Schedule::Trip::Stop::DepartureTime < ApiResource
3
3
  attr_accessor :scheduled, :computed, :status
4
+
5
+ def scheduled_utc
6
+ to_utc(scheduled)
7
+ end
8
+
9
+ def computed_utc
10
+ to_utc(computed)
11
+ end
4
12
  end
5
- end
13
+ end
@@ -1,6 +1,6 @@
1
1
  module GoTransit
2
2
  class Schedule::Trip::Stop < ApiResource
3
- attr_accessor :arrival_time, :departure_time, :track, :code, :status,
3
+ attr_accessor :arrival_time, :departure_time, :track, :code, :status,
4
4
  :remark
5
5
  end
6
- end
6
+ end
@@ -2,5 +2,9 @@ module GoTransit
2
2
  class Schedule::Trip < ApiResource
3
3
  attr_accessor :number, :destination, :longitude, :latitude, :status,
4
4
  :time_stamp, :stops
5
+
6
+ def time_stamp_utc
7
+ to_utc(time_stamp)
8
+ end
5
9
  end
6
- end
10
+ end
@@ -8,7 +8,11 @@ module GoTransit
8
8
  :modified_date, :occupancy_percentage
9
9
 
10
10
  def in_motion?
11
- is_in_motion.to_i.positive?
11
+ is_in_motion
12
+ end
13
+
14
+ def modified_date_utc
15
+ to_utc(modified_date)
12
16
  end
13
17
  end
14
- end
18
+ end
@@ -16,4 +16,4 @@ module GoTransit
16
16
  is_override.to_i.positive?
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -3,5 +3,9 @@ module GoTransit
3
3
  attr_accessor :code, :parent_code, :status, :posted_date_time,
4
4
  :subject_english, :subject_french, :body_english,
5
5
  :body_french, :category, :sub_category, :lines, :stops, :trips
6
+
7
+ def posted_date_time_utc
8
+ to_utc(posted_date_time)
9
+ end
6
10
  end
7
11
  end
@@ -6,5 +6,9 @@ module GoTransit
6
6
  def platforms
7
7
  platform.split("&").collect(&:strip)
8
8
  end
9
+
10
+ def time_utc
11
+ to_utc(time)
12
+ end
9
13
  end
10
14
  end
@@ -1,10 +1,22 @@
1
1
  module GoTransit
2
2
  class Stop::NextService::Line < ApiResource
3
- attr_accessor :stop_code, :line_code, :line_name, :service_type,
4
- :direction_code, :direction_name,
3
+ attr_accessor :stop_code, :line_code, :line_name, :service_type,
4
+ :direction_code, :direction_name,
5
5
  :scheduled_departure_time, :computed_departure_time,
6
6
  :departure_status, :scheduled_platform, :actual_platform,
7
- :trip_order, :trip_number, :update_time, :status,
7
+ :trip_order, :trip_number, :update_time, :status,
8
8
  :latitude, :longitude
9
+
10
+ def scheduled_departure_time_utc
11
+ to_utc(scheduled_departure_time)
12
+ end
13
+
14
+ def computed_departure_time_utc
15
+ to_utc(computed_departure_time)
16
+ end
17
+
18
+ def update_time_utc
19
+ to_utc(update_time)
20
+ end
9
21
  end
10
- end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module GoTransit
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_transit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Mazur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2023-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.17'
125
+ - !ruby/object:Gem::Dependency
126
+ name: timecop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description:
126
140
  email:
127
141
  executables: []
@@ -184,7 +198,7 @@ files:
184
198
  - lib/go_transit/resources/stop/station.rb
185
199
  - lib/go_transit/response.rb
186
200
  - lib/go_transit/version.rb
187
- homepage: https://github.com/jmazur/go-transit-ruby
201
+ homepage: https://github.com/jmazur/go_transit_ruby
188
202
  licenses:
189
203
  - MIT
190
204
  metadata: {}