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.1.0 to 1.3.0

lib/code.js

5

lib/client.js

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

trip: 'trips',
diagnostic: 'diagnostic',
safety: 'safety'

@@ -40,2 +41,3 @@ };

trip: Joi.string().uri().required(),
diagnostic: Joi.string().uri().required(),
safety: Joi.string().uri().required()

@@ -68,2 +70,3 @@ }).optional()

this.Trip = require('./trip')(this);
this.Code = require('./code')(this);
this.Event = require('./event')(this);

@@ -163,2 +166,2 @@ this.Subscription = require('./subscription')(this);

module.exports = Client;
module.exports = Client;

@@ -24,3 +24,35 @@ var extend = require('extend');

};
Trip.prototype.snapshots = function(_options) {
var self = this;
_options = _options || {};
if (_options.all) {
var query = {
limit: 100,
fields: (_options.fields && _options.fields.length) ? _options.fields.join(',') : undefined
};
return client.getEntireLocationStream(self.links.snapshots + '&' + qs.stringify(query));
}
return client.getRaw(self.links.snapshots).then(function(resp) {
return resp.snapshots;
});
};
Trip.prototype.messages = function(_options) {
var self = this;
_options = _options || {};
if (_options.all) {
var query = {
limit: 100,
fields: (_options.fields && _options.fields.length) ? _options.fields.join(',') : undefined
};
return client.getEntireLocationStream(self.links.messages + '&' + qs.stringify(query));
}
return client.getRaw(self.links.messages).then(function(resp) {
return resp.messages;
});
};
Trip.fetch = function(id) {

@@ -27,0 +59,0 @@ return client.get('trip', 'trips/' + id).then(function(resp) {

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

Vehicle.prototype.codes = function(_options) {
var self = this;
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {});
Joi.assert(_options, Utils.paginationOptions);
return client.get('diagnostic', 'vehicles/' + this.id + '/codes', _options).then(function(resp) {
resp.codes = resp.codes.map(function(v) { return new client.Code(v); });
return Utils.listResponse(resp, 'codes', self.codes, self);
});
};
Vehicle.prototype.activeCodes = function(_options) {
var self = this;
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {});
Joi.assert(_options, Utils.paginationOptions);
_options = Hoek.merge({ state: 'active' }, _options);
return client.get('diagnostic', 'vehicles/' + this.id + '/codes', _options).then(function(resp) {
resp.codes = resp.codes.map(function(v) { return new client.Code(v); });
return Utils.listResponse(resp, 'codes', self.codes, self);
});
};
Vehicle.prototype.inactiveCodes = function(_options) {
var self = this;
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {});
Joi.assert(_options, Utils.paginationOptions);
_options = Hoek.merge({ state: 'inactive' }, _options);
return client.get('diagnostic', 'vehicles/' + this.id + '/codes', _options).then(function(resp) {
resp.codes = resp.codes.map(function(v) { return new client.Code(v); });
return Utils.listResponse(resp, 'codes', self.codes, self);
});
};
Vehicle.fetch = function(id) {

@@ -28,0 +63,0 @@ return client.get('platform', 'vehicles/' + id).then(function(resp) {

2

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

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

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

trip: 'http://foo.vin.li',
diagnostic: 'http://foo.vin.li',
safety: 'http://foo.vin.li'

@@ -111,2 +112,3 @@ }

expect(vinli).to.have.property('Trip');
expect(vinli).to.have.property('Code');
expect(vinli).to.have.property('Rule');

@@ -117,2 +119,2 @@ expect(vinli).to.have.property('Event');

});
});
});

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

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

@@ -80,3 +80,3 @@ var trip = Vinli.Trip.forge('asfdafdasfdsdf');

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

@@ -83,0 +83,0 @@ var trip = Vinli.Trip.forge('asfdafdasfdsdf');

@@ -120,2 +120,143 @@ var nock = require('nock');

describe('#codes()', function() {
it('should exist', function() {
var vehicle = Vinli.Vehicle.forge('fc8bdd0c-5be3-46d5-8582-b5b54052eca2');
expect(vehicle).to.have.property('codes').that.is.a('function');
});
it('should get a list of all diagnostic trouble codes', function() {
var m = nock('https://diagnostic.vin.li')
.get('/api/v1/vehicles/fc8bdd0c-5be3-46d5-8582-b5b54052eca2/codes?offset=0&limit=3')
.reply(200, {
meta: {
pagination: {
total: 4,
limit: 3,
offset: 0,
links: {
first: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=0&sortDirection=desc',
next: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=3&sortDirection=desc',
last: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=3&sortDirection=desc'
}
}
},
codes: [{
id: '61400110-aec8-4ed7-a3cb-1e47ce8f9fe1',
codeId: 'P0100'
}, {
id: '9640294c-1fe5-4365-85a2-6b40378762b7',
codeId: 'P0101'
}, {
id: 'd3d01d86-47a2-4ef9-926c-f69517c58fb9',
codeId: 'P0102'
}]
});
return Vinli.Vehicle.forge('fc8bdd0c-5be3-46d5-8582-b5b54052eca2')
.codes({ limit: 3 })
.then(function(codes) {
expect(codes).to.have.property('list').that.is.an('array');
expect(codes.list).to.have.lengthOf(3);
expect(codes.list[0]).to.be.an.instanceOf(Vinli.Code);
expect(codes).to.have.property('total', 4);
expect(codes).to.have.property('next').that.is.a('function');
m.done();
});
});
});
describe('#activeCodes()', function() {
it('should exist', function() {
var vehicle = Vinli.Vehicle.forge('fc8bdd0c-5be3-46d5-8582-b5b54052eca2');
expect(vehicle).to.have.property('activeCodes').that.is.a('function');
});
it('should get a list of active diagnostic trouble codes', function() {
var m = nock('https://diagnostic.vin.li')
.get('/api/v1/vehicles/fc8bdd0c-5be3-46d5-8582-b5b54052eca2/codes?state=active&offset=0&limit=3')
.reply(200, {
meta: {
pagination: {
total: 4,
limit: 3,
offset: 0,
links: {
first: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=0&sortDirection=desc',
next: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=3&sortDirection=desc',
last: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=3&sortDirection=desc'
}
}
},
codes: [{
id: '61400110-aec8-4ed7-a3cb-1e47ce8f9fe1',
codeId: 'P0100'
}, {
id: '9640294c-1fe5-4365-85a2-6b40378762b7',
codeId: 'P0101'
}, {
id: 'd3d01d86-47a2-4ef9-926c-f69517c58fb9',
codeId: 'P0102'
}]
});
return Vinli.Vehicle.forge('fc8bdd0c-5be3-46d5-8582-b5b54052eca2')
.activeCodes({ limit: 3 })
.then(function(codes) {
expect(codes).to.have.property('list').that.is.an('array');
expect(codes.list).to.have.lengthOf(3);
expect(codes.list[0]).to.be.an.instanceOf(Vinli.Code);
expect(codes).to.have.property('total', 4);
expect(codes).to.have.property('next').that.is.a('function');
m.done();
});
});
});
describe('#inactiveCodes()', function() {
it('should exist', function() {
var vehicle = Vinli.Vehicle.forge('fc8bdd0c-5be3-46d5-8582-b5b54052eca2');
expect(vehicle).to.have.property('inactiveCodes').that.is.a('function');
});
it('should get a list of inactive diagnostic trouble codes', function() {
var m = nock('https://diagnostic.vin.li')
.get('/api/v1/vehicles/fc8bdd0c-5be3-46d5-8582-b5b54052eca2/codes?state=inactive&offset=0&limit=3')
.reply(200, {
meta: {
pagination: {
total: 4,
limit: 3,
offset: 0,
links: {
first: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=0&sortDirection=desc',
next: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=3&sortDirection=desc',
last: '/api/v1/vehicles/fec0bf34-eb4e-49e2-b17c-83e21ff5d03a/codes?limit=3&offset=3&sortDirection=desc'
}
}
},
codes: [{
id: '61400110-aec8-4ed7-a3cb-1e47ce8f9fe1',
codeId: 'P0100'
}, {
id: '9640294c-1fe5-4365-85a2-6b40378762b7',
codeId: 'P0101'
}, {
id: 'd3d01d86-47a2-4ef9-926c-f69517c58fb9',
codeId: 'P0102'
}]
});
return Vinli.Vehicle.forge('fc8bdd0c-5be3-46d5-8582-b5b54052eca2')
.inactiveCodes({ limit: 3 })
.then(function(codes) {
expect(codes).to.have.property('list').that.is.an('array');
expect(codes.list).to.have.lengthOf(3);
expect(codes.list[0]).to.be.an.instanceOf(Vinli.Code);
expect(codes).to.have.property('total', 4);
expect(codes).to.have.property('next').that.is.a('function');
m.done();
});
});
});
xdescribe('#collisions()', function() {

@@ -127,2 +268,2 @@ it('should exist', function() {

});
});
});
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