1.1.0 • Published 8 years ago

aata v1.1.0

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

nodejs module for accessing the AATA MicroAPI.

Build Status npm version

Install

npm install --save aata

Usage

Please accept AATA terms of use

var AATA = require('aata');

var aata = new AATA();

// Thin wrapper on top of existing AATA MicroAPI: http://www.theride.org/AboutUs/Developer-Resources/Developer-Files
// Note: All methods accept a route id, which as expected, will return data for only that route.

// Get schedule documents
aata.getScheduleDocuments()
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });

// Get all stops in the system
aata.getStopsOnRoute()
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });

// Get timepoints for stops in the system
aata.getStopTimepoints()
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });

// Get names and IDs for all AATA routes
aata.getRouteNames()
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });

// Get names and IDs for all AATA routes
aata.getBusLocations()
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });

// You can use callbacks rather than promises too.
aata.getRouteNames(null, function(err, data) {
  if (err) return console.error(error);
  console.log(data);
});

Test

npm test

License

MIT: https://opensource.org/licenses/MIT