|
| 1 | +var Data, File, exports, |
| 2 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
| 3 | + hasProp = {}.hasOwnProperty; |
| 4 | + |
| 5 | +Data = require('./data.js'); |
| 6 | + |
| 7 | +File = (function(superClass) { |
| 8 | + extend(File, superClass); |
| 9 | + |
| 10 | + function File() { |
| 11 | + return File.__super__.constructor.apply(this, arguments); |
| 12 | + } |
| 13 | + |
| 14 | + File.prototype.putString = function(content, callback) { |
| 15 | + var headers; |
| 16 | + headers = { |
| 17 | + 'Content-Type': 'text/plain' |
| 18 | + }; |
| 19 | + return this.client.req('/v1/data/' + this.data_path, 'PUT', content, headers, callback); |
| 20 | + }; |
| 21 | + |
| 22 | + File.prototype.putJson = function(content, callback) { |
| 23 | + var headers; |
| 24 | + headers = { |
| 25 | + 'Content-Type': 'application/JSON' |
| 26 | + }; |
| 27 | + return this.client.req('/v1/data/' + this.data_path, 'PUT', content, headers, callback); |
| 28 | + }; |
| 29 | + |
| 30 | + File.prototype.getString = function(callback) { |
| 31 | + var headers; |
| 32 | + headers = { |
| 33 | + 'Accept': 'text/plain' |
| 34 | + }; |
| 35 | + return this.client.req('/v1/data/' + this.data_path, 'GET', '', headers, callback); |
| 36 | + }; |
| 37 | + |
| 38 | + File.prototype.getJson = function(callback) { |
| 39 | + var headers; |
| 40 | + headers = { |
| 41 | + 'Accept': 'application/JSON' |
| 42 | + }; |
| 43 | + return this.client.req('/v1/data/' + this.data_path, 'GET', '', headers, callback); |
| 44 | + }; |
| 45 | + |
| 46 | + return File; |
| 47 | + |
| 48 | +})(Data); |
| 49 | + |
| 50 | +module.exports = exports = File; |
0 commit comments