transilien_realtime 0.2.0 → 0.3.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/transilien_realtime/base.rb +1 -0
- data/lib/transilien_realtime/train.rb +4 -1
- data/lib/transilien_realtime/version.rb +1 -1
- 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: 68916028ace3035309227b7bb2fac604e37497d9
|
4
|
+
data.tar.gz: 963924a58bc4476cd0a78d6a1bf96a2f0f7fe6e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c581c1271e4b311fd0ecfd91607d58e5c44507ee93551572cc07722065271149455581f64174e6e7b4930a7009e88cff264fbbea2f2adc77106b72689da25936
|
7
|
+
data.tar.gz: e4a23f26ae73195a6ba89cfe65f4fc67eb12d9372bf27799814f1b71f52e3362d72fef4c1a416d0f215d1b5a0c1a646f22eff102bfe4f166651cafed7191249a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -41,6 +41,10 @@ tr.trains
|
|
41
41
|
=> [#<TransilienRealtime::Train:0x007f945dcc4770 @departure_at=2015-05-15 16:12:00 +0200, @mission="MOCA", @numero="136891", @terminus="87381509">]
|
42
42
|
```
|
43
43
|
|
44
|
+
Important note about Train#departure_at:
|
45
|
+
|
46
|
+
Since the API doesn't give a timezone and that Europe/Paris offset change according to DST, there's no way to provide a correct Time instance after parsing this partial Date. As a workaround, the time is parsed "as if" and forced into a fake DST, so you can easily shift the date into a timezone of your concern.
|
47
|
+
|
44
48
|
## Development
|
45
49
|
|
46
50
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -68,6 +68,7 @@ module TransilienRealtime
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def fetch(request)
|
71
|
+
@trains = nil # destroy cache
|
71
72
|
@response = HTTP.basic_auth(user: @user, pass: @pwd).headers(accept: ACCEPT_STRINGS[API_VERSION]).get(request)#.body
|
72
73
|
@body = @response.body
|
73
74
|
@content = @body.readpartial
|
@@ -1,4 +1,7 @@
|
|
1
1
|
module TransilienRealtime
|
2
|
+
# Important note about attribute departure_at:
|
3
|
+
# Since it's not possible to have a Time instance w/o timezone, and Europe/Paris change its offset w/ DST,
|
4
|
+
# lie by forcing a false UTC hours
|
2
5
|
class Train
|
3
6
|
include Comparable
|
4
7
|
|
@@ -31,7 +34,7 @@ module TransilienRealtime
|
|
31
34
|
def initialize(mission:, departure_at:, terminus:, numero:, mode:, state: nil)
|
32
35
|
@mission = mission
|
33
36
|
@numero = numero
|
34
|
-
@departure_at =
|
37
|
+
@departure_at = Time.strptime(departure_at + ' +0000', '%d/%m/%Y %H:%M %z')
|
35
38
|
@terminus = terminus
|
36
39
|
@mode = MODES[mode]
|
37
40
|
@state = STATES[state]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transilien_realtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Lecavelier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|