

Transport for Greater Manchester: Unofficial Rubygem
This is a Rubygem which acts as a wrapper for the Transport for Greater Manchester REST API. This provides the most accurate car parks, bus and metrolink information available to freely consume through the opendata.tfgm.com REST API.
We built this to use internally in our project, EventRoute, for the Innovation Challenge in Manchester (which won Best Under 21). The TFGM REST API is new and unstable as of March 2013 so we would avoid using it in production.
Getting Started
gem install tfgm
- Include it in your Ruby — Insert this at the top of your Ruby code where you'll using TFGM.
require 'tfgm'
- Create an instance of TFGM::API
instance = TFGM::API.new("Developer Key", "Application Key")
- Make it do something — if you're unsure of what it can do, scroll down to "Manual" on this page.
instance.stops_on_route('X50')
- Have fun. — Everything is returned as a
Hash.new
in Ruby. Use .inspect
to extract data you need.
TFGM::API Manual
There's very limited data available, but we've outlined what's currently available below. Parameters denoted with *
are mandatory.
Car Parks
- Find all car parks in Greater Manchester
instance.carparks(0, 5)
instance.carpark(21915)
Routes
- View all bus routes running in Greater Manchester
instance.routes
instance.route('X50')
if instance.is_route('X50') then
end
instance.stops_on_route('X50')
Bus stops
- Find bus stops near a geolocation
instance.bus_stops_near(52.91391221, -3.39414441)
- Find bus stop by ATCO Code
instance.bus_stop('1800SB04781')
- Find routes running from bus stop
instance.buses_on_stop('1800SB04781')
Metrolink times
instance.journey_times
- View journey times for a single route
instance.journey_times('A56-Dunham_proxy')
Contributing
We all know the REST API for TFGM is really buggy, but it's a great start. I'm glad that it's available and can foster innovation in the city, so if you're interested in developing it with me, just play about with it.
Let me know via @bilawalhameed on Twitter if you're interested before sending a pull request.