Sha256: b762f242555d02b0dd1df5369d96de16e81386184f3b76befb558fcb503b165a

Contents?: true

Size: 811 Bytes

Versions: 23

Compression:

Stored size: 811 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.route + "/" + this._id, data);
  },
  post: function(data) {
    return request.call(this, 'post', 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[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

23 entries across 14 versions & 1 rubygems

Version Path
ende-0.2.3 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.2.2 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.2.1 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.2.0 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.14 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.14 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.13 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.13 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.12 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.12 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.11 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.11 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.10 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.10 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.9 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.9 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.8 vendor/assets/components/indefinido-indemma/lib/record/rest.js
ende-0.1.8 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.7 vendor/components/indefinido-indemma/lib/record/rest.js
ende-0.1.7 vendor/assets/components/indefinido-indemma/lib/record/rest.js