Add info about selling/buying this series
@@ -999,6 +1002,105 @@ Add info about selling/buying thi
responseCount++;
+ return new Promise(function delayExecution(resolve) {
+ setTimeout(resolve, 500 /* 0.5 second */);
+
+ }).then(function returnResponse() {
+ return stubResponse.status == 500 ? Promise.reject(stubResponse) : Promise.resolve(stubResponse);
+ });
+ },
+ get: function (url) {
+ var possibleOutcomes = [ 'success'];
+ var outcome = possibleOutcomes[responseCount % possibleOutcomes.length];
+ var possibleResponses = {
+ '/series/100': {
+ 'success': {
+ status: 200,
+ data: [
+ {
+ id: 1,
+ sellerName: 'James Alan Hetfield',
+ sellerUrl: 'http://example.com/james-alan-hetfield',
+ buyerName: 'Eicca Toppinen',
+ buyerUrl: 'http://example.com/eicca-toppinen',
+ transactionUrl: 'http://example.com/james-alan-hetfield/selling-stamps',
+ firstPrice: 100,
+ firstCurrency: 'USD',
+ condition: 'CANCELLED'
+ },
+ {
+ id: 2,
+ sellerName: 'James Alan Hetfield',
+ sellerUrl: 'http://example.com/james-alan-hetfield',
+ transactionUrl: 'http://example.com/james-alan-hetfield/selling-stamps',
+ firstPrice: 100,
+ firstCurrency: 'USD',
+ secondPrice: 650,
+ secondCurrency: 'RUB',
+ condition: 'CANCELLED'
+ },
+ {
+ id: 3,
+ date: '02.02.2002',
+ sellerName: 'Tommy Lee Jones',
+ sellerUrl: 'http://example.com/tommy-lee-jones',
+ transactionUrl: 'http://example.com/tommy-lee-jones/selling-stamps',
+ firstPrice: 200,
+ firstCurrency: 'USD',
+ condition: 'MNH'
+ },
+ {
+ id: 4,
+ date: '02.02.2002',
+ sellerName: 'Tommy Lee Jones',
+ sellerUrl: 'http://example.com/tommy-lee-jones',
+ transactionUrl: 'http://example.com/tommy-lee-jones/selling-stamps',
+ firstPrice: 200,
+ firstCurrency: 'USD',
+ secondPrice: 1300,
+ secondCurrency: 'RUB',
+ },
+ {
+ id: 5,
+ date: '03.02.2002',
+ sellerName: 'Eicca Toppinen',
+ sellerUrl: 'http://example.com/eicca-toppinen',
+ transactionUrl: 'http://example.com/tommy-lee-jones/selling-stamps',
+ firstPrice: 300,
+ firstCurrency: 'USD',
+ secondPrice: 1560,
+ secondCurrency: 'RUB',
+ },
+ {
+ id: 6,
+ date: '03.02.2002',
+ sellerName: 'Eicca Toppinen',
+ sellerUrl: 'http://example.com/eicca-toppinen',
+ buyerName: 'Kurt Cobain',
+ firstPrice: 300,
+ firstCurrency: 'USD',
+ secondPrice: 1560,
+ secondCurrency: 'RUB',
+ }
+ ]
+ }
+ }
+ };
+ var stubResponse;
+
+ switch (outcome) {
+ case 'success':
+ stubResponse = possibleResponses[url][outcome];
+ break;
+ default:
+ stubResponse = {
+ status: 500,
+ statusText: 'Fake Server Error'
+ };
+ }
+
+ responseCount++;
+
return new Promise(function delayExecution(resolve) {
setTimeout(resolve, 500 /* 0.5 second */);
@@ -1105,6 +1207,39 @@ Add info about selling/buying thi
/*/-->
+
+
+
+
+
+