crowdstart.js
Version:
Ecommerce SDK for JavaScript and client for Crowdstart.
57 lines (50 loc) • 1.23 kB
JavaScript
// Generated by CoffeeScript 1.10.0
var byId, endpoint, ref, statusCreated, statusNoContent, statusOk, upload;
ref = require('../utils'), statusCreated = ref.statusCreated, statusNoContent = ref.statusNoContent, statusOk = ref.statusOk;
endpoint = function(x) {
return x.siteId + "/deploy";
};
byId = function(x) {
var ref1;
return (endpoint(x)) + "/" + ((ref1 = x.id) != null ? ref1 : x.deployId);
};
upload = function(x) {
return (byId(x)) + "/" + x.path;
};
module.exports = function(blueprints) {
return blueprints.deploy = {
create: {
url: endpoint,
method: 'POST',
expects: statusCreated
},
update: {
url: byId,
method: 'PATCH',
expects: statusOk
},
"delete": {
url: byId,
method: 'DELETE',
expects: statusNoContent
},
restore: {
url: byId,
method: 'POST',
expects: statusOk
},
upload: {
url: upload,
method: 'PUT',
expects: statusOk,
headers: {
'Content-Type': 'application/octet-stream'
},
streams: function(x) {
return fs.createReadStream(x.absolutePath);
},
followRedirects: true
}
};
};
//# sourceMappingURL=deploy.js.map