Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vinli

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vinli - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

lib/collision.js

1

lib/client.js

@@ -72,2 +72,3 @@ var Hoek = require('hoek');

this.Rule = require('./rule')(this);
this.Collision = require('./collision')(this);
};

@@ -74,0 +75,0 @@

@@ -151,3 +151,3 @@ var Utils = require('./utils');

};
Device.prototype.createSubscription = function(_options) {

@@ -162,2 +162,16 @@ return client.post(

Device.prototype.collisions = function(_options) {
var self = this;
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {});
Joi.assert(_options, Utils.paginationOptions);
return client.get(
'safety',
'devices/' + this.id + '/collisions',
_options).then(function(resp) {
resp.collisions = resp.collisions.map(function(v) { return new client.Collision(v); });
return Utils.listResponse(resp, 'collisions', self.collisions, self);
});
};
Device.fetch = function(id) {

@@ -174,2 +188,2 @@ return client.get('platform', 'devices/' + id).then(function(resp) {

return Device;
};
};

@@ -61,2 +61,16 @@ var Utils = require('./utils');

Vehicle.prototype.collisions = function(_options) {
var self = this;
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {});
Joi.assert(_options, Utils.paginationOptions);
return client.get(
'safety',
'vehicles/' + this.id + '/collisions',
_options).then(function(resp) {
resp.collisions = resp.collisions.map(function(v) { return new client.Collision(v); });
return Utils.listResponse(resp, 'collisions', self.collisions, self);
});
};
Vehicle.fetch = function(id) {

@@ -73,2 +87,2 @@ return client.get('platform', 'vehicles/' + id).then(function(resp) {

return Vehicle;
};
};

2

package.json
{
"name": "vinli",
"version": "1.3.0",
"version": "1.4.0",
"description": "Official Node.js SDK for interacting with the Vinli Platform",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -377,3 +377,3 @@ var nock = require('nock');

}],
meta: {
meta: {
pagination: {

@@ -418,3 +418,3 @@ total: 748,

xdescribe('#collisions()', function() {
describe('#collisions()', function() {
it('should exist', function() {

@@ -424,3 +424,50 @@ var device = Vinli.Device.forge('asfdafdasfdsdf');

});
it('should return a list of collisions for the devices', function() {
var m = nock('https://safety.vin.li')
.get('/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=0&limit=2')
.reply(200, {
collisions: [{
id: '06782175-735e-4226-82bc-ebdf887c30f3',
timestamp: '2015-07-13T17:45:04.583Z',
location: {
type: 'Point',
coordinates: [ -96.917009, 32.766392 ]
},
links: { self: 'http://172.17.0.114:3000/api/v1/collisions/06782175-735e-4226-82bc-ebdf887c30f3' }
}, {
id: '5b2bf92c-a2c5-4365-9f9b-3d51b8883ad6',
timestamp: '2015-07-13T17:46:04.583Z',
location: {
type: 'Point',
coordinates: [ -96.917009, 32.766392 ]
},
links: { self: 'http://172.17.0.114:3000/api/v1/collisions/5b2bf92c-a2c5-4365-9f9b-3d51b8883ad6' }
}],
meta: {
pagination: {
total: 3,
limit: 2,
offset: 0,
links: {
first: 'http://172.17.0.114:3000/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=0&limit=2',
last: 'http://172.17.0.114:3000/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=0&limit=2',
next: 'http://172.17.0.114:3000/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=2&limit=2'
}
}
}
});
return Vinli.Device.forge('c4627b29-14bd-49c3-8e6a-1f857143039f').collisions({ limit: 2 })
.then(function(collisions) {
expect(collisions).to.have.property('list').that.is.an('array');
expect(collisions.list).to.have.lengthOf(2);
expect(collisions.list[0]).to.be.instanceOf(Vinli.Collision);
expect(collisions).to.have.property('total', 3);
expect(collisions).to.have.property('next').that.is.a('function');
m.done();
});
});
});
});
});

@@ -261,8 +261,55 @@ var nock = require('nock');

xdescribe('#collisions()', function() {
describe('#collisions()', function() {
it('should exist', function() {
var device = Vinli.Vehicle.forge('asfdafdasfdsdf');
expect(device).to.have.property('collisions').that.is.a('function');
var vehicle = Vinli.Vehicle.forge('asfdafdasfdsdf');
expect(vehicle).to.have.property('collisions').that.is.a('function');
});
it('should return a list of collisions for the devices', function() {
var m = nock('https://safety.vin.li')
.get('/api/v1/vehicles/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=0&limit=2')
.reply(200, {
collisions: [{
id: '06782175-735e-4226-82bc-ebdf887c30f3',
timestamp: '2015-07-13T17:45:04.583Z',
location: {
type: 'Point',
coordinates: [ -96.917009, 32.766392 ]
},
links: { self: 'http://172.17.0.114:3000/api/v1/collisions/06782175-735e-4226-82bc-ebdf887c30f3' }
}, {
id: '5b2bf92c-a2c5-4365-9f9b-3d51b8883ad6',
timestamp: '2015-07-13T17:46:04.583Z',
location: {
type: 'Point',
coordinates: [ -96.917009, 32.766392 ]
},
links: { self: 'http://172.17.0.114:3000/api/v1/collisions/5b2bf92c-a2c5-4365-9f9b-3d51b8883ad6' }
}],
meta: {
pagination: {
total: 3,
limit: 2,
offset: 0,
links: {
first: 'http://172.17.0.114:3000/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=0&limit=2',
last: 'http://172.17.0.114:3000/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=0&limit=2',
next: 'http://172.17.0.114:3000/api/v1/devices/c4627b29-14bd-49c3-8e6a-1f857143039f/collisions?offset=2&limit=2'
}
}
}
});
return Vinli.Vehicle.forge('c4627b29-14bd-49c3-8e6a-1f857143039f').collisions({ limit: 2 })
.then(function(collisions) {
expect(collisions).to.have.property('list').that.is.an('array');
expect(collisions.list).to.have.lengthOf(2);
expect(collisions.list[0]).to.be.instanceOf(Vinli.Collision);
expect(collisions).to.have.property('total', 3);
expect(collisions).to.have.property('next').that.is.a('function');
m.done();
});
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc