// Generated by CoffeeScript 1.9.3 var ClientLoader, ClientOpts, ClientRenderer, Util, _, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; _ = require('lodash')._; Util = require('../utils'); ClientOpts = require('../config/ClientOptions'); ClientRenderer = (function(superClass) { extend(ClientRenderer, superClass); function ClientRenderer() { var e; try { (new ClientLoader).load((function(_this) { return function(e, __API) { _this.__API = __API; if (e != null) { throw new Error(e); } }; })(this)); } catch (_error) { e = _error; return console.log(e); } this.__template = "/*\n * client.js\n * API Client Generated by RikkiTikki\n */\n<%= core_api %>\n(function() {\n var NS = RikkiTikki.createScope('<%=ns%>');\n <% for (var key in opts) { %>\n <% if (opts[key]) { %>NS.<%= key.toUpperCase() %> = <%= typeof opts[key] == 'string' ? '\"'+opts[key]+'\"' : opts[key] %>;<% } %><% } %>\n}).call(this);"; } ClientRenderer.prototype.toSource = function() { var client_opts, ns; client_opts = new ClientOpts; ns = !((ns = client_opts.get('api_namespace')) === void 0 || ns === '') ? ns : 'Client'; return (_.template(this.__template))({ core_api: this.__API, opts: client_opts.valueOf(), ns: ns }); }; return ClientRenderer; })(Object); module.exports = ClientRenderer; ClientLoader = require('./ClientLoader');