Socket
Socket
Sign inDemoInstall

citibike

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.4 to 2.2.0

5

History.md

@@ -0,1 +1,6 @@

2.2.0 / 2013-07-27
==================
* David Mazza added parameter support
2.1.3 / 2013-06-22

@@ -2,0 +7,0 @@ ==================

6

lib/citibike.js

@@ -14,2 +14,3 @@ "use strict";

, utils = require('./utils')
, querystring = require('querystring');

@@ -19,3 +20,3 @@ /**

*
* @param {Options} options The Client's options object.
* @param {Object} options The Client's options object.
*/

@@ -71,2 +72,5 @@ function Citibike( options ) {

if (params !== null)
url = url + "?" + querystring.stringify(params);
// Holds data from HTTP response body

@@ -73,0 +77,0 @@ var body = []

2

package.json

@@ -15,3 +15,3 @@ {

],
"version": "2.1.4",
"version": "2.2.0",
"author": "Kevin Coughlin <kevintcoughlin@gmail.com>",

@@ -18,0 +18,0 @@ "contributors": [

# Citibike [![Build Status](https://travis-ci.org/KevinTCoughlin/citibike.png)](https://travis-ci.org/KevinTCoughlin/citibike) [![Dependency Status](https://gemnasium.com/KevinTCoughlin/citibike.png)](https://gemnasium.com/KevinTCoughlin/citibike)
A [node.js](http://nodejs.org/) wrapper for [Citibike](http://citibikenyc.com/)'s REST API.
Now available in [PHP](https://github.com/KevinTCoughlin/citibike.php)!

@@ -29,12 +31,2 @@ ## Installation

## Notes
* **Parameters (Not Currently Supported)**
Since Citibike has not released their Official API the module does not support parameters.
Once either the supported query string parameters are discovered or the official API is released
the module will support params.
If you discover supported parameters please post an issue or fork the code so that they can be implemented.
## Examples

@@ -41,0 +33,0 @@

@@ -165,2 +165,44 @@ /**

});
it('responds with json and only updated data', function (done) {
request
.get(citibike.defaults.stationsStreamURL)
.set('Accept', 'application/json')
.expect(200)
.end(function(err, res) {
should.not.exist(err);
// Headers
res.header['content-type'].should.eql('application/json; charset=utf8');
// Content
/* Expected Response:
{
ok: true,
meta: [ ],
results: [
{
id: 72,
status: "Active",
availableBikes: 8,
availableDocks: 26
}
],
lastUpdate: 1367853737
} */
res.body.ok.should.eql(true);
res.body.results.should.not.be.empty;
var sampleResult = res.body.results[0];
sampleResult.id.should.be.a('number');
sampleResult.status.should.be.a('string');
sampleResult.availableBikes.should.be.a('number');
sampleResult.availableDocks.should.be.a('number');
should.not.exist(sampleResult.latitude);
done();
});
});
});

@@ -50,2 +50,12 @@ /**

});
it('should successfully complete request with params', function (done) {
citibike.getStations({updateOnly: "true"}, function(data) {
should.exist(data);
data.results.should.not.be.empty;
sampleResult = data.results[0];
should.exist(sampleResult.availableBikes);
should.not.exist(sampleResult.latitude);
done();
});
});
});

@@ -52,0 +62,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc