ierail 0.3 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +38 -0
- data/LICENSE.txt +15 -0
- data/README.md +68 -0
- data/Rakefile +9 -0
- data/ierail.gemspec +14 -0
- data/lib/core_ext.rb +21 -0
- data/lib/ierail.rb +4 -1
- data/lib/station_data.rb +1 -1
- data/main.rb +31 -0
- data/test/unit/helper.rb +8 -0
- data/test/unit/ierail.rb +53 -0
- data/test/unit/station.rb +43 -0
- data/test/unit/station_data.rb +82 -0
- data/test/unit/train.rb +46 -0
- metadata +80 -34
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2ZmNzc1ZDRiZGIwMjkzZDc2Mjc1N2Y4MDM1MDhjNGZjMTRiNGFmZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2I0NWVhZDU0M2E3YTAwMWNjOTc2YmJlYzNhMDVmMjc4YzM3MTZlOA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjkwOWVmNTE2YzQ3NTEzZTQ0ZDhlNTliYzdmYWM1M2MyYjFjNDZjNTM2MDQy
|
10
|
+
OWRlYzFkZGMxZWY3NTRmYTU0ZWNmYTc3OGExNGZiNzIxNTY2YjBiYjk4ZDBj
|
11
|
+
NDJjMDg1NjM4N2IwODBlNjcwNDE5YjM2OTAzYmI0Y2EyMDM5ZTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTg1OTI0NTdiMmU1MGEzMzk5NmI0YjM3NTlhMDMzNjlhYzIwM2M2ZTFmMWMz
|
14
|
+
ZTE3MTA1YWJiZjAxNTRmNDhhZGU5MGQ0MWRmNjUzOWUxMDBlOWI0YjczOGMx
|
15
|
+
ZjcxYmZhMzFmZGY1ZDdlYWZhZGJmNTYxYjgxZTRhOTg2MTdjNTQ=
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service: travis_ci
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
coverage
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ierail (0.3)
|
5
|
+
json (~> 1.7.7)
|
6
|
+
nokogiri (~> 1.5.0)
|
7
|
+
rest-client (~> 1.6.7)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
colorize (0.5.8)
|
13
|
+
coveralls (0.6.6)
|
14
|
+
colorize
|
15
|
+
multi_json (~> 1.3)
|
16
|
+
rest-client
|
17
|
+
simplecov (>= 0.7)
|
18
|
+
thor
|
19
|
+
json (1.7.7)
|
20
|
+
mime-types (1.23)
|
21
|
+
multi_json (1.7.3)
|
22
|
+
nokogiri (1.5.9)
|
23
|
+
rake (10.0.4)
|
24
|
+
rest-client (1.6.7)
|
25
|
+
mime-types (>= 1.16)
|
26
|
+
simplecov (0.7.1)
|
27
|
+
multi_json (~> 1.0)
|
28
|
+
simplecov-html (~> 0.7.1)
|
29
|
+
simplecov-html (0.7.1)
|
30
|
+
thor (0.18.1)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
coveralls
|
37
|
+
ierail!
|
38
|
+
rake
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Oisin Hurley
|
2
|
+
2012
|
3
|
+
|
4
|
+
In the original BSD license, both occurrences of the phrase "COPYRIGHT HOLDERS AND CONTRIBUTORS" in the disclaimer read "REGENTS AND CONTRIBUTORS".
|
5
|
+
|
6
|
+
Here is the license template:
|
7
|
+
|
8
|
+
Copyright (c) 2012, Oisin Hurley
|
9
|
+
All rights reserved.
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
12
|
+
|
13
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
14
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/oisin/ierail.png?branch=master)](https://travis-ci.org/oisin/ierail)
|
2
|
+
[![Coverage Status](https://coveralls.io/repos/oisin/ierail/badge.png?branch=master)](https://coveralls.io/r/oisin/ierail)
|
3
|
+
|
4
|
+
## Irish Rail API Ruby Wrapper
|
5
|
+
|
6
|
+
I wrote most of this on the train, as is appropriate.
|
7
|
+
|
8
|
+
It's a trivial wrapper for the Irish Rail real time (whut?) train times system, in Ruby. It uses the HTTP GET API that was thankfully supplied along with the more *interesting* SOAP API, so a tiddly simple set up with [RestClient](https://github.com/archiloque/rest-client) and [Nokogiri](http://nokogiri.org/) (two of my favourite things ever) to pull and process the XML data into Hashes for great value.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
### Grab the IERail gem
|
13
|
+
|
14
|
+
|
15
|
+
`$ gem install ierail`
|
16
|
+
|
17
|
+
<pre><code>require 'ierail'
|
18
|
+
|
19
|
+
ir = IERail.new
|
20
|
+
</code></pre>
|
21
|
+
|
22
|
+
### Find all Southbound trains serving Clongriffin station
|
23
|
+
|
24
|
+
<pre><code>trains = ir.southbound_from('clongriffin')</code></pre>
|
25
|
+
|
26
|
+
### Find all trains serving Clongriffin in the next 30 minutes
|
27
|
+
|
28
|
+
<pre><code>trains = ir.station_times('clongriffin', 30)
|
29
|
+
|
30
|
+
trains.each { |t| puts t.inspect }
|
31
|
+
</code></pre>
|
32
|
+
|
33
|
+
### Find all Northbound trains serving Clongriffin before / after a certain time
|
34
|
+
|
35
|
+
<pre><code>trains = ir.northbound_from('clongriffin').after('HH:MM')
|
36
|
+
trains = ir.northbound_from('clongriffin').before('HH:MM')
|
37
|
+
</code></pre>
|
38
|
+
|
39
|
+
NB: "HH:MM" must be soon, as the API, by default, returns upcoming
|
40
|
+
arrivals
|
41
|
+
|
42
|
+
### Find all Southbound trains from Malahide in the next N minutes
|
43
|
+
|
44
|
+
<pre><code>trains = ir.southbound_from('malahide').in(N)
|
45
|
+
</code></pre>
|
46
|
+
|
47
|
+
### Find out information for a specific train
|
48
|
+
|
49
|
+
<pre><code>trains = ir.station('clongriffin', 60)
|
50
|
+
|
51
|
+
trains.first.last_location # "Arrived Harmonstown"
|
52
|
+
|
53
|
+
trains.first.origin # {:name=>"Greystones", :time=>"07:30"}
|
54
|
+
|
55
|
+
trains.first.destination # {:name=>"Malahide", :time=>"08:49"}
|
56
|
+
|
57
|
+
trains.first.arrival # {:scheduled=>"08:40", :expected=>"08:41"}
|
58
|
+
|
59
|
+
trains.first.departure # {:scheduled=>"08:41", :expected=>"08:41"}
|
60
|
+
|
61
|
+
trains.first.duein # "2"
|
62
|
+
|
63
|
+
trains.first.late? # 0 || 1
|
64
|
+
</code></pre>
|
65
|
+
|
66
|
+
Check the **main.rb** for additional usage.
|
67
|
+
|
68
|
+
Pull requests welcome, because there's damn all in it at the moment. Please accompany the pull request with an appropriate test.
|
data/Rakefile
ADDED
data/ierail.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'ierail'
|
3
|
+
s.version = '0.3.2'
|
4
|
+
s.date = Date.today.to_s
|
5
|
+
s.summary = "Irish Rail Train Schedule and Status API"
|
6
|
+
s.description = "Irish Rail Train Schedule and Status API"
|
7
|
+
s.authors = ["Oisin Hurley", "Gary Rafferty"]
|
8
|
+
s.email = 'oi.sin@nis.io'
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.homepage = 'http://rubygems.org/gems/ierail'
|
11
|
+
s.add_dependency 'nokogiri', '~> 1.5.0'
|
12
|
+
s.add_dependency 'rest-client', '~> 1.6.7'
|
13
|
+
s.add_dependency 'json', '~> 1.7.7'
|
14
|
+
end
|
data/lib/core_ext.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
class Array
|
2
|
+
#Filters elements, collecting those
|
3
|
+
#whose times are before _time_
|
4
|
+
def before time
|
5
|
+
select {|t| Time.parse(t.expdepart) <= Time.parse(time) }
|
6
|
+
end
|
7
|
+
|
8
|
+
#Filters elements, collecting those
|
9
|
+
#whose times are after _time_
|
10
|
+
def after time
|
11
|
+
select {|t| Time.parse(t.expdepart) >= Time.parse(time) }
|
12
|
+
end
|
13
|
+
|
14
|
+
# The 'in' is just sugar really, saving the
|
15
|
+
# programmer from doing a trivial computation
|
16
|
+
# over and over again in their code.
|
17
|
+
def in time
|
18
|
+
future_time = Time.now + (time * 60)
|
19
|
+
before "#{future_time.hour}:#{future_time.min}"
|
20
|
+
end
|
21
|
+
end
|
data/lib/ierail.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'nokogiri'
|
3
|
+
require 'uri'
|
4
|
+
require 'time'
|
3
5
|
|
4
6
|
require 'train'
|
5
7
|
require 'station'
|
6
8
|
require 'station_data'
|
9
|
+
require 'core_ext'
|
7
10
|
|
8
11
|
class IERail
|
9
12
|
|
@@ -14,7 +17,7 @@ class IERail
|
|
14
17
|
attr_reader :result
|
15
18
|
|
16
19
|
def initialize(url, array_name, object_name)
|
17
|
-
@ws_url = url
|
20
|
+
@ws_url = URI.encode(url)
|
18
21
|
@ws_array_name = array_name.downcase
|
19
22
|
@ws_object_name = object_name.downcase
|
20
23
|
end
|
data/lib/station_data.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class StationData
|
2
2
|
attr_reader :servertime, :traincode, :station_name, :station_code,
|
3
3
|
:status, :last_location, :duein, :late,
|
4
|
-
:train_type, :direction, :query_time, :train_date
|
4
|
+
:train_type, :direction, :query_time, :train_date, :expdepart
|
5
5
|
|
6
6
|
def initialize hash
|
7
7
|
@servertime = hash['Servertime']
|
data/main.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), "lib"))
|
2
|
+
|
3
|
+
require 'ierail'
|
4
|
+
|
5
|
+
ir = IERail.new
|
6
|
+
|
7
|
+
# List all the stations in the system
|
8
|
+
#
|
9
|
+
# puts ir.stations.sample.name
|
10
|
+
|
11
|
+
# List all of the trains that are buzzing around at the moment
|
12
|
+
# and what they are up to
|
13
|
+
#
|
14
|
+
# puts ir.trains.sample.direction
|
15
|
+
|
16
|
+
# What's the story out in Glenageary station?
|
17
|
+
#
|
18
|
+
# puts ir.station("Glenageary").sample.arrival[:expected]
|
19
|
+
|
20
|
+
# Trains due in and out of Glenageary in the next 30 minutes
|
21
|
+
#
|
22
|
+
# puts ir.station_times("Glenageary", 30).sample.late?
|
23
|
+
|
24
|
+
# Find stations that match the string partial
|
25
|
+
#
|
26
|
+
stations = ir.find_station("gl")
|
27
|
+
|
28
|
+
candidates = []
|
29
|
+
stations.each { |ks| candidates << ks.name }
|
30
|
+
|
31
|
+
puts candidates.inspect
|
data/test/unit/helper.rb
ADDED
data/test/unit/ierail.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..','..', 'lib'))
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'ierail'
|
7
|
+
|
8
|
+
class IERailTest < MiniTest::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
@ir = IERail.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_that_the_train_directions_are_correct
|
14
|
+
northbound_train = @ir.northbound_from('Howth Junction').sample
|
15
|
+
southbound_train = @ir.southbound_from('Clongriffin').sample
|
16
|
+
assert_equal northbound_train.direction, 'Northbound'
|
17
|
+
assert_equal southbound_train.direction, 'Southbound'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_that_an_empty_array_is_returned_when_no_data
|
21
|
+
nonexistant = @ir.westbound_from('Clongriffin')
|
22
|
+
assert_empty nonexistant
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_that_the_before_time_constraint_works
|
26
|
+
#Thirty minutes from now
|
27
|
+
thirty_mins = Time.now + 60*30
|
28
|
+
time = "#{thirty_mins.hour}:#{thirty_mins.min}" # "HH:MM"
|
29
|
+
before_train = @ir.southbound_from('Malahide').before(time).sample
|
30
|
+
assert Time.parse(before_train.expdepart) <= thirty_mins
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_that_the_after_time_constraint_works
|
34
|
+
#Thirty minutes from now
|
35
|
+
thirty_mins = Time.now + 60*30
|
36
|
+
time = "#{thirty_mins.hour}:#{thirty_mins.min}" # "HH:MM"
|
37
|
+
after_train = @ir.southbound_from('Malahide').after(time).sample
|
38
|
+
assert Time.parse(after_train.expdepart) >= thirty_mins
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_that_the_in_constraint_works
|
42
|
+
mins = 30
|
43
|
+
thirty_mins = Time.now + 60 * mins
|
44
|
+
time = "#{thirty_mins.hour}:#{thirty_mins.min}" # "HH:MM"
|
45
|
+
before_train = @ir.southbound_from('Malahide').before(time)
|
46
|
+
|
47
|
+
in_half_an_hour = @ir.southbound_from('Malahide').in(mins)
|
48
|
+
assert_equal before_train.count, in_half_an_hour.count
|
49
|
+
before_train.each_with_index { |b,i|
|
50
|
+
assert_equal b.traincode, in_half_an_hour[i].traincode
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..','..', 'lib'))
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'ierail'
|
7
|
+
|
8
|
+
class StationTest < MiniTest::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
ir = IERail.new
|
11
|
+
@station = ir.stations.sample #Use a random station
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_that_a_station_has_a_description
|
15
|
+
refute_empty @station.description
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_that_a_station_responds_to_name_alias
|
19
|
+
assert_respond_to @station, :name
|
20
|
+
assert_equal @station.name, @station.description
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_that_a_station_has_a_location
|
24
|
+
refute_empty @station.location
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_that_a_stations_locations_is_an_array
|
28
|
+
assert_equal @station.location.class, Array
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_that_a_stations_location_contains_two_values
|
32
|
+
assert_equal @station.location.size, 2
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_that_a_station_has_a_code
|
36
|
+
refute_empty @station.code
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_that_a_stations_has_an_id
|
40
|
+
refute_empty @station.id
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..','..', 'lib'))
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'ierail'
|
7
|
+
|
8
|
+
class StationDataTest < MiniTest::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
ir = IERail.new
|
11
|
+
@station_data = ir.station('Glenageary').sample
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_that_there_is_a_traincode
|
15
|
+
refute_empty @station_data.traincode
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_that_there_is_a_station_name_and_code
|
19
|
+
refute_empty @station_data.name
|
20
|
+
refute_empty @station_data.code
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_that_there_is_a_status
|
24
|
+
refute_empty @station_data.status
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_that_there_is_a_due_value
|
28
|
+
refute_empty @station_data.due_in
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_that_there_is_a_late_value
|
32
|
+
refute_empty @station_data.late
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_that_there_is_a_query_time
|
36
|
+
refute_empty @station_data.query_time
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_that_there_is_a_train_date
|
40
|
+
refute_empty @station_data.train_date
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_that_origin_method_returns_a_hash
|
44
|
+
assert_equal @station_data.origin.class, Hash
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_that_there_is_an_origin_name_and_time
|
48
|
+
refute_empty @station_data.origin[:name]
|
49
|
+
refute_empty @station_data.origin[:time]
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_that_destination_method_returns_a_hash
|
53
|
+
assert_equal @station_data.destination.class, Hash
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_that_there_is_a_destination_name_and_time
|
57
|
+
refute_empty @station_data.destination[:name]
|
58
|
+
refute_empty @station_data.destination[:time]
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_that_arrival_method_returns_a_hash
|
62
|
+
assert_equal @station_data.arrival.class, Hash
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_that_there_is_an_arrival_sched_and_exp
|
66
|
+
refute_empty @station_data.arrival[:scheduled]
|
67
|
+
refute_empty @station_data.arrival[:expected]
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_that_departure_method_returns_a_hash
|
71
|
+
assert_equal @station_data.departure.class, Hash
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_that_there_is_a_departure_sched_and_exp
|
75
|
+
refute_empty @station_data.departure[:scheduled]
|
76
|
+
refute_empty @station_data.departure[:expected]
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_that_it_responds_to_late?
|
80
|
+
assert_respond_to @station_data, :late?
|
81
|
+
end
|
82
|
+
end
|
data/test/unit/train.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..','..', 'lib'))
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'ierail'
|
7
|
+
|
8
|
+
class TrainTest < MiniTest::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
ir = IERail.new
|
11
|
+
@train = ir.trains.sample #Use a random train
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_that_a_train_has_status
|
15
|
+
refute_empty @train.status
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_that_a_train_has_a_location
|
19
|
+
refute_empty @train.location
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_that_a_trains_location_is_an_array
|
23
|
+
assert_equal @train.location.class, Array
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_that_the_location_array_contains_only_two_values
|
27
|
+
assert_equal @train.location.size, 2
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_that_a_train_has_a_code
|
31
|
+
refute_empty @train.code
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_that_a_train_has_a_date
|
35
|
+
refute_empty @train.date
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_that_a_train_has_a_message
|
39
|
+
refute_empty @train.message
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_that_a_train_has_a_direction
|
43
|
+
refute_empty @train.direction
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,60 +1,106 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ierail
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: "0.3"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Oisin Hurley
|
9
8
|
- Gary Rafferty
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
date: 2013-05-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.5.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.5.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rest-client
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.6.7
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.6.7
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: json
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.7.7
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.7.7
|
18
56
|
description: Irish Rail Train Schedule and Status API
|
19
57
|
email: oi.sin@nis.io
|
20
58
|
executables: []
|
21
|
-
|
22
59
|
extensions: []
|
23
|
-
|
24
60
|
extra_rdoc_files: []
|
25
|
-
|
26
|
-
|
61
|
+
files:
|
62
|
+
- .coveralls.yml
|
63
|
+
- .gitignore
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- ierail.gemspec
|
71
|
+
- lib/core_ext.rb
|
27
72
|
- lib/ierail.rb
|
28
73
|
- lib/station.rb
|
29
74
|
- lib/station_data.rb
|
30
75
|
- lib/train.rb
|
31
|
-
|
76
|
+
- main.rb
|
77
|
+
- test/unit/helper.rb
|
78
|
+
- test/unit/ierail.rb
|
79
|
+
- test/unit/station.rb
|
80
|
+
- test/unit/station_data.rb
|
81
|
+
- test/unit/train.rb
|
32
82
|
homepage: http://rubygems.org/gems/ierail
|
33
83
|
licenses: []
|
34
|
-
|
84
|
+
metadata: {}
|
35
85
|
post_install_message:
|
36
86
|
rdoc_options: []
|
37
|
-
|
38
|
-
require_paths:
|
87
|
+
require_paths:
|
39
88
|
- lib
|
40
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: "0"
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
52
99
|
requirements: []
|
53
|
-
|
54
100
|
rubyforge_project:
|
55
|
-
rubygems_version:
|
101
|
+
rubygems_version: 2.0.3
|
56
102
|
signing_key:
|
57
|
-
specification_version:
|
103
|
+
specification_version: 4
|
58
104
|
summary: Irish Rail Train Schedule and Status API
|
59
105
|
test_files: []
|
60
|
-
|
106
|
+
has_rdoc:
|