{"id":15407061,"url":"https://github.com/bih/tfgm","last_synced_at":"2025-03-01T13:31:35.039Z","repository":{"id":7671047,"uuid":"9033138","full_name":"bih/tfgm","owner":"bih","description":"A simple Ruby wrapper for the Transport for Greater Manchester REST API (i.e. bus routes, car parks, metrolinks).","archived":false,"fork":false,"pushed_at":"2013-04-13T13:57:05.000Z","size":152,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T12:46:34.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bih.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-26T15:10:29.000Z","updated_at":"2018-02-25T20:42:53.000Z","dependencies_parsed_at":"2022-09-21T21:42:24.185Z","dependency_job_id":null,"html_url":"https://github.com/bih/tfgm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bih%2Ftfgm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bih%2Ftfgm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bih%2Ftfgm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bih%2Ftfgm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bih","download_url":"https://codeload.github.com/bih/tfgm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241371379,"owners_count":19952087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T16:26:55.446Z","updated_at":"2025-03-01T13:31:34.706Z","avatar_url":"https://github.com/bih.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](http://i.imgur.com/6PGUo4g.png)\n\n[![Build Status](https://travis-ci.org/bih/tfgm.png?branch=master)](https://travis-ci.org/bih/tfgm) [![Build Status](https://d25lcipzij17d.cloudfront.net/badge.png?title=gem\u0026type=3c\u0026v=0.0.3)]() [![Dependency Status](https://gemnasium.com/bih/tfgm.png)](https://gemnasium.com/bih/tfgm) [![Code Climate](https://codeclimate.com/github/bih/tfgm.png)](https://codeclimate.com/github/bih/tfgm)\n# Transport for Greater Manchester: Unofficial Rubygem\nThis is a Rubygem which acts as a wrapper for the [Transport for Greater Manchester REST API](http://developer.tfgm.com). This provides the most accurate car parks, bus and metrolink information available to freely consume through the **opendata.tfgm.com** REST API.\n\nWe built this to use internally in our project, EventRoute, for the [Innovation Challenge in Manchester](http://futureeverything.org/summit/conference/workshops-fringe-events/innovation-challenge/) (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.\n\n## Getting Started\n* **Sign up for an API Key** \u0026mdash; It's easy to sign up at [developer.tfgm.com](http://developer.tfgm.com) and you'll need a developer \u0026 application key. An example of what both the keys should like are: `a1b23cd4-ef67-890g-h123-4567i8jk9lmn` and they must be 36 characters in length.\n\n* **Install the gem**\n```ruby\ngem install tfgm\n```\n \n* **Include it in your Ruby** \u0026mdash; Insert this at the top of your Ruby code where you'll using TFGM.\n```ruby\nrequire 'tfgm'\n```\n\n* **Create an instance of TFGM::API**\n```ruby\ninstance = TFGM::API.new(\"Developer Key\", \"Application Key\")\n```\n\n* **Make it do something** \u0026mdash; if you're unsure of what it can do, scroll down to \"Manual\" on this page.\n```ruby\ninstance.stops_on_route('X50')\n```\n\n* **Have fun.** \u0026mdash; Everything is returned as a `Hash.new` in Ruby. Use `.inspect` to extract data you need.\n\n-----------------\n\n## TFGM::API Manual\nThere's very limited data available, but we've outlined what's currently available below. Parameters denoted with `*` are mandatory.\n\n### Car Parks\n\n* Find all car parks in Greater Manchester\n```ruby\n# Parameters:\n# (int)  *page     = default: 0\n# (int)  *per_page = default: 10\ninstance.carparks(0, 5)\n```\n\n* Find a car park by ID\n```ruby\n# Parameters:\n# (int) *id\ninstance.carpark(21915)\n```\n\n### Routes\n\n* View all bus routes running in Greater Manchester\n```ruby\n# Parameters:\n# None\ninstance.routes\n```\n\n* View bus route by ID\n```ruby\n# Parameters\n# (string) *bus_code\ninstance.route('X50')\n```\n\n* Verify bus route exists\n```ruby\n# Parameters:\n# (string) *bus_code\nif instance.is_route('X50') then\n# Route exists, yay!\nend\n```\n\n* Bus stops on bus route\n```ruby\n# Parameters\n# (string) *bus_code\ninstance.stops_on_route('X50')\n```\n\n### Bus stops\n\n* Find bus stops near a geolocation\n```ruby\n# Parameters:\n# (double) *latitude\n# (double) *longitude\ninstance.bus_stops_near(52.91391221, -3.39414441)\n```\n\n* Find bus stop by ATCO Code\n```ruby\n# Parameters:\n# (string) *atco_code\ninstance.bus_stop('1800SB04781')\n```\n\n* Find routes running from bus stop\n```ruby\n# Parameters:\n# (string) *atco_code\ninstance.buses_on_stop('1800SB04781')\n```\n\n### Metrolink times\n\n* View all journey times\n```ruby\n# Parameters:\n# None\ninstance.journey_times\n```\n\n* View journey times for a single route\n```ruby\n# Parameters:\n# (string) *journey_id\ninstance.journey_times('A56-Dunham_proxy')\n```\n\n-----------------\n\n## Contributing\nWe 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.\n\nLet me know via [@bilawalhameed on Twitter](http://twitter.com/bilawalhameed/) if you're interested before sending a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbih%2Ftfgm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbih%2Ftfgm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbih%2Ftfgm/lists"}