Skip to content

Commit

Permalink
Merge pull request #405 from stripe/ob-exchange-rates
Browse files Browse the repository at this point in the history
Add ExchangeRates API methods
  • Loading branch information
brandur-stripe authored Oct 31, 2017
2 parents 9e1d36a + 22490e0 commit a294d87
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/resources/ExchangeRates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

var StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({

path: 'exchange_rates',

includeBasic: [
'list', 'retrieve',
],
});
1 change: 1 addition & 0 deletions lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var resources = {
Disputes: require('./resources/Disputes'),
EphemeralKeys: require('./resources/EphemeralKeys'),
Events: require('./resources/Events'),
ExchangeRates: require('./resources/ExchangeRates'),
Invoices: require('./resources/Invoices'),
InvoiceItems: require('./resources/InvoiceItems'),
LoginLinks: require('./resources/LoginLinks'),
Expand Down
31 changes: 31 additions & 0 deletions test/resources/ExchangeRates.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

var stripe = require('../testUtils').getSpyableStripe();
var expect = require('chai').expect;

describe('ExchangeRates Resource', function() {
describe('list', function() {
it('Sends the correct request', function() {
stripe.exchangeRates.list();
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/exchange_rates',
data: {},
headers: {},
});
});
});

describe('retrieve', function() {
it('Sends the correct request', function() {
var currency = 'USD';
stripe.exchangeRates.retrieve(currency);
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/exchange_rates/' + currency,
data: {},
headers: {},
});
});
});
});

0 comments on commit a294d87

Please sign in to comment.