Permalink
Browse files

workaround for statement-ids per_page

  • Loading branch information...
1 parent 3efc9d6 commit 28c0a6de2154202e5048cf202110e5c408f347fb @chjj committed Nov 24, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/charged.js
View
@@ -211,7 +211,7 @@ Charged.prototype.getLatestSubscriptionStatement = function(sub, callback) {
var self = this;
var opt = {
- per_page: 100000
+ _per_page: 100000
// order: 'oldest_first'
};
@@ -937,6 +937,11 @@ Charged.prototype.get = function(path, query, callback, format) {
query = null;
}
+ // Per page:
+ // subscriptions, component usages: 200
+ // customers: 50
+ // statement-ids: 10000
+
if (query && query.per_page > 50 && query.page == null) {
var max = query.per_page
, out = [];
@@ -967,6 +972,11 @@ Charged.prototype.get = function(path, query, callback, format) {
return;
}
+ if (query && query._per_page) {
+ query.per_page = query._per_page;
+ delete query._per_page;
+ }
+
if (query) {
query = qs.stringify(query);
path += ~path.indexOf('?')

0 comments on commit 28c0a6d

Please sign in to comment.