Skip to content

Commit

Permalink
fix qs functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Sep 26, 2012
1 parent e488076 commit 58ab243
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions lib/charged.js
Expand Up @@ -356,29 +356,19 @@ Charged.prototype.createRefund = function(sub, options, callback) {
Charged.prototype.getSubscriptionEvents = function(sub, options, callback) {
if (!callback) {
callback = options;
options = '';
}

if (options) {
options = '?=' + qs.stringify(options);
options = null;
}

var path = '/subscriptions/' + sub + '/events' + options;
return this.get(path, callback);
var path = '/subscriptions/' + sub + '/events';
return this.get(path, options, callback);
};

Charged.prototype.getEvents = function(options, callback) {
if (!callback) {
callback = options;
options = null;
}

if (options) {
options = '?=' + qs.stringify(options);
}

var path = '/events' + options;
return this.get(path, callback);
var path = '/events';
return this.get(path, options, callback);
};

/**
Expand Down Expand Up @@ -504,14 +494,10 @@ Charged.prototype.getStats = function(name, options, callback) {
Charged.prototype.getWebhooks = function(options, callback) {
if (!callback) {
callback = options;
options = '';
}

if (options) {
options = '?=' + qs.stringify(options);
options = null;
}

return this.get('/webhooks' + options, callback, 'webhook');
return this.get('/webhooks', options, callback, 'webhook');
};

Charged.prototype.resendWebhooks = function(options, callback) {
Expand Down

0 comments on commit 58ab243

Please sign in to comment.