Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ExchangeRates API methods #405

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: {},
});
});
});
});