Permalink
Browse files

Remove the generated API docs

  • Loading branch information...
1 parent bc1daef commit 91ac3c147426e592973800ebb99331a4e08bf213 @Sutto committed Sep 27, 2012
View
@@ -5,3 +5,4 @@ tmp/
.sass-cache/
coverage/
config/database.yml
+doc/generated-api
View
@@ -1,6 +1,19 @@
-# The Unofficial Transperth API
+# Perth Transit API
-This application houses an unofficial API wrapping the Transperth Web Site.
+The perth transit is an unofficial API to provide easy access to Transperth
+data for developers.
+
+The api is available from [http://api.perthtransit.com/](http://api.perthtransit.com/).
+
+## API Conventions
+
+### Errors
+
+### Compact Responses
+
+### URL Construction
+
+## Notes
It's currently implemented using scraping, but makes its best attempt to be efficient
at it and to avoid processing data it doesn't have to. Likewise, it caches as much
View
@@ -2,7 +2,7 @@
## Getting a smart rider information
-This accepts a smartrider number and attempts to return available information about
+Given a smartrider number, this attempts to return available information about
said number in the form of the remaining balance, the type of smart rider and any
discounts applicable.
View
@@ -1,7 +1,148 @@
# Train Times & Stops
+The core of Perth Transit is the access we provide to train data.
+
+Namely, Unlike the GTFS data feeds Perth Transit provides Live Train
+times from the Transperth Website, including extra data such as the number
+of cars.
+
+**Please Note:** The examples below use shortened data to make it easier to read.
+
## Finding Train Stations
+The core endpoint is a list of all trainstations that are available.
+
+This endpoint is available under `/1/train_stations`. As an example:
+
+```http
+GET /1/train_stations HTTP/1.1
+```
+
+```http
+HTTP/1.1 200 OK
+Cache-Control: max-age=86400, public, must-revalidate
+Content-Type: application/json; charset=utf-8
+
+{
+ "count": 69,
+ "response": [{
+ "cached_slug": "armadale",
+ "compact": true,
+ "lat": "-32.1376083",
+ "lng": "116.0104606",
+ "name": "Armadale",
+ "url": "http://api.perthtransit.com/1/train_stations/armadale"
+ }, {
+ "cached_slug": "ashfield",
+ "compact": true,
+ "lat": "-31.9129489",
+ "lng": "115.9359944",
+ "name": "Ashfield",
+ "url": "http://api.perthtransit.com/1/train_stations/ashfield"
+ }, {
+ "cached_slug": "bassendean",
+ "compact": true,
+ "lat": "-31.9037106",
+ "lng": "115.94718",
+ "name": "Bassendean",
+ "url": "http://api.perthtransit.com/1/train_stations/bassendean"
+ }]
+}
+```
+
## Nearby Train Stations
-## Getting live times for a given train station
+By providing a `near` parameter with a formatted `lat,lng` pair, you can filter
+to only stations within a five kilometre distance from the specified location.
+
+For example,
+
+```http
+GET /1/train_stations?near=-32.1376,116.0104 HTTP/1.1
+```
+
+```http
+HTTP/1.1 200 OK
+Cache-Control: max-age=86400, public, must-revalidate
+Content-Type: application/json; charset=utf-8
+
+{
+ "count": 3,
+ "response": [{
+ "cached_slug": "armadale",
+ "compact": true,
+ "lat": "-32.1376083",
+ "lng": "116.0104606",
+ "name": "Armadale",
+ "url": "http://api.perthtransit.com/1/train_stations/armadale"
+ }, {
+ "cached_slug": "sherwood",
+ "compact": true,
+ "lat": "-32.1376083",
+ "lng": "116.0104606",
+ "name": "Sherwood",
+ "url": "http://api.perthtransit.com/1/train_stations/sherwood"
+ }, {
+ "cached_slug": "challis",
+ "compact": true,
+ "lat": "-32.1263406",
+ "lng": "116.0129372",
+ "name": "Challis",
+ "url": "http://api.perthtransit.com/1/train_stations/challis"
+ }]
+}
+```
+
+## Getting live times for a given train station
+
+Finally, from a given train station, (using the URL or constructing a URL via the `cached_slug` field),
+you can get the time information for a given station.
+
+If the train station doesn't exist, it will instead return a 404
+status code with `not_found` in the standard error body form.
+
+```http
+GET /1/train_stations/perth HTTP/1.1
+```
+
+```http
+HTTP/1.1 200 OK
+Cache-Control: max-age=60, public, must-revalidate
+Content-Type: application/json; charset=utf-8
+Etag: "example-etag-goes-here"
+
+{
+ "response": {
+ "cached_slug": "perth",
+ "compact": false,
+ "lat": "-31.9510908",
+ "lng": "115.8599254",
+ "name": "Perth",
+ "times": [{
+ "cars": 4,
+ "line": "Midland",
+ "on_time": true,
+ "pattern": null,
+ "platform": 7,
+ "status": "On Time",
+ "time": "19:00"
+ }, {
+ "cars": 2,
+ "line": "Fremantle",
+ "on_time": true,
+ "pattern": "K",
+ "platform": 5,
+ "status": "On Time",
+ "time": "19:02"
+ }, {
+ "cars": 4,
+ "line": "Armadale",
+ "on_time": true,
+ "pattern": "C",
+ "platform": 6,
+ "status": "On Time",
+ "time": "19:02"
+ }]
+ }
+}
+```
@@ -1,79 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Perth Transit API</title>
- <link href="./stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
- <link href="./stylesheets/documentation.css" media="screen" rel="stylesheet" type="text/css" />
-</head>
- <body>
- <div class='navbar navbar-fixed-top' id="page-navigation">
- <div class='navbar-inner'>
- <div class='container'>
- <a href="./index.html" class="brand">Perth Transit API</a>
- <ul class='nav pull-right'>
-
- <li class='dropdown'>
-
-
- <a href='' class='dropdown-toggle' data-toggle='dropdown'>Bus Times <b class="caret"></b></a>
- <ul class="dropdown-menu singular endpoints">
-<li class='endpoints'><a href="busses.html#getting-busses-for-a-specific-stop">Getting busses for a specific stop</a></li>
-</ul>
-
-
-
- </li>
-
- <li class='dropdown'>
-
-
- <a href='' class='dropdown-toggle' data-toggle='dropdown'>SmartRiders <b class="caret"></b></a>
- <ul class="dropdown-menu singular endpoints">
-<li class='endpoints'><a href="smart-riders.html#getting-a-smart-rider-information">Getting a smart rider information</a></li>
-</ul>
-
-
-
- </li>
-
- <li class='dropdown'>
-
-
- <a href='' class='dropdown-toggle' data-toggle='dropdown'>Train Times &amp; Stops <b class="caret"></b></a>
- <ul class="dropdown-menu singular endpoints">
-<li class='endpoints'><a href="trains.html#finding-train-stations">Finding Train Stations</a></li>
-
-<li class='endpoints'><a href="trains.html#nearby-train-stations">Nearby Train Stations</a></li>
-
-<li class='endpoints'><a href="trains.html#getting-live-times-for-a-given-train-station">Getting live times for a given train station</a></li>
-</ul>
-
-
-
- </li>
-
- </ul>
- </div>
- </div>
-</div>
-
- <div class='container documentation-page'>
- <div id='content'>
- <h1>Bus Times</h1>
-
-<h2>Endpoints</h2>
-<ul id="endpoints"><li><a href="#getting-busses-for-a-specific-stop">Getting busses for a specific stop</a></li></ul>
-<h2 id="getting-busses-for-a-specific-stop">Getting busses for a specific stop</h2>
- </div>
-
- <footer class='footer'>
- <p class='pull-left'>Documentation built with Emmett.</p>
- <p class='pull-right'><a href="#">Back to Top</a></p>
-</footer>
-
-<script src="./javascripts/jquery-1.7.2.min.js" type="text/javascript"></script>
-<script src="./javascripts/bootstrap.min.js" type="text/javascript"></script>
-<script src="./javascripts/documentation.js" type="text/javascript"></script>
- </div>
- </body>
-</html>
Deleted file not rendered
Deleted file not rendered
@@ -1,120 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Perth Transit API</title>
- <link href="./stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
- <link href="./stylesheets/documentation.css" media="screen" rel="stylesheet" type="text/css" />
-</head>
- <body>
- <div class='navbar navbar-fixed-top' id="page-navigation">
- <div class='navbar-inner'>
- <div class='container'>
- <a href="./index.html" class="brand">Perth Transit API</a>
- <ul class='nav pull-right'>
-
- <li class='dropdown'>
-
-
- <a href='' class='dropdown-toggle' data-toggle='dropdown'>Bus Times <b class="caret"></b></a>
- <ul class="dropdown-menu singular endpoints">
-<li class='endpoints'><a href="busses.html#getting-busses-for-a-specific-stop">Getting busses for a specific stop</a></li>
-</ul>
-
-
-
- </li>
-
- <li class='dropdown'>
-
-
- <a href='' class='dropdown-toggle' data-toggle='dropdown'>SmartRiders <b class="caret"></b></a>
- <ul class="dropdown-menu singular endpoints">
-<li class='endpoints'><a href="smart-riders.html#getting-a-smart-rider-information">Getting a smart rider information</a></li>
-</ul>
-
-
-
- </li>
-
- <li class='dropdown'>
-
-
- <a href='' class='dropdown-toggle' data-toggle='dropdown'>Train Times &amp; Stops <b class="caret"></b></a>
- <ul class="dropdown-menu singular endpoints">
-<li class='endpoints'><a href="trains.html#finding-train-stations">Finding Train Stations</a></li>
-
-<li class='endpoints'><a href="trains.html#nearby-train-stations">Nearby Train Stations</a></li>
-
-<li class='endpoints'><a href="trains.html#getting-live-times-for-a-given-train-station">Getting live times for a given train station</a></li>
-</ul>
-
-
-
- </li>
-
- </ul>
- </div>
- </div>
-</div>
-
- <div class='container'>
-
- <div id='content'>
- <h1>The Unofficial Transperth API</h1>
-
-<p>This application houses an unofficial API wrapping the Transperth Web Site.</p>
-
-<p>It's currently implemented using scraping, but makes its best attempt to be efficient
-at it and to avoid processing data it doesn't have to. Likewise, it caches as much
-as needed to prevent clients from returning multiple items.</p>
-
-<p>Currently the API providers Geolocation based Train and Bus stop lookup, Live times
-for trains and scheduled times for busses. As an added bonus, we include a time-delayed
-wrapper for smart rider information.</p>
- </div>
-
- <section id="document-index">
- <h2>API Index</h2>
- <div id='inner-index'>
- <ul>
-
- <li>
- <h3><a href="busses.html">Bus Times</a></h4>
- <ul class="endpoints">
-<li class='endpoints'><a href="busses.html#getting-busses-for-a-specific-stop">Getting busses for a specific stop</a></li>
-</ul>
- </li>
-
- <li>
- <h3><a href="smart-riders.html">SmartRiders</a></h4>
- <ul class="endpoints">
-<li class='endpoints'><a href="smart-riders.html#getting-a-smart-rider-information">Getting a smart rider information</a></li>
-</ul>
- </li>
-
- <li>
- <h3><a href="trains.html">Train Times &amp; Stops</a></h4>
- <ul class="endpoints">
-<li class='endpoints'><a href="trains.html#finding-train-stations">Finding Train Stations</a></li>
-
-<li class='endpoints'><a href="trains.html#nearby-train-stations">Nearby Train Stations</a></li>
-
-<li class='endpoints'><a href="trains.html#getting-live-times-for-a-given-train-station">Getting live times for a given train station</a></li>
-</ul>
- </li>
-
- </ul>
- </div>
- </section>
-
- <footer class='footer'>
- <p class='pull-left'>Documentation built with Emmett.</p>
- <p class='pull-right'><a href="#">Back to Top</a></p>
-</footer>
-
-<script src="./javascripts/jquery-1.7.2.min.js" type="text/javascript"></script>
-<script src="./javascripts/bootstrap.min.js" type="text/javascript"></script>
-<script src="./javascripts/documentation.js" type="text/javascript"></script>
- </div>
- </body>
-</html>

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 91ac3c1

Please sign in to comment.