diff --git a/lib/resources/Reviews.js b/lib/resources/Reviews.js new file mode 100644 index 0000000000..9eeb7f413e --- /dev/null +++ b/lib/resources/Reviews.js @@ -0,0 +1,18 @@ +'use strict'; + +var StripeResource = require('../StripeResource'); +var stripeMethod = StripeResource.method; + +module.exports = StripeResource.extend({ + + path: 'reviews', + + includeBasic: ['list', 'retrieve'], + + approve: stripeMethod({ + method: 'POST', + path: '/{id}/approve', + urlParams: ['id'], + }), +}); + diff --git a/lib/stripe.js b/lib/stripe.js index e3b0387306..e343a7697b 100644 --- a/lib/stripe.js +++ b/lib/stripe.js @@ -59,6 +59,7 @@ var resources = { RecipientCards: require('./resources/RecipientCards'), Recipients: require('./resources/Recipients'), Refunds: require('./resources/Refunds'), + Reviews: require('./resources/Reviews'), Skus: require('./resources/SKUs'), Sources: require('./resources/Sources'), SubscriptionItems: require('./resources/SubscriptionItems'), diff --git a/test/resources/Reviews.spec.js b/test/resources/Reviews.spec.js new file mode 100644 index 0000000000..850473afec --- /dev/null +++ b/test/resources/Reviews.spec.js @@ -0,0 +1,42 @@ +'use strict'; + +var stripe = require('../../testUtils').getSpyableStripe(); +var expect = require('chai').expect; + +describe('Review Resource', function() { + describe('retrieve', function() { + it('Sends the correct request', function() { + stripe.reviews.retrieve('prv_123'); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/reviews/prv_123', + data: {}, + headers: {}, + }); + }); + }); + + describe('list', function() { + it('Sends the correct request', function() { + stripe.reviews.list(); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/reviews', + data: {}, + headers: {}, + }); + }); + }); + + describe('approve', function() { + it('Sends the correct request', function() { + stripe.reviews.approve('prv_123', {amount: 23}); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'POST', + url: '/v1/reviews/prv_123/approve', + headers: {}, + data: {amount: 23}, + }); + }); + }); +});