Skip to content

eyolas/node-jcdecaux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status NPM version Dependency Status

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-jcdecaux

historic:

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) - Required
  • options - options :
    • contractName - set the default contract for all method - Optional
    • urlApi - url of JCDecaux api (default: https://api.jcdecaux.com/vls/v1/) - Optional
    • timeout - 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 - Required
  • contractName - 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 test

Authors

License

MIT