IRail makes Belgian railway schedule easily available for anyone.
Check it out on http://project.irail.be/ or http://data.irail.be/
There are already several wrappers available in different languages. This is a Ruby wrapper for their API.
Add this line to your application's Gemfile:
gem 'ruby-irail'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby-irail
require "ruby-irail"
# get a list of all mivb/stib stations in brussels
irail = IRail::API.new(:stib) # use :mivb symbol instead of :stib if you want
irail.stations
# get a list of all belgian train stations
irail = IRail::API.new # by default it takes the nmbs/sncb provider but you can also use :sncb or :nmbs symbols
train_stations = irail.stations
# get train trips from one station to another
origin = train_stations.first
destination = train_stations.last
irail.connections(origin, destination)
#get train trip information (all stops for a train)
irail.vehicle("BE.NMBS.IC2240") # the vehicle ids cans be found when querying for a connection
#get departures from a specific station
irail.departures("BE.NMBS.008813003") # get station identifiers from the stations call
#get arrivals to a specific station
irail.arrivals("BE.NMBS.008813003")
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
All tests are in the specs folder. To run them simply run the following from the root folder of your fork:
rspec
Marc Lainez (@mlainez)