Skip to content

Node plugin for retrieving real-time data from Ruter's public API.

Notifications You must be signed in to change notification settings

mathiasnovas/sanntid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanntid.js

Sanntid.js is a node.js module for getting real-time data from the public Ruter API.

Installation

Simply do

npm install sanntid

Use the -g option to make the command globally available as sanntid.

How to work it

As a CLI

./sanntid.js <locationID>

Or you can search for a location:

./sanntid.js sofienberg

The result would be something like this:

🚋  17 Rikshospitalet - in 2 minutes
🚌  31 Snarøya - in 2 minutes

A list of locations and their IDs can be downloaded from Ruter lab's pages.

You can limit the results to a specific direction by specifying 1 or 2 as the second parameter:

./sanntid.js sofienberg 1

As a node module

var sanntid = require('./sanntid'),
	allLocations = sanntid.list(),
	locations = sanntid.search('sofienberg');

for (var i = 0; i < locations.length; i++) {
	sanntid.getRealtimeData(locations[i], '1', function (data) {
	    console.log(data);
	});
}

Testing

Run the tests using the npm test command:

npm test

License

The MIT License

Copyright © 2015 - Mathias Novas

About

Node plugin for retrieving real-time data from Ruter's public API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published