diff --git a/lib/resources/Reporting/ReportRuns.js b/lib/resources/Reporting/ReportRuns.js new file mode 100644 index 0000000000..46d8a989d6 --- /dev/null +++ b/lib/resources/Reporting/ReportRuns.js @@ -0,0 +1,8 @@ +'use strict'; + +var StripeResource = require('../../StripeResource'); + +module.exports = StripeResource.extend({ + path: 'reporting/report_runs', + includeBasic: ['create', 'list', 'retrieve'], +}); diff --git a/lib/resources/Reporting/ReportTypes.js b/lib/resources/Reporting/ReportTypes.js new file mode 100644 index 0000000000..576c2aad4b --- /dev/null +++ b/lib/resources/Reporting/ReportTypes.js @@ -0,0 +1,8 @@ +'use strict'; + +var StripeResource = require('../../StripeResource'); + +module.exports = StripeResource.extend({ + path: 'reporting/report_types', + includeBasic: ['list', 'retrieve'], +}); diff --git a/lib/stripe.js b/lib/stripe.js index ddaa83000f..5889ff7a84 100644 --- a/lib/stripe.js +++ b/lib/stripe.js @@ -84,6 +84,10 @@ var resources = { Disputes: require('./resources/Issuing/Disputes'), Transactions: require('./resources/Issuing/Transactions'), }), + Reporting: resourceNamespace('reporting', { + ReportRuns: require('./resources/Reporting/ReportRuns'), + ReportTypes: require('./resources/Reporting/ReportTypes'), + }), Sigma: resourceNamespace('sigma', { ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'), }), diff --git a/test/resources/Reporting/ReportRuns.spec.js b/test/resources/Reporting/ReportRuns.spec.js new file mode 100644 index 0000000000..dddf1f2494 --- /dev/null +++ b/test/resources/Reporting/ReportRuns.spec.js @@ -0,0 +1,56 @@ +'use strict'; + +var stripe = require('../../testUtils').getSpyableStripe(); + +var expect = require('chai').expect; + +describe('Reporting', function () { + describe('ReportRuns Resource', function () { + describe('retrieve', function () { + it('Sends the correct request', function () { + stripe.reporting.reportRuns.retrieve('frr_123'); + + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/reporting/report_runs/frr_123', + headers: {}, + data: {}, + }); + }); + }); + + describe('create', function () { + it('Sends the correct request', function () { + stripe.reporting.reportRuns.create({ + parameters: { + connected_account: 'acct_123', + }, + report_type: 'activity.summary.1', + }); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'POST', + url: '/v1/reporting/report_runs', + headers: {}, + data: { + parameters: { + connected_account: 'acct_123', + }, + report_type: 'activity.summary.1', + }, + }); + }); + }); + + describe('list', function () { + it('Sends the correct request', function () { + stripe.reporting.reportRuns.list(); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/reporting/report_runs', + headers: {}, + data: {}, + }); + }); + }); + }); +}); diff --git a/test/resources/Reporting/ReportTypes.spec.js b/test/resources/Reporting/ReportTypes.spec.js new file mode 100644 index 0000000000..5f3a9c6126 --- /dev/null +++ b/test/resources/Reporting/ReportTypes.spec.js @@ -0,0 +1,34 @@ +'use strict'; + +var stripe = require('../../testUtils').getSpyableStripe(); + +var expect = require('chai').expect; + +describe('Reporting', function () { + describe('ReportTypes Resource', function () { + describe('retrieve', function () { + it('Sends the correct request', function () { + stripe.reporting.reportTypes.retrieve('activity.summary.1'); + + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/reporting/report_types/activity.summary.1', + headers: {}, + data: {}, + }); + }); + }); + + describe('list', function () { + it('Sends the correct request', function () { + stripe.reporting.reportTypes.list(); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/reporting/report_types', + headers: {}, + data: {}, + }); + }); + }); + }); +});