Skip to content

Commit b4dc363

Browse files
committed
change capitalization currency parameter
1 parent 2b3e8c5 commit b4dc363

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

api/routesV2/capitalization.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ var hbase;
1111
var getCapitalization = function (req, res, next) {
1212

1313
var options = {
14-
currency: req.params.currency,
15-
issuer: req.params.issuer,
1614
start: smoment(req.query.start || 0),
1715
end: smoment(req.query.end),
1816
interval: req.query.interval,
@@ -23,6 +21,14 @@ var getCapitalization = function (req, res, next) {
2321
format: (req.query.format || 'json').toLowerCase()
2422
};
2523

24+
var currency = req.params.currency;
25+
26+
if (currency) {
27+
currency = currency.split(/[\+|\.]/); // any of +, |, or .
28+
options.currency = currency[0].toUpperCase();
29+
options.issuer = currency[1];
30+
}
31+
2632
if (!validator.isValidAddress(options.issuer)) {
2733
errorResponse({error: 'invalid issuer address', code: 400});
2834
return;

api/routesV2/getExchangeRate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var smoment = require('../../lib/smoment');
66
var response = require('response');
77
var hbase;
88

9-
var getExchanges = function(req, res) {
9+
var getExchangeRate = function(req, res) {
1010

1111
var options = {
1212
date: smoment(req.query.date),
@@ -87,5 +87,5 @@ var getExchanges = function(req, res) {
8787

8888
module.exports = function(db) {
8989
hbase = db;
90-
return getExchanges;
90+
return getExchangeRate;
9191
};

api/routesV2/getPayments.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ var getPayments = function (req, res, next) {
2121
format: (req.query.format || 'json').toLowerCase()
2222
};
2323

24-
// any of +, |, or .
2524
var currency = req.params.currency;
2625

2726
if (currency) {
28-
currency = currency.split(/[\+|\.]/);
27+
currency = currency.split(/[\+|\.]/); // any of +, |, or .
2928
options.currency = currency[0].toUpperCase();
3029
options.issuer = currency[1];
3130
}

api/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var Server = function (options) {
4848
app.get('/v2/gateways/:gateway?', routesV2.gateways.Gateways);
4949
app.get('/v2/gateways/:gateway/assets/:filename?', routesV2.gateways.Assets);
5050
app.get('/v2/currencies/:currencyAsset?', routesV2.gateways.Currencies);
51-
app.get('/v2/capitalization/:currency/:issuer', routesV2.capitalization);
51+
app.get('/v2/capitalization/:currency', routesV2.capitalization);
5252
app.get('/v2/active_accounts/:base/:counter', routesV2.activeAccounts);
5353
app.get('/v2/network/exchange_volume', routesV2.network.exchangeVolume);
5454
app.get('/v2/network/payment_volume', routesV2.network.paymentVolume);

0 commit comments

Comments
 (0)