Sha256: fe55b36c50ca4ddf74fcc6e90fea291707f02f94ce0c6661dac4a7c7cb29e4a4
Contents?: true
Size: 944 Bytes
Versions: 10
Compression:
Stored size: 944 Bytes
Contents
var $, request; $ = require('jquery'); module.exports = { get: function(data) { return request.call(this, 'get', (this._id ? "" + this.route + "/" + this._id : this.route), data); }, put: function(data) { return request.call(this, 'put', (this._id ? "" + this.route + "/" + this._id : this.route), data); }, post: function(data) { return request.call(this, 'post', this.route, data); }, "delete": function(data) { return request.call(this, 'delete', this.route, data); } }; request = function(method, url, data) { var param_name; param_name = this.resource.param_name || this.resource.toString(); if (!data && this.json) { data = {}; data[param_name] = this.json(); } if (data && data[param_name]) { delete data[param_name]['id']; delete data[param_name]['_id']; } return $.ajax({ url: url, data: data, type: method, dataType: 'json', context: this }); };
Version data entries
10 entries across 10 versions & 1 rubygems