2014-10-31 12:25:18 +01:00
|
|
|
var reqwest = require('reqwest');
|
|
|
|
|
|
|
|
var FeatureStore = function () {
|
|
|
|
};
|
|
|
|
|
|
|
|
FeatureStore.TYPE = 'json';
|
|
|
|
FeatureStore.CONTENT_TYPE = 'application/json';
|
|
|
|
|
|
|
|
FeatureStore.prototype = {
|
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-10-31 12:25:18 +01:00
|
|
|
type: FeatureStore.TYPE,
|
|
|
|
contentType: FeatureStore.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',
|
|
|
|
type: FeatureStore.TYPE,
|
|
|
|
contentType: FeatureStore.CONTENT_TYPE,
|
|
|
|
data: JSON.stringify(feature)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
getFeatures: function () {
|
|
|
|
return reqwest({
|
|
|
|
url: 'features',
|
|
|
|
method: 'get',
|
|
|
|
type: FeatureStore.TYPE
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = FeatureStore;
|