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

ovh

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ovh - npm Package Compare versions

Comparing version 0.3.6 to 0.3.7

6

CHANGELOG.md
# Changelog
## 0.3.7
* Check time drift
## 0.3.6
* Fixes query string parameters.
* Fixes Proxy getter issue [096bff8].
* Remove exception in callREST.

@@ -7,0 +13,0 @@ ## 0.3.5

38

ovh.js

@@ -25,5 +25,14 @@ //

consumerKey: apiKeys.consumerKey || null };
this.wsList = {};
this.wsList = {
auth: {
type: 'REST',
path: '/auth',
host: 'api.ovh.com',
basePath: '/1.0',
internal: true
}
};
this.wsMetas = {};
this.options = options;
this.apiTimeDiff = null;

@@ -189,3 +198,5 @@ // Check and add implicit params in wsList

if (typeof(this.$value) !== 'undefined' && typeof(this.$value[name]) !== 'undefined') {
if (typeof(this.$value) !== 'undefined' &&
Object.prototype.toString.call(this.$value) != '[object Array]' &&
typeof(this.$value[name]) !== 'undefined') {
return this.$value[name];

@@ -252,6 +263,6 @@ }

OVHWS.prototype.proxyResponseREST = function (response, refer, callback) {
if (Object.prototype.toString.call(response) === '[object Array]') {
if (Object.prototype.toString.call(response) == '[object Array]') {
var result = [];
for (var i = 0 ; i < response.length ; ++i) {
result.push(this.proxyResponseHandlerREST(refer, response[i], response[i]));
result.push(this.proxyResponseHandlerREST(refer, response[i]));
}

@@ -273,4 +284,17 @@

OVHWS.prototype.callREST = function (apiName, httpMethod, path, params, callback, refer) {
// Time drift
if (this.apiTimeDiff === null && path !== '/auth/time') {
return this.callREST('auth', 'GET', '/auth/time', {}, function (success, time) {
if (!success) {
callback(false, 'Unable to fetch OVH API time');
}
else {
this.apiTimeDiff = time - Math.round(Date.now() / 1000);
this.callREST(apiName, httpMethod, path, params, callback, refer);
}
}.bind(this), refer);
}
if (apiName !== 'auth' && typeof(this.apiKeys.consumerKey) !== 'string') {
throw new Error('OVH API: No consumerKey defined.');
return callback(false, 'OVH API: No consumerKey defined.');
}

@@ -327,3 +351,3 @@

options.headers['X-Ovh-Consumer'] = this.apiKeys.consumerKey;
options.headers['X-Ovh-Timestamp'] = Math.round(Date.now() / 1000);
options.headers['X-Ovh-Timestamp'] = Math.round(Date.now() / 1000) + this.apiTimeDiff;
options.headers['X-Ovh-Signature'] = this.signREST(httpMethod, 'https://' + options.host + options.path,

@@ -499,3 +523,3 @@ params, options.headers['X-Ovh-Timestamp']);

for (var k in this.wsList) {
if (this.wsList.hasOwnProperty(k)) {
if (this.wsList.hasOwnProperty(k) && this.wsList[k].internal !== true) {
checkWS(k);

@@ -502,0 +526,0 @@ }

4

package.json
{
"name": "ovh",
"version": "0.3.6",
"version": "0.3.7",
"description": "An helper library to use OVH web services and REST APIs",

@@ -13,3 +13,3 @@ "homepage": "https://github.com/gierschv/node-ovh",

"engines": {
"node": ">= 0.8.0 <= 0.11"
"node": ">= 0.6 <= 0.11"
},

@@ -16,0 +16,0 @@ "repository": {

@@ -81,3 +81,13 @@ //

},
'Call method without CK': function (done) {
"use strict";
var rest = ovh({ vps: { type: 'REST', path: '/vps' } }, { appKey: 'XXX', appSecret: 'XXX' });
rest.vps.$get(function (success, error) {
assert.equal(success, false);
assert.equal(error, 'OVH API: No consumerKey defined.');
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