VRelationship.js 1.2 KB

123456789101112131415161718192021222324252627282930
  1. define([ "require", "utils/Globals", "models/BaseModel", "utils/UrlLinks" ], function(require, Globals, VBaseModel, UrlLinks) {
  2. "use strict";
  3. var VRelationship = VBaseModel.extend({
  4. urlRoot: UrlLinks.relationshipApiUrl(),
  5. defaults: {},
  6. serverSchema: {},
  7. idAttribute: "id",
  8. initialize: function() {
  9. this.modelName = "VRelationship";
  10. },
  11. toString: function() {
  12. return this.get("name");
  13. },
  14. getRelationship: function(token, options) {
  15. var url = UrlLinks.relationshipApiUrl(token);
  16. return options = _.extend({
  17. contentType: "application/json",
  18. dataType: "json"
  19. }, options), this.constructor.nonCrudOperation.call(this, url, "GET", options);
  20. },
  21. saveRelationship: function(options) {
  22. var url = UrlLinks.relationshipApiUrl();
  23. return options = _.extend({
  24. contentType: "application/json",
  25. dataType: "json"
  26. }, options), this.constructor.nonCrudOperation.call(this, url, "PUT", options);
  27. }
  28. }, {});
  29. return VRelationship;
  30. });