pitney-bowes
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -24,2 +24,2 @@ module.exports = { | ||
} | ||
} | ||
}; |
30
index.js
@@ -91,2 +91,32 @@ const cache = require('memory-cache'); | ||
this.rate = function(shipment, _options, callback) { | ||
this.getOAuthToken(function(err, oAuthToken) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
const req = { | ||
auth: { | ||
bearer: oAuthToken.access_token | ||
}, | ||
headers: {}, | ||
json: shipment, | ||
method: 'POST', | ||
url: `${options.baseUrl}/v1/rates` | ||
}; | ||
request(req, function(err, res, body) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (res.statusCode !== 200) { | ||
return callback(createError(res.statusCode, body && body.length && body[0].message ? body[0] : body)); | ||
} | ||
callback(null, body); | ||
}); | ||
}); | ||
}; | ||
this.tracking = function(args, callback) { | ||
@@ -93,0 +123,0 @@ this.getOAuthToken(function(err, oAuthToken) { |
@@ -30,3 +30,3 @@ { | ||
}, | ||
"version": "0.1.2" | ||
"version": "0.2.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23358
185
1