volos-quota-apigee
Advanced tools
Comparing version 0.11.5 to 0.12.0
@@ -136,6 +136,6 @@ /**************************************************************************** | ||
} else { | ||
superagent.agent(). | ||
get(self.options.uri + '/v2/version'). | ||
set('x-DNA-Api-Key', self.options.key). | ||
end(function(err, resp) { | ||
superagent | ||
.get(self.options.uri + '/v2/version') | ||
.set('x-DNA-Api-Key', self.options.key) | ||
.end(function(err, resp) { | ||
if (err) { | ||
@@ -230,8 +230,7 @@ debug('Error getting version: %s', err); | ||
debug('Remote quota request: %j', r); | ||
superagent.agent(). | ||
post(this.quota.options.uri + '/v2/quotas/apply'). | ||
set('x-DNA-Api-Key', this.quota.options.key). | ||
type('json'). | ||
send(r). | ||
end(function(err, resp) { | ||
superagent | ||
.post(this.quota.options.uri + '/v2/quotas/apply') | ||
.set('x-DNA-Api-Key', this.quota.options.key) | ||
.send(r) | ||
.end(function(err, resp) { | ||
if (err) { | ||
@@ -272,8 +271,8 @@ cb(err); | ||
debug('Old remote quota request: %j', r); | ||
superagent.agent(). | ||
post(this.quota.options.uri + '/quotas/distributed'). | ||
set('x-DNA-Api-Key', this.quota.options.key). | ||
type('form'). | ||
send(r). | ||
end(function(err, resp) { | ||
superagent | ||
.post(this.quota.options.uri + '/quotas/distributed') | ||
.set('x-DNA-Api-Key', this.quota.options.key) | ||
.type('form') | ||
.send(r) | ||
.end(function(err, resp) { | ||
if (err) { | ||
@@ -280,0 +279,0 @@ cb(err); |
{ | ||
"name": "volos-quota-apigee", | ||
"version": "0.11.5", | ||
"version": "0.12.0", | ||
"main": "lib/apigeequota.js", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"superagent": "0.x.x", | ||
"volos-quota-common": "0.10.x" | ||
"volos-quota-common": "0.11.x" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": {}, |
@@ -27,7 +27,8 @@ # volos-quota-apigee | ||
* timeUnit: How often the quota resets -- may be in minutes, hours, days, or weeks | ||
* timeUnit: How often the quota resets -- may be minute, hour, day, week, or month | ||
* interval: Works with the timeUnit to determine how often the quota resets. For instance, every 5 days or 2 weeks. | ||
* startTime: A time at which the quota calculations should begin. For instance, if there is no start time then a | ||
quota set to reset in "one day" will reset 24 hours after the first message is receiver, but if the start time | ||
is set to the top of the hour on some day, then the quota will always reset at the top of the hour. | ||
is set to the top of the hour on some day, then the quota will always reset at the top of the hour. Start time | ||
is not allowed for "month" timeUnit as it always uses Gregorian month boundaries. | ||
* allow: The maximum number of requests to allow. This may be overridden on each "apply" call if desired. | ||
@@ -34,0 +35,0 @@ * uri: The full URI of the Apigee adapter that you deployed in the last step. For instance, if the organization |
@@ -37,3 +37,3 @@ /**************************************************************************** | ||
this.timeout(120000); | ||
this.timeout(5000); | ||
@@ -76,2 +76,3 @@ function id(_id) { | ||
it('Minute', function(done) { | ||
this.timeout(120000); | ||
var hit = { identifier: id('TimeOne'), weight: 1 }; | ||
@@ -159,2 +160,3 @@ pm.apply(hit, function(err, result) { | ||
describe('Calendar', function() { | ||
// For each of these, verify that the parameters work and that we can | ||
@@ -168,3 +170,2 @@ // calculate the right expiration time. Do not wait for expiration | ||
} | ||
this.timeout(2000); | ||
var startTime = Date.now() - 59000; // start almost a minute ago | ||
@@ -183,3 +184,3 @@ var options = extend(config, { | ||
checkResult(result, 1, 1, true); | ||
result.expiryTime.should.be.approximately(1000, 500); | ||
result.expiryTime.should.be.approximately(250, 500); | ||
done(); | ||
@@ -193,3 +194,2 @@ }); | ||
} | ||
this.timeout(2000); | ||
var startTime = Date.now() - (60000 * 60 - 1000); // start almost an hour ago | ||
@@ -208,3 +208,3 @@ var options = extend(config, { | ||
checkResult(result, 1, 1, true); | ||
result.expiryTime.should.be.approximately(1000, 500); | ||
result.expiryTime.should.be.approximately(250, 500); | ||
done(); | ||
@@ -218,3 +218,2 @@ }); | ||
} | ||
this.timeout(2000); | ||
var startTime = Date.now() - (60000 * 60 * 24 - 1000); // start almost a day ago | ||
@@ -233,3 +232,3 @@ var options = extend(config, { | ||
checkResult(result, 1, 1, true); | ||
result.expiryTime.should.be.approximately(1000, 500); | ||
result.expiryTime.should.be.approximately(250, 500); | ||
done(); | ||
@@ -243,3 +242,2 @@ }); | ||
} | ||
this.timeout(2000); | ||
var startTime = Date.now() - (60000 * 60 * 24 * 7 - 1000); // start almost a week ago | ||
@@ -258,3 +256,3 @@ var options = extend(config, { | ||
checkResult(result, 1, 1, true); | ||
result.expiryTime.should.be.approximately(1000, 500); | ||
result.expiryTime.should.be.approximately(250, 500); | ||
done(); | ||
@@ -261,0 +259,0 @@ }); |
82
21056
477
+ Addedunderscore@1.12.1(transitive)
+ Addedvolos-quota-common@0.11.12(transitive)
- Removedunderscore@1.6.0(transitive)
- Removedvolos-quota-common@0.10.2(transitive)
Updatedvolos-quota-common@0.11.x