Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaxgeller/node-capital-bikeshare
Capital Bikeshare api for nodejs
https://github.com/jaxgeller/node-capital-bikeshare
Last synced: 16 days ago
JSON representation
Capital Bikeshare api for nodejs
- Host: GitHub
- URL: https://github.com/jaxgeller/node-capital-bikeshare
- Owner: jaxgeller
- Created: 2014-09-18T14:41:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-24T15:54:15.000Z (about 10 years ago)
- Last Synced: 2024-12-07T20:44:50.954Z (28 days ago)
- Language: JavaScript
- Size: 1.05 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-capital-bikeshare
[![Build Status](https://travis-ci.org/jacksongeller/node-capital-bikeshare.svg)](https://travis-ci.org/jacksongeller/node-capital-bikeshare)
###Install
`$ npm install node-capital-bikeshare --save`---
### API##### `getAll(callback)`
+ `callback(err, data)`
+ returns all stations#### `getMultiple(ids, callback)`
+ `ids` array of strings - the ids of the bike stations you want
+ `callback(err, data)`
+ returns the station that matches the given id##### `getById(id, callback)`
+ `id` number
+ `callback(err, data)`
+ returns the station that matches the given id##### `getByName(name, callback`
+ `name` string
+ `callback(err, data)`
+ returns the station that matches the given name##### `getByClosest(location, limit, callback)`
+ `location` obj `{latitude: number, longitude: number}`
+ `limit` number
+ `callback(err, data)`
+ returns stations within the limit that are closest to the location given. Uses haversine geo-distance formula.---
### Examples```js
var api = require('capital-bike-share-js');
var coord1 = {
latitude: 38.9059581,
longitude: -77.0416805
}// Get all
api.getAll(function(err, data) {
// do something with data;
});// Get by ID
api.getById(30, function(err, data) {
// do something with data;
});// Get by name
api.getByName('John McCormack Dr & Michigan Ave NE', function(err, data) {
// do something with data;
});// Get closest
api.getByClosest(coord1, 5, function(err, data) {
// do something with data;
});```