0.0
No commit activity in last 3 years
No release in over 3 years
A ruby interface for accessing service and bus stop information provided by the BusTracker service for Edinburgh's public transport.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Bustracker

Edinburgh BusTracker via Ruby.

An attempt at providing an object-based interface for interacting with the BusTracker data.

Installation

gem install bus_tracker

Examples

Service Information

Find all of the bus stops for a particular service: service = BusTracker.service('N30')

service.number
#=> 'N30'

After fetching a service, you can also pull up information about each stop for that service:

bus_stop = service.bus_stops.first

bus_stop.code
> '36232545'

bus_stop.name
 > 'Castle Street'

bus_stop.latitude
 > "55.951084136963"
bus_stop.longitude
 > "-3.2017660140991"

bus_stop.service_numbers
 > ["1", "3", "3A", "4", "22", "25", "X25", "30", "33", "34", "44", "44A", "N22", "N25", "N30", "N44"]

Departures

If you know the code for a bus stop you can fetch the associated departures. This is the same information that you'd see on the bus tracker boards, but instantiated as their own departure objects. stop = BusTracker.bus_stop('36232545') departure = stop.departures.first

departure.service_number
#=> 30
departure.destination
#=> MUSSELBURGH
departure.due
#=> 7

For any BusTracker::BusStop instance, you can fetch the latest departure times: stop.fetch_departures! stop.departures.first.due #=> 5

Copyright (c) 2010 [Mark Connell], released under the MIT license