https://github.com/eyolas/node-jcdecaux
nodejs client for JCDecaux Open Data
https://github.com/eyolas/node-jcdecaux
Last synced: 7 months ago
JSON representation
nodejs client for JCDecaux Open Data
- Host: GitHub
- URL: https://github.com/eyolas/node-jcdecaux
- Owner: eyolas
- License: mit
- Created: 2014-05-21T11:02:04.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2022-12-27T09:25:08.000Z (over 3 years ago)
- Last Synced: 2024-04-24T16:19:36.873Z (about 2 years ago)
- Language: JavaScript
- Size: 585 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: history.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status][build-image]][build-url]
[![NPM version][npm-image]][npm-url]
[![Dependency Status][gemnasium-image]][gemnasium-url]
## 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](history.md)
## Usage
```js
var JCDecaux = require('node-jcdecaux').JCDecaux;
var Api = new JCDecaux(APIKEY)
```
/!\ for old nodejs or for browser, include a promise polyfill ([promise-polyfill][promise-polyfill-url], [yaku][yaku-url]) or [es6-shim][es6-shim-url]
## 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
```js
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
```Shell
APIKEY=yourapikey npm test
```
## Authors
- [David Touzet](https://github.com/eyolas)
# License
MIT
[build-image]: https://travis-ci.org/eyolas/node-jcdecaux.svg?branch=master
[build-url]: https://travis-ci.org/eyolas/node-jcdecaux
[npm-image]: https://img.shields.io/npm/v/node-jcdecaux.svg?style=flat-square
[npm-url]: https://github.com/eyolas/node-jcdecaux
[gemnasium-image]: http://img.shields.io/gemnasium/eyolas/node-jcdecaux.svg?style=flat-square
[gemnasium-url]: https://gemnasium.com/eyolas/node-jcdecaux
[promise-polyfill-url]:https://github.com/taylorhakes/promise-polyfill
[yaku-url]:https://github.com/ysmood/yaku
[es6-shim-url]:https://github.com/paulmillr/es6-shim