Sha256: 65ca832cbe02b5484967bcc93d65a1845750f0ca34230bf635a11ef836c64356

Contents?: true

Size: 992 Bytes

Versions: 43

Compression:

Stored size: 992 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._id ? "" + this.route + "/" + this._id : 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

43 entries across 43 versions & 1 rubygems

Version Path
ende-0.5.1 components/indefinido/indemma/master/lib/record/rest.js
ende-0.4.17 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.16 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.13 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.12 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.11 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.15 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.14 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.13 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.10 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.9 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.8 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.7 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.6 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.5 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.4 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.3 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.2 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.1 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.4.0 vendor/components/indefinido-indemma/lib/record/rest.js