-
Notifications
You must be signed in to change notification settings - Fork 756
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 #515 from stripe/remi-add-radar-list
Add support for Radar ValueList and ValueListItem resources
- Loading branch information
Showing
5 changed files
with
168 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,8 @@ | ||
'use strict'; | ||
|
||
var StripeResource = require('../../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'radar/value_list_items', | ||
includeBasic: ['create', 'list', 'retrieve', 'del'], | ||
}); |
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,8 @@ | ||
'use strict'; | ||
|
||
var StripeResource = require('../../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'radar/value_lists', | ||
includeBasic: ['create', 'list', 'update', 'retrieve', 'del'], | ||
}); |
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,68 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../../../testUtils').getSpyableStripe(); | ||
|
||
var expect = require('chai').expect; | ||
|
||
describe('Radar', function () { | ||
describe('ValueLists Resource', function () { | ||
describe('retrieve', function () { | ||
it('Sends the correct request', function () { | ||
stripe.radar.valueListItems.retrieve('rsli_123'); | ||
|
||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/radar/value_list_items/rsli_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('create', function () { | ||
it('Sends the correct request', function () { | ||
stripe.radar.valueListItems.create({ | ||
value_list: 'rsl_123', | ||
value: 'value', | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/radar/value_list_items', | ||
headers: {}, | ||
data: { | ||
value_list: 'rsl_123', | ||
value: 'value', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', function () { | ||
it('Sends the correct request', function () { | ||
stripe.radar.valueListItems.list({ | ||
value_list: 'rsl_123', | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/radar/value_list_items', | ||
headers: {}, | ||
data: { | ||
value_list: 'rsl_123', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('del', function() { | ||
it('Sends the correct request', function() { | ||
stripe.radar.valueListItems.del('rsli_123'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: '/v1/radar/value_list_items/rsli_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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,80 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../../../testUtils').getSpyableStripe(); | ||
|
||
var expect = require('chai').expect; | ||
|
||
describe('Radar', function () { | ||
describe('ValueLists Resource', function () { | ||
describe('retrieve', function () { | ||
it('Sends the correct request', function () { | ||
stripe.radar.valueLists.retrieve('rsl_123'); | ||
|
||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/radar/value_lists/rsl_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('create', function () { | ||
it('Sends the correct request', function () { | ||
stripe.radar.valueLists.create({ | ||
alias: 'alias', | ||
name: 'name', | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/radar/value_lists', | ||
headers: {}, | ||
data: { | ||
alias: 'alias', | ||
name: 'name', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', function () { | ||
it('Sends the correct request', function () { | ||
stripe.radar.valueLists.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/radar/value_lists', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('del', function() { | ||
it('Sends the correct request', function() { | ||
stripe.radar.valueLists.del('rsl_123'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: '/v1/radar/value_lists/rsl_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', function() { | ||
it('Sends the correct request', function() { | ||
stripe.radar.valueLists.update('rsl_123', { | ||
metadata: {a: '1234'}, | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/radar/value_lists/rsl_123', | ||
headers: {}, | ||
data: { | ||
metadata: {a: '1234'}, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |