Lpp

Lpp is a simple gem for getting bus arrivals in Ljubljana. It uses the wbus.talktrack.com website.

Installation

Add this line to your application's Gemfile:

gem 'lpp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lpp

Usage examples

If you query Lpp to get arrivals from the main bus station in Ljubljana, Bavarski dvor: Lpp.arrivals('bavarski')

You'll be returned a hash similar to this: {:name=>"BAVARSKI DVOR", :buses=> {"1N BROD - BAVARSKI DVOR"=> {:route=>"BROD - BAVARSKI DVOR", :bus_number=>"1N", :arrivals=> [{:time=>"02:59", :easy=>false, :easy=>false, :easy=>false]}, "3 LITOSTROJ - RUDNIK"=> - RUDNIK", :bus_number=>"3", :arrivals=>[{:time=>"21:01", :easy=>false]}, "3L BAVARSKI DVOR - TOVARNA LEK"=> DVOR - TOVARNA LEK", :bus_number=>"3L", :arrivals=>[{:time=>"21:25", :easy=>false]}, "3N KOFLJICA - BAVARSKI DVOR"=> - BAVARSKI DVOR", :bus_number=>"3N", :arrivals=>[{:time=>"21:37", :easy=>false]}}}, "600011"=> DVOR", :buses=> {"1N VIMARJE - BAVARSKI DVOR"=> {:route=>"VIMARJE - BAVARSKI DVOR", :bus_number=>"1N", :arrivals=>[{:time=>"22:55", :easy=>false]}, "2 NOVE JARE - ZELENA JAMA"=> JARE - ZELENA JAMA", :bus_number=>"2", :arrivals=> [{:time=>"21:30", :easy=>true, :easy=>false, :easy=>false]}}}}

You can also get arrivals only for a specific bus number: Lpp.arrivals_for_bus('bavarski', 6)

And you'll get only the arrivals that match bus number 6 (6, 6B, etc.) {:name=>"BAVARSKI DVOR", :buses=> {"6 ČRNUČE - DOLGI MOST"=> {:route=>"ČRNUČE - DOLGI MOST", :bus_number=>"6", :arrivals=> [{:time=>"21:25", :easy=>true, :easy=>false, :easy=>false]}, "6 ČRNUČE - GARAŽA"=> - GARAŽA", :bus_number=>"6", :arrivals=>[{:time=>"00:53", :easy=>false]}, "6B ČRNUČE - NOTRANJE GORICE"=> - NOTRANJE GORICE", :bus_number=>"6B", :arrivals=> [{:time=>"21:41", :easy=>false, :easy=>true, :easy=>false]}}}, "600011"=> DVOR", :buses=> {"6B NOTRANJE GORICE - GARAŽA"=> {:route=>"NOTRANJE GORICE - GARAŽA", :bus_number=>"6B", :arrivals=>[{:time=>"23:30", :easy=>true]}, "6 DOLGI MOST - ČRNUČE"=> MOST - ČRNUČE", :bus_number=>"6", :arrivals=> [{:time=>"21:45", :easy=>true, :easy=>false, :easy=>false]}, "6 DOLGI MOST - GARAŽA"=> MOST - GARAŽA", :bus_number=>"6", :arrivals=> [{:time=>"22:44", :easy=>false, :easy=>false, :easy=>false]}, "6B NOTRANJE GORICE - ČRNUČE"=> GORICE - ČRNUČE", :bus_number=>"6B", :arrivals=> [{:time=>"21:28", :easy=>false, :easy=>true, :easy=>true]}}}}

That's it.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request