melbourne-metro-sdk
v1.0.4
Published
A reference implementation to fetch Melbourne Metro next train information form their API
Downloads
7
Maintainers
Readme
melbourne-metro-sdk
A reference implementation for Melbourne Metro SDK v3. It tries to fetch next train information calling Metro SDK based on the API keys provided.
npm run
scripts
npm run test
: Runs jest tests oncenpm run cover
: Runs jest code
Installation
npm install melbourne-metro-sdk
Usage
const melbourneMetro = require('melbourne-metro-sdk');
const melbourneMetroConfig = melbourneMetro.init({
api: {
BASE_URL: 'sample_base_url',
APP_KEY: 'sample_app_key',
APP_USER: 'sample_app_user'
}
})
melbourneMetroConfig.nextTrain({
route_id: 5,
route_type: 0,
stop_id: 1155
}).then(data => console.log(data)).catch(e => console.log(e));
melbourneMetroConfig.routeDetails({
route_type: 0
}).then(data => console.log(data)).catch(e => console.log(e));
Methods Supported
nextTrain({route_id, route_type, stop_id}) => Promise with next Train details
routeDetails({route_type}) => Promise with route details including all stops