README.md in ierail-0.3.5 vs README.md in ierail-0.4.0

- old
+ new

@@ -54,11 +54,11 @@ ``` ### Find out information for a specific train ```ruby -trains = ir.station('clongriffin', 60) +trains = ir.station_times('clongriffin', 60) trains.first.last_location # "Arrived Harmonstown" trains.first.origin # {:name=>"Greystones", :time=>2013-05-13 22:10:00 +0100} @@ -71,10 +71,46 @@ trains.first.duein # "2" trains.first.late? # 0 || 1 ``` +### Find out the movements of a specific train + +```ruby +trains = ir.station_times('clongriffin', 60) + +train_code = trains.first.code + +train_movements = ir.train_movements(train_code) # Gets the movements of the train for today +train_movements = ir.train_movements(train_code, date) # Gets the movements of train for some date + +fourth_stop = train_movements.at(4) + +fourth_stop.location #{:code => "GRGD", :location_full_name => "Clongriffin", :stop_number => 4, :location_type => "S"} + +fourth_stop.arrival # {:scheduled=>2013-05-13 22:09:00 +0100, :expected=>2013-05-13 22:10:00 +0100, :actual=2013-05-13 22:10:00 +0100} + +fourth_stop.departure # {:scheduled=>2013-05-13 22:09:00 +0100, :expected=>2013-05-13 22:10:00 +0100, :actual=2013-05-13 22:10:00 +0100} + +fourth_stop.train #{:code => "E808", :date => 2013-05-13 22:09:00 +0100, :origin => "Malahide"} +``` + + Check the [main.rb](main.rb) for additional usage. + +## Development + +### Testing + +Rather than having the test suite hit the API, this project is using [VCR](https://github.com/vcr/vcr) alongside [Timecop](https://github.com/travisjeffery/timecop) to use stubbed responses. +These responses are stored in the `fixtures/vcr_cassettes` directory and can be updated by running + +1. `rm -r fixtures` +2. `rake test` + +As the API functionality is highly time dependent, Timecop is used to set/freeze time so that we can run time based queries on the older fixture data. + +--- Pull requests welcome, because there's damn all in it at the moment. Please accompany the pull request with an appropriate test, and if you can, an example here in the README. [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/oisin/ierail/trend.png)](https://bitdeli.com/free "Bitdeli Badge")