pitney-bowes
Advanced tools
Comparing version 0.2.0 to 0.3.0
10
index.js
@@ -9,3 +9,3 @@ const cache = require('memory-cache'); | ||
api_secret: '', | ||
baseUrl: 'https://api-sandbox.pitneybowes.com/shippingservices', | ||
baseUrl: 'https://shipping-api-sandbox.pitneybowes.com/shippingservices', | ||
baseTestUrl: 'https://api-test.pitneybowes.com' | ||
@@ -57,4 +57,6 @@ }, args); | ||
this.getOAuthToken = function(callback) { | ||
const url = `${options.baseUrl.replace('/shippingservices', '')}/oauth/token`; | ||
// Try to get the token from memory cache | ||
const oAuthToken = cache.get('pitney-bowes-oauth-token'); | ||
const oAuthToken = cache.get(url); | ||
@@ -74,3 +76,3 @@ if (oAuthToken) { | ||
method: 'POST', | ||
url: `${options.baseUrl.replace('/shippingservices', '')}/oauth/token` | ||
url | ||
}; | ||
@@ -88,3 +90,3 @@ | ||
// Put the token in memory cache | ||
cache.put('pitney-bowes-oauth-token', body, body.expiresIn * 1000 / 2); | ||
cache.put(url, body, body.expiresIn * 1000 / 2); | ||
@@ -91,0 +93,0 @@ callback(null, body); |
{ | ||
"dependencies": { | ||
"http-errors": "~1.7.1", | ||
"http-errors": "~1.8.0", | ||
"memory-cache": "~0.2.0", | ||
@@ -10,4 +10,4 @@ "request": "~2.88.0" | ||
"coveralls": "*", | ||
"istanbul": "*", | ||
"mocha": "*" | ||
"mocha": "*", | ||
"nyc": "*" | ||
}, | ||
@@ -28,6 +28,6 @@ "keywords": [ | ||
"scripts": { | ||
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --exit -R spec test/* && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", | ||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", | ||
"test": "mocha --exit --reporter spec test" | ||
}, | ||
"version": "0.2.0" | ||
"version": "0.3.0" | ||
} |
# pitney-bowes | ||
[![Build Status](https://travis-ci.org/mediocre/pitney-bowes.svg?branch=master)](https://travis-ci.org/mediocre/pitney-bowes) | ||
[![Coverage Status](https://coveralls.io/repos/github/mediocre/pitney-bowes/badge.svg?branch=master)](https://coveralls.io/github/mediocre/pitney-bowes?branch=master) | ||
[![Build Status](https://travis-ci.org/mediocre/pitney-bowes.svg?branch=main)](https://travis-ci.org/mediocre/pitney-bowes) | ||
[![Coverage Status](https://coveralls.io/repos/github/mediocre/pitney-bowes/badge.svg?branch=main)](https://coveralls.io/github/mediocre/pitney-bowes?branch=main) | ||
@@ -6,0 +6,0 @@ The Pitney Bowes Complete Shipping APIs let you integrate shipping services from multiple carriers, including USPS® and Newgistics®, into your services and applications. |
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
23723
6
186
+ Addedhttp-errors@1.8.1(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedtoidentifier@1.0.1(transitive)
- Removedhttp-errors@1.7.3(transitive)
- Removedsetprototypeof@1.1.1(transitive)
- Removedtoidentifier@1.0.0(transitive)
Updatedhttp-errors@~1.8.0