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.3.10 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.9 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.8 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.7 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.6 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.5 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.4 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.3 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.2 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.1 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.3.0 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.21 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.20 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.19 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.18 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.17 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.16 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.15 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.14 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.2.13 vendor/components/indefinido-indemma/lib/record/rest.js