New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tol-api

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tol-api - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

29

lib/api.js

@@ -48,3 +48,3 @@ var request = require('request');

return tokenPromise.get('access_token');
return tokenPromise.get('body').get('access_token');
};

@@ -69,3 +69,3 @@

api.getResult = function(resource, id, parameters) {
return this.get(resource, id, parameters).get('result');
return this.get(resource, id, parameters).get('body').get('result');
};

@@ -88,3 +88,3 @@

return promises[0].then(_.bind(function(firstPage) {
for (var offset = this.settings.maxLimit; offset < firstPage.pagination.total; offset += this.settings.maxLimit) {
for (var offset = this.settings.maxLimit; offset < firstPage.body.pagination.total; offset += this.settings.maxLimit) {
promises.push(this.index(resource, _.extend({}, parameters, {offset: offset, limit: this.settings.maxLimit})));

@@ -94,3 +94,3 @@ }

return q.all(promises).then(function(pages) {
return _.flatten(_.pluck(pages, 'result'), true);
return _.flatten(_.pluck(_.pluck(pages, 'body'), 'result'), true);
});

@@ -100,2 +100,19 @@ }, this));

api.post = function(resource, parameters) {
var deferred = q.defer();
return this.getToken().then(_.bind(function(token) {
var req = {
url: this.urlFor(resource),
method: 'POST',
json: parameters,
headers: {'Authorization': 'Bearer ' + token}
};
request(req, resolveResponse(deferred, this, req));
return deferred.promise;
}, this));
}
api.set = function(setting, value) {

@@ -120,6 +137,6 @@ if (arguments.length == 1) {

}, api));
} else if (res.statusCode != 200) {
} else if (res.statusCode >= 400) {
deferred.reject({res: res, body: body});
} else {
deferred.resolve(body);
deferred.resolve({res: res, body: body});
}

@@ -126,0 +143,0 @@ };

{
"name": "tol-api",
"version": "0.4.2",
"version": "0.5.0",
"description": "TraderOnline api client",

@@ -5,0 +5,0 @@ "dependencies": {

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