dublinbikes_nodejs
A node.js module designed to retrieve status information from the DublinBikes bike-sharing service. The API provides methods to:
- Get the list of all stations
- Get status information for a station
- Find the nearest stations to a given latitude/longitude
- Find the nearest available bike to a given latitude/longitude
This is an unofficial module and the author/contributors are in no way connected to the DublinBikes organisation.
Installation
npm install dublinbikes_js
Usage
It's really easy to use. All methods return JSON objects.
Require it and create a new instance.
(Use eyes) to preview results):
var bike_api = ;var eyes = ;
Get the list of all stations:
bike_api;
(Returns a long list of stations)
Get the current status for a station:
var stationID = 2;bike_api;
Returns something like:
available: '14' free: '6' total: '20' ticket: '1' open: '1' updated: '1505761025' connected: '1'
Find the closest station to a location:
Location in decimal latitude/longitude. Optionally we can restrict the search to only stations which are currently open, and limit the search to return the n closest stations.
bike_api;
Returns something like:
name: 'DAME STREET' number: '10' address: 'Dame Street' fullAddress: 'Dame Street ' lat: '53.344007' lng: '-6.266802' open: '1' ticket: '1' bonus: '0'
Find the closest station that has available bikes:
Location in decimal latitude/longitude. We can show the n closest stations that have bikes available, and we can also filter to only show stations that have m or more bikes available.
bike_api;
Returns a result like:
available: '2' free: '14' total: '16' ticket: '1' open: '1' updated: '1505768043' connected: '1' name: 'DAME STREET' number: '10' address: 'Dame Street' fullAddress: 'Dame Street ' lat: '53.344007' lng: '-6.266802' open: '1' ticket: '1' bonus: '0'
Tests
npm test
Contributing
Fork this repo, make some changes and create a new pull request!