-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #491 from stripe/remi-add-usage-record-summary
Add support for usage record summaries
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
var StripeResource = require('../StripeResource'); | ||
var stripeMethod = StripeResource.method; | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'subscription_items', | ||
|
||
list: stripeMethod({ | ||
method: 'GET', | ||
path: '{subscriptionItem}/usage_record_summaries', | ||
urlParams: ['subscriptionItem'], | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../testUtils').getSpyableStripe(); | ||
var expect = require('chai').expect; | ||
|
||
describe('UsageRecordSummaries Resource', function() { | ||
describe('list', function() { | ||
it('Sends the correct request', function() { | ||
stripe.usageRecordSummaries.list('si_123', {}); | ||
|
||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/subscription_items/si_123/usage_record_summaries', | ||
headers: {}, | ||
data: {} | ||
}); | ||
}); | ||
|
||
it('Includes any options that were provided', function(done) { | ||
stripe.usageRecordSummaries.list('si_123', {}, { | ||
stripe_account: 'acct_456', | ||
}).then(function(record) { | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/subscription_items/si_123/usage_record_summaries', | ||
headers: { | ||
'Stripe-Account': 'acct_456' | ||
}, | ||
data: {} | ||
}); | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
it('Calls a given callback', function(done) { | ||
stripe.usageRecordSummaries.list('si_123', {}, function(error, record) { | ||
done(error); | ||
}); | ||
}); | ||
}); | ||
}); |