2014-10-31 12:25:18 +01:00
|
|
|
var reqwest = require('reqwest');
|
|
|
|
|
2014-11-25 15:28:08 +01:00
|
|
|
var TYPE = 'json';
|
|
|
|
var CONTENT_TYPE = 'application/json';
|
2014-10-31 12:25:18 +01:00
|
|
|
|
2014-12-17 21:56:27 +01:00
|
|
|
FeatureStore = {
|
2014-11-14 12:56:23 +01:00
|
|
|
updateFeature: function (feature) {
|
2014-10-31 12:25:18 +01:00
|
|
|
return reqwest({
|
2014-11-14 12:56:23 +01:00
|
|
|
url: 'features/' + feature.name,
|
|
|
|
method: 'put',
|
2014-11-25 15:28:08 +01:00
|
|
|
type: TYPE,
|
|
|
|
contentType: CONTENT_TYPE,
|
2014-11-14 12:56:23 +01:00
|
|
|
data: JSON.stringify(feature)
|
2014-10-31 12:25:18 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
createFeature: function (feature) {
|
|
|
|
return reqwest({
|
|
|
|
url: 'features',
|
|
|
|
method: 'post',
|
2014-11-25 15:28:08 +01:00
|
|
|
type: TYPE,
|
|
|
|
contentType: CONTENT_TYPE,
|
2014-10-31 12:25:18 +01:00
|
|
|
data: JSON.stringify(feature)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2014-12-15 22:40:07 +01:00
|
|
|
archiveFeature: function (feature) {
|
|
|
|
return reqwest({
|
|
|
|
url: 'features/' + feature.name,
|
|
|
|
method: 'delete',
|
|
|
|
type: TYPE
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2014-10-31 12:25:18 +01:00
|
|
|
getFeatures: function () {
|
|
|
|
return reqwest({
|
|
|
|
url: 'features',
|
|
|
|
method: 'get',
|
2014-11-25 15:28:08 +01:00
|
|
|
type: TYPE
|
2014-10-31 12:25:18 +01:00
|
|
|
});
|
2014-12-17 21:56:27 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
getArchivedFeatures: function () {
|
|
|
|
return reqwest({
|
|
|
|
url: 'archive/features',
|
|
|
|
method: 'get',
|
|
|
|
type: TYPE
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
reviveFeature: function (feature) {
|
|
|
|
return reqwest({
|
|
|
|
url: 'archive/revive',
|
|
|
|
method: 'post',
|
|
|
|
type: TYPE,
|
|
|
|
contentType: CONTENT_TYPE,
|
|
|
|
data: JSON.stringify(feature)
|
|
|
|
});
|
2014-10-31 12:25:18 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = FeatureStore;
|