3.0.4 • Published 6 years ago
node-jcdecaux v3.0.4
nodejs client for JCDecaux Open Data
This project is a client libray for JC Decaux Open Data. In order to use this API, you need to get a key at http://developer.jcdecaux.com.
Installation
$ npm install node-jcdecauxhistoric:
see historic
Usage
var JCDecaux = require('node-jcdecaux').JCDecaux;
var Api = new JCDecaux(APIKEY)/!\ for old nodejs or for browser, include a promise polyfill (promise-polyfill, yaku) or es6-shim
Features
All method return promise.
constructor(apiKey, options)
The first parameter is required. All others are optional
apiKey- api key (for get a key go http://developer.jcdecaux.com) - Requiredoptions- options :contractName- set the default contract for all method - OptionalurlApi- url of JCDecaux api (default:https://api.jcdecaux.com/vls/v1/) - Optionaltimeout- Integer containing the number of milliseconds to wait for a request to respond before aborting the request
getContracts()
Get the contract list
getStation(stationId, contractName)
Get station information
stationId- id of the station - RequiredcontractName- contract name - Optional if set on init
getStations()
Get the station list
getStationsByContract(contractName)
Get the stations of a contract
contractName- contract name - Optional if set on init
Example
var JCDecaux = require('node-jcdecaux').JCDecaux;
var apiKey = 'your api key';
var Api = new JCDecaux(apiKey);
Api.getContracts().then(function(result) {
console.log(result);
});Run tests
APIKEY=yourapikey npm testAuthors
License
MIT