Skip to content

Commit 2897f0c

Browse files
committed
Add support for the Reporting resources
1 parent d1c9ea8 commit 2897f0c

File tree

5 files changed

+110
-0
lines changed

5 files changed

+110
-0
lines changed

lib/resources/Reporting/ReportRuns.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
var StripeResource = require('../../StripeResource');
4+
5+
module.exports = StripeResource.extend({
6+
path: 'reporting/report_runs',
7+
includeBasic: ['create', 'list', 'retrieve'],
8+
});
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
var StripeResource = require('../../StripeResource');
4+
5+
module.exports = StripeResource.extend({
6+
path: 'reporting/report_types',
7+
includeBasic: ['list', 'retrieve'],
8+
});

lib/stripe.js

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ var resources = {
8484
Disputes: require('./resources/Issuing/Disputes'),
8585
Transactions: require('./resources/Issuing/Transactions'),
8686
}),
87+
Reporting: resourceNamespace('reporting', {
88+
ReportRuns: require('./resources/Reporting/ReportRuns'),
89+
ReportTypes: require('./resources/Reporting/ReportTypes'),
90+
}),
8791
Sigma: resourceNamespace('sigma', {
8892
ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'),
8993
}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use strict';
2+
3+
var stripe = require('../../testUtils').getSpyableStripe();
4+
5+
var expect = require('chai').expect;
6+
7+
describe('Reporting', function () {
8+
describe('ReportRuns Resource', function () {
9+
describe('retrieve', function () {
10+
it('Sends the correct request', function () {
11+
stripe.reporting.reportRuns.retrieve('frr_123');
12+
13+
expect(stripe.LAST_REQUEST).to.deep.equal({
14+
method: 'GET',
15+
url: '/v1/reporting/report_runs/frr_123',
16+
headers: {},
17+
data: {},
18+
});
19+
});
20+
});
21+
22+
describe('create', function () {
23+
it('Sends the correct request', function () {
24+
stripe.reporting.reportRuns.create({
25+
parameters: {
26+
connected_account: 'acct_123',
27+
},
28+
report_type: 'activity.summary.1',
29+
});
30+
expect(stripe.LAST_REQUEST).to.deep.equal({
31+
method: 'POST',
32+
url: '/v1/reporting/report_runs',
33+
headers: {},
34+
data: {
35+
parameters: {
36+
connected_account: 'acct_123',
37+
},
38+
report_type: 'activity.summary.1',
39+
},
40+
});
41+
});
42+
});
43+
44+
describe('list', function () {
45+
it('Sends the correct request', function () {
46+
stripe.reporting.reportRuns.list();
47+
expect(stripe.LAST_REQUEST).to.deep.equal({
48+
method: 'GET',
49+
url: '/v1/reporting/report_runs',
50+
headers: {},
51+
data: {},
52+
});
53+
});
54+
});
55+
});
56+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict';
2+
3+
var stripe = require('../../testUtils').getSpyableStripe();
4+
5+
var expect = require('chai').expect;
6+
7+
describe('Reporting', function () {
8+
describe('ReportTypes Resource', function () {
9+
describe('retrieve', function () {
10+
it('Sends the correct request', function () {
11+
stripe.reporting.reportTypes.retrieve('activity.summary.1');
12+
13+
expect(stripe.LAST_REQUEST).to.deep.equal({
14+
method: 'GET',
15+
url: '/v1/reporting/report_types/activity.summary.1',
16+
headers: {},
17+
data: {},
18+
});
19+
});
20+
});
21+
22+
describe('list', function () {
23+
it('Sends the correct request', function () {
24+
stripe.reporting.reportTypes.list();
25+
expect(stripe.LAST_REQUEST).to.deep.equal({
26+
method: 'GET',
27+
url: '/v1/reporting/report_types',
28+
headers: {},
29+
data: {},
30+
});
31+
});
32+
});
33+
});
34+
});

0 commit comments

Comments
 (0)