[FIX] moved get_uuid call to rest methods where it belongs; changed charts API tool to use ISO dates

This commit is contained in:
mDuo13
2015-04-06 13:35:11 -07:00
parent 4a3657fbea
commit 5e4bfcb626
3 changed files with 42 additions and 39 deletions

View File

@@ -4,8 +4,9 @@ var DOC_BASE = "charts_api.html";
var URL_BASE = "https://api.ripplecharts.com:443"; var URL_BASE = "https://api.ripplecharts.com:443";
var DEFAULT_ADDRESS_1 = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"; var DEFAULT_ADDRESS_1 = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn";
var DEFAULT_HASH = "9D591B18EDDD34F0B6CF4223A2940AEA2C3CC778925BABF289E0011CD8FA056E"; var TIME_20140101 = "2014-01-01T00:00:00.000Z";
var DEFAULT_LEDGER = "3170DA37CE2B7F045F889594CBC323D88686D2E90E8FFD2BBCD9BAD12E416DB5"; var TIME_20150101 = "2015-01-01T00:00:00.000Z";
var TIME_20150101_2 = "2015-01-01T02:00:00.000Z";
Request('Account Offers Exercised', { Request('Account Offers Exercised', {
@@ -16,7 +17,7 @@ Request('Account Offers Exercised', {
params: {}, params: {},
body: { body: {
account: DEFAULT_ADDRESS_1, account: DEFAULT_ADDRESS_1,
startTime: "2014", startTime: TIME_20140101,
limit: 5, limit: 5,
offset: 0, offset: 0,
format: "json" format: "json"
@@ -30,8 +31,8 @@ Request('Accounts Created', {
link: "#accounts-created", link: "#accounts-created",
params: {}, params: {},
body: { body: {
"startTime": "2014-01-01", "startTime": TIME_20140101,
"endTime": "2015-03-31", "endTime": "2015-03-31T00:00:00.000Z",
"timeIncrement": "month", "timeIncrement": "month",
"descending": true, "descending": true,
"reduce": true, "reduce": true,
@@ -88,8 +89,8 @@ Request('Issuer Capitalization', {
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q" "issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"
} }
], ],
"startTime": "Jan 1, 2014", "startTime": TIME_20140101,
"endTime": "Jan 1, 2015", "endTime": TIME_20150101,
"timeIncrement": "month" "timeIncrement": "month"
} }
}); });
@@ -101,8 +102,8 @@ Request('Ledgers Closed', {
link: "#ledgers-closed", link: "#ledgers-closed",
params: {}, params: {},
body: { body: {
"startTime": "2014-01-01", "startTime": TIME_20140101,
"endTime": "2015-01-01", "endTime": TIME_20150101,
"timeIncrement": "month", "timeIncrement": "month",
"descending": false, "descending": false,
"reduce": true, "reduce": true,
@@ -124,7 +125,7 @@ Request('Market Traders', {
"currency": "KRW", "currency": "KRW",
"issuer": "rUkMKjQitpgAM5WTGk79xpjT38DEJY283d" "issuer": "rUkMKjQitpgAM5WTGk79xpjT38DEJY283d"
}, },
"startTime": "2014-11-01", "startTime": TIME_20150101,
"transactions": true, "transactions": true,
"format": "json" "format": "json"
} }
@@ -144,8 +145,8 @@ Request('Offers', {
"counter": { "counter": {
"currency": "XRP" "currency": "XRP"
}, },
"startTime": "2015-03-01", "startTime": "2015-03-01T00:00:00.000Z",
"endTime": "2015-03-7", "endTime": "2015-03-07T00:00:00.000Z",
"timeIncrement": "day", "timeIncrement": "day",
"descending": false, "descending": false,
"reduce": true, "reduce": true,
@@ -168,8 +169,8 @@ Request('Offers Exercised', {
"currency": "BTC", "currency": "BTC",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}, },
"endTime": "2015-03-01T00:00Z", "endTime": TIME_20150101,
"startTime": "2015-03-01T12:00Z", "startTime": TIME_20150101_2,
"timeIncrement": "minute", "timeIncrement": "minute",
"timeMultiple": 15, "timeMultiple": 15,
"format": "json" "format": "json"
@@ -183,8 +184,8 @@ Request('Top Markets', {
link: "#top-markets", link: "#top-markets",
params: {}, params: {},
body: { body: {
"startTime": "2015-01-15 7:00 AM", "startTime": TIME_20150101,
"endTime": "2015-01-16 8:00 PM", "endTime": TIME_20150101_2,
"exchange": { "exchange": {
"currency": "USD", "currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
@@ -199,7 +200,7 @@ Request('Total Network Value', {
link: "#total-network-value", link: "#total-network-value",
params: {}, params: {},
body: { body: {
"time": "2014-12-24", "time": TIME_20150101,
"exchange":{ "exchange":{
"currency": "USD", "currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
@@ -214,8 +215,8 @@ Request('Total Value Sent', {
link: "#total-value-sent", link: "#total-value-sent",
params: {}, params: {},
body: { body: {
"startTime": "2014-01-15 7:00 AM", "startTime": TIME_20150101,
"endTime": "2014-01-16 8:00 PM", "endTime": TIME_20150101_2,
"exchange": { "exchange": {
"currency": "USD", "currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
@@ -230,8 +231,8 @@ Request('Transaction Stats', {
link: "#transaction-stats", link: "#transaction-stats",
params: {}, params: {},
body: { body: {
"startTime": "2015-01-15 07:00 Z", "startTime": TIME_20150101,
"endTime": "2015-01-15 10:00 Z", "endTime": TIME_20150101_2,
"timeIncrement": "hour", "timeIncrement": "hour",
"descending": true, "descending": true,
"reduce": true, "reduce": true,
@@ -248,8 +249,8 @@ Request('Value Sent', {
body: { body: {
"currency": "JPY", "currency": "JPY",
"issuer": "r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN", "issuer": "r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN",
"startTime": "2015-01-15 08:00 Z", "startTime": TIME_20150101,
"endTime": "2015-01-15 10:59 Z", "endTime": TIME_20150101_2,
"timeIncrement": "hour", "timeIncrement": "hour",
"descending": false, "descending": false,
"reduce": true, "reduce": true,

View File

@@ -306,4 +306,22 @@ Request("Generate UUID", {
link: "#create-client-resource-id" link: "#create-client-resource-id"
}); });
//helper to fill the default payment with a new UUID
function get_uuid(callback) {
$.get(URL_BASE + "/v1/uuid").done(callback);
}
$(document).ready(function(){
get_uuid(function(resp,status,xhr) {
requests["submit-payment"].body.client_resource_id = resp.uuid;
if (window.location.hash == "#submit-payment") {
//we might have already loaded the call by the time the AJAX
// completes, so refresh the default body.
// Debatably a bad idea, because if the AJAX takes so long that the
// user has already started editing the call, it'll reset it.
select_request("submit-payment");
}
});
});
//---------- End req. List ---------------------------// //---------- End req. List ---------------------------//

View File

@@ -190,11 +190,6 @@ function select_request(request) {
reset_response_area(); reset_response_area();
}; };
//helper to fill the default payment with a new UUID
function get_uuid(callback) {
$.get(URL_BASE + "/v1/uuid").done(callback);
}
function get_path() { function get_path() {
s = ""; s = "";
rest_url.find(".non_editable, .editable").each(function() { rest_url.find(".non_editable, .editable").each(function() {
@@ -270,17 +265,6 @@ $(document).ready(function() {
request_button.click(send_request); request_button.click(send_request);
//rest_method.change(update_method); //rest_method.change(update_method);
get_uuid(function(resp,status,xhr) {
requests["submit-payment"].body.client_resource_id = resp.uuid;
if (window.location.hash == "#submit-payment") {
//we might have already loaded the call by the time the AJAX
// completes, so refresh the default body.
// Debatably a bad idea, because if the AJAX takes so long that the
// user has already started editing the call, it'll reset it.
select_request("submit-payment");
}
});
if (window.location.hash) { if (window.location.hash) {
var cmd = window.location.hash.slice(1).toLowerCase(); var cmd = window.location.hash.slice(1).toLowerCase();
select_request(cmd); select_request(cmd);