Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #133 from Financial-Times/v2-client-v2-api
Browse files Browse the repository at this point in the history
V2 client v2 api
  • Loading branch information
richard-still-ft committed Apr 16, 2015
2 parents 5a34202 + 5714a98 commit ab42aba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/PathMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ clone = function (object) {
return JSON.parse(JSON.stringify(object));
};

var cacheBuster = function (id) {
if (id.indexOf('stub_id') > -1) {
return '';
} else {
return '&h=' + Math.round(Math.random() * 10000000000);
}
};

/* This has to exist because the API handles date strings incorrectly ✌.ʕʘ‿ʘʔ.✌
* The API needs the time zone to be zulu time, but won't accept '+00:00'. It needs 'Z' */
getApiDateStringForDateTime = function (dateTime) {
Expand Down Expand Up @@ -59,7 +67,7 @@ module.exports = PathMapper;
PathMapper.prototype.getContentPathFor = function (id) {
var paths = this.paths;
return PROTOCOL_PREFIX + paths.apiDomain + paths.item + id +
API_KEY_FIRST_PARAM + this.apiKey + this.features;
API_KEY_FIRST_PARAM + this.apiKey + this.features + cacheBuster(id);
};

PathMapper.prototype.getPagePathFor = function (id) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ft-api-client",
"version": "2.0.7",
"version": "2.0.8",
"repository": {
"type": "git",
"url": "https://github.com/Financial-Times/ft-api-client.git"
Expand Down

0 comments on commit ab42aba

Please sign in to comment.