UNPKG

epitech-intranet

Version:

epitech intranet wrapper

57 lines (47 loc) 1.43 kB
// Generated by CoffeeScript 1.5.0 (function() { var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = [].slice; module.exports.Model = (function() { function Model(client) { this.client = client; this.attach = __bind(this.attach, this); this.request = __bind(this.request, this); this.setupRoutes = __bind(this.setupRoutes, this); this.globalRoutes = {}; this.localRoutes = {}; } Model.prototype.setupRoutes = function() {}; Model.prototype.debug = function() { var args; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; if (this.client.opts.verbose) { return console.log.apply(console, args); } }; Model.prototype.request = function(path, fn) { this.debug("Calling " + path); return this.client.request(path, fn); }; Model.prototype.attach = function() { var k, v, _ref, _ref1, _results; _ref = this.globalRoutes; for (k in _ref) { v = _ref[k]; this.client.__defineGetter__(k, (function() { return v; })); } _ref1 = this.localRoutes; _results = []; for (k in _ref1) { v = _ref1[k]; _results.push(this.__defineGetter__(k, (function() { return v; }))); } return _results; }; return Model; })(); }).call(this);