rack-swagger 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +13 -5
  2. data/.gitignore +1 -1
  3. data/README.md +85 -1
  4. data/Rakefile +30 -0
  5. data/lib/rack/swagger.rb +35 -1
  6. data/lib/rack/swagger/asset_server.rb +22 -0
  7. data/lib/rack/swagger/index_page_server.rb +32 -0
  8. data/lib/rack/swagger/json_server.rb +30 -0
  9. data/lib/rack/swagger/rentpath/logo_small.png +0 -0
  10. data/lib/rack/swagger/rentpath/rentpath.diff +47 -0
  11. data/lib/rack/swagger/routes_to_models.rb +111 -0
  12. data/lib/rack/swagger/server_helpers.rb +55 -0
  13. data/lib/rack/swagger/sinatra_helpers.rb +78 -0
  14. data/lib/rack/swagger/version.rb +1 -1
  15. data/rack-swagger.gemspec +8 -2
  16. data/spec/lib/rack/swagger/asset_server_spec.rb +18 -0
  17. data/spec/lib/rack/swagger/index_page_server_spec.rb +21 -0
  18. data/spec/lib/rack/swagger/routes_to_models_spec.rb +81 -0
  19. data/spec/lib/rack/swagger/server_helpers_spec.rb +44 -0
  20. data/spec/lib/rack/swagger/sinatra_helpers_spec.rb +85 -0
  21. data/spec/spec_helper.rb +25 -0
  22. data/swagger-ui/dist/css/reset.css +125 -0
  23. data/swagger-ui/dist/css/screen.css +1224 -0
  24. data/swagger-ui/dist/css/screen.css.orig +1224 -0
  25. data/swagger-ui/dist/images/explorer_icons.png +0 -0
  26. data/swagger-ui/dist/images/logo_small.png +0 -0
  27. data/swagger-ui/dist/images/pet_store_api.png +0 -0
  28. data/swagger-ui/dist/images/throbber.gif +0 -0
  29. data/swagger-ui/dist/images/wordnik_api.png +0 -0
  30. data/swagger-ui/dist/index.html +105 -0
  31. data/swagger-ui/dist/index.html.orig +105 -0
  32. data/swagger-ui/dist/lib/backbone-min.js +38 -0
  33. data/swagger-ui/dist/lib/handlebars-1.0.0.js +2278 -0
  34. data/swagger-ui/dist/lib/highlight.7.3.pack.js +1 -0
  35. data/swagger-ui/dist/lib/jquery-1.8.0.min.js +2 -0
  36. data/swagger-ui/dist/lib/jquery.ba-bbq.min.js +18 -0
  37. data/swagger-ui/dist/lib/jquery.slideto.min.js +1 -0
  38. data/swagger-ui/dist/lib/jquery.wiggle.min.js +8 -0
  39. data/swagger-ui/dist/lib/shred.bundle.js +2765 -0
  40. data/swagger-ui/dist/lib/shred/content.js +193 -0
  41. data/swagger-ui/dist/lib/swagger-client.js +1477 -0
  42. data/swagger-ui/dist/lib/swagger-oauth.js +211 -0
  43. data/swagger-ui/dist/lib/swagger.js +1678 -0
  44. data/swagger-ui/dist/lib/underscore-min.js +32 -0
  45. data/swagger-ui/dist/o2c.html +15 -0
  46. data/swagger-ui/dist/swagger-ui.js +2477 -0
  47. data/swagger-ui/dist/swagger-ui.min.js +1 -0
  48. data/swagger-ui/master.tar.gz +0 -0
  49. data/swagger-ui/swagger-ui-v2.0.22.tar +0 -0
  50. data/swagger_ui_version.yml +4 -0
  51. data/templates/swagger_ui_version.yml +4 -0
  52. metadata +132 -12
@@ -0,0 +1,32 @@
1
+ // Underscore.js 1.3.3
2
+ // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3
+ // Underscore is freely distributable under the MIT license.
4
+ // Portions of Underscore are inspired or borrowed from Prototype,
5
+ // Oliver Steele's Functional, and John Resig's Micro-Templating.
6
+ // For all details and documentation:
7
+ // http://documentcloud.github.com/underscore
8
+ (function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9
+ c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break;
10
+ g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a,
11
+ c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===o)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===o)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.map===z)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(A&&
12
+ a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,
13
+ c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,
14
+ a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15
+ function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&
16
+ (e={value:a,computed:b})});return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){d=Math.floor(Math.random()*(f+1));b[f]=b[d];b[d]=a});return b};b.sortBy=function(a,c,d){var e=b.isFunction(c)?c:function(a){return a[c]};return b.pluck(b.map(a,function(a,b,c){return{value:a,criteria:e.call(d,a,b,c)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c===void 0?1:d===void 0?-1:c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};
17
+ j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?i.call(a):a.toArray&&b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head=b.take=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,
18
+ 0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,
19
+ e=[];a.length<3&&(c=true);b.reduce(d,function(d,g,h){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[h])}return d},[]);return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=
20
+ i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(q&&a.indexOf===q)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(F&&a.lastIndexOf===F)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){if(arguments.length<=
21
+ 1){b=a||0;a=0}for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+d}return g};var H=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));H.prototype=a.prototype;var b=new H,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=
22
+ i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i,j=b.debounce(function(){h=
23
+ g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);j()},c));g?h=true:i=a.apply(d,e);j();g=true;return i}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments;d&&!e&&a.apply(f,g);clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));
24
+ return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&
25
+ c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=
26
+ function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"};
27
+ b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,
28
+ b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId=
29
+ function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape||
30
+ u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};
31
+ b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d,
32
+ this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
@@ -0,0 +1,15 @@
1
+ <script>
2
+ var qp = null;
3
+ if(window.location.hash) {
4
+ qp = location.hash.substring(1);
5
+ }
6
+ else {
7
+ qp = location.search.substring(1);
8
+ }
9
+ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
10
+ function(key, value) {
11
+ return key===""?value:decodeURIComponent(value) }
12
+ ):{}
13
+ window.opener.onOAuthComplete(qp);
14
+ window.close();
15
+ </script>
@@ -0,0 +1,2477 @@
1
+ // swagger-ui.js
2
+ // version 2.1.0-alpha.3
3
+ $(function() {
4
+
5
+ // Helper function for vertically aligning DOM elements
6
+ // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
7
+ $.fn.vAlign = function() {
8
+ return this.each(function(i){
9
+ var ah = $(this).height();
10
+ var ph = $(this).parent().height();
11
+ var mh = (ph - ah) / 2;
12
+ $(this).css('margin-top', mh);
13
+ });
14
+ };
15
+
16
+ $.fn.stretchFormtasticInputWidthToParent = function() {
17
+ return this.each(function(i){
18
+ var p_width = $(this).closest("form").innerWidth();
19
+ var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
20
+ var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
21
+ $(this).css('width', p_width - p_padding - this_padding);
22
+ });
23
+ };
24
+
25
+ $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
26
+
27
+ // Vertically center these paragraphs
28
+ // Parent may need a min-height for this to work..
29
+ $('ul.downplayed li div.content p').vAlign();
30
+
31
+ // When a sandbox form is submitted..
32
+ $("form.sandbox").submit(function(){
33
+
34
+ var error_free = true;
35
+
36
+ // Cycle through the forms required inputs
37
+ $(this).find("input.required").each(function() {
38
+
39
+ // Remove any existing error styles from the input
40
+ $(this).removeClass('error');
41
+
42
+ // Tack the error style on if the input is empty..
43
+ if ($(this).val() == '') {
44
+ $(this).addClass('error');
45
+ $(this).wiggle();
46
+ error_free = false;
47
+ }
48
+
49
+ });
50
+
51
+ return error_free;
52
+ });
53
+
54
+ });
55
+
56
+ function clippyCopiedCallback(a) {
57
+ $('#api_key_copied').fadeIn().delay(1000).fadeOut();
58
+
59
+ // var b = $("#clippy_tooltip_" + a);
60
+ // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
61
+ // b.attr("title", "copy to clipboard")
62
+ // },
63
+ // 500))
64
+ }
65
+
66
+ // Logging function that accounts for browsers that don't have window.console
67
+ log = function(){
68
+ log.history = log.history || [];
69
+ log.history.push(arguments);
70
+ if(this.console){
71
+ console.log( Array.prototype.slice.call(arguments)[0] );
72
+ }
73
+ };
74
+
75
+ // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
76
+ if (Function.prototype.bind && console && typeof console.log == "object") {
77
+ [
78
+ "log","info","warn","error","assert","dir","clear","profile","profileEnd"
79
+ ].forEach(function (method) {
80
+ console[method] = this.bind(console[method], console);
81
+ }, Function.prototype.call);
82
+ }
83
+
84
+ var Docs = {
85
+
86
+ shebang: function() {
87
+
88
+ // If shebang has an operation nickname in it..
89
+ // e.g. /docs/#!/words/get_search
90
+ var fragments = $.param.fragment().split('/');
91
+ fragments.shift(); // get rid of the bang
92
+
93
+ switch (fragments.length) {
94
+ case 1:
95
+ // Expand all operations for the resource and scroll to it
96
+ var dom_id = 'resource_' + fragments[0];
97
+
98
+ Docs.expandEndpointListForResource(fragments[0]);
99
+ $("#"+dom_id).slideto({highlight: false});
100
+ break;
101
+ case 2:
102
+ // Refer to the endpoint DOM element, e.g. #words_get_search
103
+
104
+ // Expand Resource
105
+ Docs.expandEndpointListForResource(fragments[0]);
106
+ $("#"+dom_id).slideto({highlight: false});
107
+
108
+ // Expand operation
109
+ var li_dom_id = fragments.join('_');
110
+ var li_content_dom_id = li_dom_id + "_content";
111
+
112
+
113
+ Docs.expandOperation($('#'+li_content_dom_id));
114
+ $('#'+li_dom_id).slideto({highlight: false});
115
+ break;
116
+ }
117
+
118
+ },
119
+
120
+ toggleEndpointListForResource: function(resource) {
121
+ var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
122
+ if (elem.is(':visible')) {
123
+ Docs.collapseEndpointListForResource(resource);
124
+ } else {
125
+ Docs.expandEndpointListForResource(resource);
126
+ }
127
+ },
128
+
129
+ // Expand resource
130
+ expandEndpointListForResource: function(resource) {
131
+ var resource = Docs.escapeResourceName(resource);
132
+ if (resource == '') {
133
+ $('.resource ul.endpoints').slideDown();
134
+ return;
135
+ }
136
+
137
+ $('li#resource_' + resource).addClass('active');
138
+
139
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
140
+ elem.slideDown();
141
+ },
142
+
143
+ // Collapse resource and mark as explicitly closed
144
+ collapseEndpointListForResource: function(resource) {
145
+ var resource = Docs.escapeResourceName(resource);
146
+ $('li#resource_' + resource).removeClass('active');
147
+
148
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
149
+ elem.slideUp();
150
+ },
151
+
152
+ expandOperationsForResource: function(resource) {
153
+ // Make sure the resource container is open..
154
+ Docs.expandEndpointListForResource(resource);
155
+
156
+ if (resource == '') {
157
+ $('.resource ul.endpoints li.operation div.content').slideDown();
158
+ return;
159
+ }
160
+
161
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
162
+ Docs.expandOperation($(this));
163
+ });
164
+ },
165
+
166
+ collapseOperationsForResource: function(resource) {
167
+ // Make sure the resource container is open..
168
+ Docs.expandEndpointListForResource(resource);
169
+
170
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
171
+ Docs.collapseOperation($(this));
172
+ });
173
+ },
174
+
175
+ escapeResourceName: function(resource) {
176
+ return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
177
+ },
178
+
179
+ expandOperation: function(elem) {
180
+ elem.slideDown();
181
+ },
182
+
183
+ collapseOperation: function(elem) {
184
+ elem.slideUp();
185
+ }
186
+ };(function() {
187
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
188
+ templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
189
+ this.compilerInfo = [4,'>= 1.0.0'];
190
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
191
+ var buffer = "", stack1, functionType="function", self=this;
192
+
193
+ function program1(depth0,data) {
194
+
195
+ var buffer = "", stack1;
196
+ buffer += "\n ";
197
+ stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
198
+ if(stack1 || stack1 === 0) { buffer += stack1; }
199
+ buffer += "\n";
200
+ return buffer;
201
+ }
202
+ function program2(depth0,data) {
203
+
204
+ var buffer = "", stack1;
205
+ buffer += "\n <option value=\"";
206
+ stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
207
+ if(stack1 || stack1 === 0) { buffer += stack1; }
208
+ buffer += "\">";
209
+ stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
210
+ if(stack1 || stack1 === 0) { buffer += stack1; }
211
+ buffer += "</option>\n ";
212
+ return buffer;
213
+ }
214
+
215
+ function program4(depth0,data) {
216
+
217
+
218
+ return "\n <option value=\"application/json\">application/json</option>\n";
219
+ }
220
+
221
+ buffer += "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
222
+ stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
223
+ if(stack1 || stack1 === 0) { buffer += stack1; }
224
+ buffer += "\n</select>\n";
225
+ return buffer;
226
+ });
227
+ })();
228
+
229
+ (function() {
230
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
231
+ templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
232
+ this.compilerInfo = [4,'>= 1.0.0'];
233
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
234
+ var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this;
235
+
236
+ function program1(depth0,data) {
237
+
238
+ var buffer = "", stack1, stack2;
239
+ buffer += "\n <div class=\"info_title\">"
240
+ + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
241
+ + "</div>\n <div class=\"info_description\">";
242
+ stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
243
+ if(stack2 || stack2 === 0) { buffer += stack2; }
244
+ buffer += "</div>\n ";
245
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
246
+ if(stack2 || stack2 === 0) { buffer += stack2; }
247
+ buffer += "\n ";
248
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
249
+ if(stack2 || stack2 === 0) { buffer += stack2; }
250
+ buffer += "\n ";
251
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
252
+ if(stack2 || stack2 === 0) { buffer += stack2; }
253
+ buffer += "\n ";
254
+ return buffer;
255
+ }
256
+ function program2(depth0,data) {
257
+
258
+ var buffer = "", stack1;
259
+ buffer += "<div class=\"info_tos\"><a href=\""
260
+ + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
261
+ + "\">Terms of service</a></div>";
262
+ return buffer;
263
+ }
264
+
265
+ function program4(depth0,data) {
266
+
267
+ var buffer = "", stack1;
268
+ buffer += "<div class='info_contact'><a href=\"mailto:"
269
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
270
+ + "\">Contact the developer</a></div>";
271
+ return buffer;
272
+ }
273
+
274
+ function program6(depth0,data) {
275
+
276
+ var buffer = "", stack1;
277
+ buffer += "<div class='info_license'><a href='"
278
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),stack1 == null || stack1 === false ? stack1 : stack1.url)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
279
+ + "'>"
280
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
281
+ + "</a></div>";
282
+ return buffer;
283
+ }
284
+
285
+ function program8(depth0,data) {
286
+
287
+ var buffer = "", stack1;
288
+ buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: "
289
+ + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
290
+ + "\n ";
291
+ return buffer;
292
+ }
293
+
294
+ function program10(depth0,data) {
295
+
296
+ var buffer = "", stack1;
297
+ buffer += "\n <span style=\"float:right\"><a href=\"";
298
+ if (stack1 = helpers.validatorUrl) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
299
+ else { stack1 = depth0.validatorUrl; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
300
+ buffer += escapeExpression(stack1)
301
+ + "/debug?url=";
302
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
303
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
304
+ buffer += escapeExpression(stack1)
305
+ + "\"><img id=\"validator\" src=\"";
306
+ if (stack1 = helpers.validatorUrl) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
307
+ else { stack1 = depth0.validatorUrl; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
308
+ buffer += escapeExpression(stack1)
309
+ + "?url=";
310
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
311
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
312
+ buffer += escapeExpression(stack1)
313
+ + "\"></a>\n </span>\n ";
314
+ return buffer;
315
+ }
316
+
317
+ buffer += "<div class='info' id='api_info'>\n ";
318
+ stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
319
+ if(stack1 || stack1 === 0) { buffer += stack1; }
320
+ buffer += "\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
321
+ if (stack1 = helpers.basePath) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
322
+ else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
323
+ buffer += escapeExpression(stack1)
324
+ + "\n ";
325
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
326
+ if(stack2 || stack2 === 0) { buffer += stack2; }
327
+ buffer += "]\n ";
328
+ stack2 = helpers['if'].call(depth0, depth0.validatorUrl, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
329
+ if(stack2 || stack2 === 0) { buffer += stack2; }
330
+ buffer += "\n </h4>\n </div>\n</div>\n";
331
+ return buffer;
332
+ });
333
+ })();
334
+
335
+ (function() {
336
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
337
+ templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
338
+ this.compilerInfo = [4,'>= 1.0.0'];
339
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
340
+ var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
341
+
342
+ function program1(depth0,data) {
343
+
344
+
345
+ return "deprecated";
346
+ }
347
+
348
+ function program3(depth0,data) {
349
+
350
+
351
+ return "\n <h4>Warning: Deprecated</h4>\n ";
352
+ }
353
+
354
+ function program5(depth0,data) {
355
+
356
+ var buffer = "", stack1;
357
+ buffer += "\n <h4>Implementation Notes</h4>\n <p>";
358
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
359
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
360
+ if(stack1 || stack1 === 0) { buffer += stack1; }
361
+ buffer += "</p>\n ";
362
+ return buffer;
363
+ }
364
+
365
+ function program7(depth0,data) {
366
+
367
+
368
+ return "\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
369
+ }
370
+
371
+ function program9(depth0,data) {
372
+
373
+ var buffer = "", stack1;
374
+ buffer += "\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n ";
375
+ stack1 = helpers.each.call(depth0, depth0, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
376
+ if(stack1 || stack1 === 0) { buffer += stack1; }
377
+ buffer += "\n </div>\n ";
378
+ return buffer;
379
+ }
380
+ function program10(depth0,data) {
381
+
382
+ var buffer = "", stack1, stack2;
383
+ buffer += "\n <div title='";
384
+ stack2 = ((stack1 = depth0.description),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
385
+ if(stack2 || stack2 === 0) { buffer += stack2; }
386
+ buffer += "'>"
387
+ + escapeExpression(((stack1 = depth0.scope),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
388
+ + "</div>\n ";
389
+ return buffer;
390
+ }
391
+
392
+ function program12(depth0,data) {
393
+
394
+
395
+ return "</div>";
396
+ }
397
+
398
+ function program14(depth0,data) {
399
+
400
+
401
+ return "\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n ";
402
+ }
403
+
404
+ function program16(depth0,data) {
405
+
406
+
407
+ return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
408
+ }
409
+
410
+ function program18(depth0,data) {
411
+
412
+
413
+ return "\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";
414
+ }
415
+
416
+ function program20(depth0,data) {
417
+
418
+
419
+ return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
420
+ }
421
+
422
+ function program22(depth0,data) {
423
+
424
+
425
+ return "\n ";
426
+ }
427
+
428
+ function program24(depth0,data) {
429
+
430
+
431
+ return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n ";
432
+ }
433
+
434
+ buffer += "\n <ul class='operations' >\n <li class='";
435
+ if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
436
+ else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
437
+ buffer += escapeExpression(stack1)
438
+ + " operation' id='";
439
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
440
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
441
+ buffer += escapeExpression(stack1)
442
+ + "_";
443
+ if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
444
+ else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
445
+ buffer += escapeExpression(stack1)
446
+ + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
447
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
448
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
449
+ buffer += escapeExpression(stack1)
450
+ + "/";
451
+ if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
452
+ else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
453
+ buffer += escapeExpression(stack1)
454
+ + "' class=\"toggleOperation\">";
455
+ if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
456
+ else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
457
+ buffer += escapeExpression(stack1)
458
+ + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
459
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
460
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
461
+ buffer += escapeExpression(stack1)
462
+ + "/";
463
+ if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
464
+ else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
465
+ buffer += escapeExpression(stack1)
466
+ + "' class=\"toggleOperation ";
467
+ stack1 = helpers['if'].call(depth0, depth0.deprecated, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
468
+ if(stack1 || stack1 === 0) { buffer += stack1; }
469
+ buffer += "\">";
470
+ if (stack1 = helpers.path) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
471
+ else { stack1 = depth0.path; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
472
+ buffer += escapeExpression(stack1)
473
+ + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
474
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
475
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
476
+ buffer += escapeExpression(stack1)
477
+ + "/";
478
+ if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
479
+ else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
480
+ buffer += escapeExpression(stack1)
481
+ + "' class=\"toggleOperation\">";
482
+ if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
483
+ else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
484
+ if(stack1 || stack1 === 0) { buffer += stack1; }
485
+ buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
486
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
487
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
488
+ buffer += escapeExpression(stack1)
489
+ + "_";
490
+ if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
491
+ else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
492
+ buffer += escapeExpression(stack1)
493
+ + "_content' style='display:none'>\n ";
494
+ stack1 = helpers['if'].call(depth0, depth0.deprecated, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
495
+ if(stack1 || stack1 === 0) { buffer += stack1; }
496
+ buffer += "\n ";
497
+ stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
498
+ if(stack1 || stack1 === 0) { buffer += stack1; }
499
+ buffer += "\n ";
500
+ options = {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data};
501
+ if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
502
+ else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
503
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
504
+ if(stack1 || stack1 === 0) { buffer += stack1; }
505
+ buffer += "\n ";
506
+ stack1 = helpers.each.call(depth0, depth0.oauth, {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
507
+ if(stack1 || stack1 === 0) { buffer += stack1; }
508
+ buffer += "\n ";
509
+ options = {hash:{},inverse:self.noop,fn:self.program(12, program12, data),data:data};
510
+ if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
511
+ else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
512
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
513
+ if(stack1 || stack1 === 0) { buffer += stack1; }
514
+ buffer += "\n ";
515
+ options = {hash:{},inverse:self.noop,fn:self.program(14, program14, data),data:data};
516
+ if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
517
+ else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
518
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
519
+ if(stack1 || stack1 === 0) { buffer += stack1; }
520
+ buffer += "\n ";
521
+ stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(16, program16, data),data:data});
522
+ if(stack1 || stack1 === 0) { buffer += stack1; }
523
+ buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
524
+ stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(18, program18, data),data:data});
525
+ if(stack1 || stack1 === 0) { buffer += stack1; }
526
+ buffer += "\n ";
527
+ stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(20, program20, data),data:data});
528
+ if(stack1 || stack1 === 0) { buffer += stack1; }
529
+ buffer += "\n ";
530
+ stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(24, program24, data),fn:self.program(22, program22, data),data:data});
531
+ if(stack1 || stack1 === 0) { buffer += stack1; }
532
+ buffer += "\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
533
+ return buffer;
534
+ });
535
+ })();
536
+
537
+ (function() {
538
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
539
+ templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
540
+ this.compilerInfo = [4,'>= 1.0.0'];
541
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
542
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
543
+
544
+ function program1(depth0,data) {
545
+
546
+ var buffer = "", stack1;
547
+ buffer += "\n ";
548
+ stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
549
+ if(stack1 || stack1 === 0) { buffer += stack1; }
550
+ buffer += "\n ";
551
+ return buffer;
552
+ }
553
+ function program2(depth0,data) {
554
+
555
+ var buffer = "", stack1;
556
+ buffer += "\n <input type=\"file\" name='";
557
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
558
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
559
+ buffer += escapeExpression(stack1)
560
+ + "'/>\n <div class=\"parameter-content-type\" />\n ";
561
+ return buffer;
562
+ }
563
+
564
+ function program4(depth0,data) {
565
+
566
+ var buffer = "", stack1;
567
+ buffer += "\n ";
568
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
569
+ if(stack1 || stack1 === 0) { buffer += stack1; }
570
+ buffer += "\n ";
571
+ return buffer;
572
+ }
573
+ function program5(depth0,data) {
574
+
575
+ var buffer = "", stack1;
576
+ buffer += "\n <textarea class='body-textarea' name='";
577
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
578
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
579
+ buffer += escapeExpression(stack1)
580
+ + "'>";
581
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
582
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
583
+ buffer += escapeExpression(stack1)
584
+ + "</textarea>\n ";
585
+ return buffer;
586
+ }
587
+
588
+ function program7(depth0,data) {
589
+
590
+ var buffer = "", stack1;
591
+ buffer += "\n <textarea class='body-textarea' name='";
592
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
593
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
594
+ buffer += escapeExpression(stack1)
595
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
596
+ return buffer;
597
+ }
598
+
599
+ function program9(depth0,data) {
600
+
601
+ var buffer = "", stack1;
602
+ buffer += "\n ";
603
+ stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(10, program10, data),fn:self.program(2, program2, data),data:data});
604
+ if(stack1 || stack1 === 0) { buffer += stack1; }
605
+ buffer += "\n ";
606
+ return buffer;
607
+ }
608
+ function program10(depth0,data) {
609
+
610
+ var buffer = "", stack1;
611
+ buffer += "\n ";
612
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(13, program13, data),fn:self.program(11, program11, data),data:data});
613
+ if(stack1 || stack1 === 0) { buffer += stack1; }
614
+ buffer += "\n ";
615
+ return buffer;
616
+ }
617
+ function program11(depth0,data) {
618
+
619
+ var buffer = "", stack1;
620
+ buffer += "\n <input class='parameter' minlength='0' name='";
621
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
622
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
623
+ buffer += escapeExpression(stack1)
624
+ + "' placeholder='' type='text' value='";
625
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
626
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
627
+ buffer += escapeExpression(stack1)
628
+ + "'/>\n ";
629
+ return buffer;
630
+ }
631
+
632
+ function program13(depth0,data) {
633
+
634
+ var buffer = "", stack1;
635
+ buffer += "\n <input class='parameter' minlength='0' name='";
636
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
637
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
638
+ buffer += escapeExpression(stack1)
639
+ + "' placeholder='' type='text' value=''/>\n ";
640
+ return buffer;
641
+ }
642
+
643
+ buffer += "<td class='code'>";
644
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
645
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
646
+ buffer += escapeExpression(stack1)
647
+ + "</td>\n<td>\n\n ";
648
+ stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
649
+ if(stack1 || stack1 === 0) { buffer += stack1; }
650
+ buffer += "\n\n</td>\n<td>";
651
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
652
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
653
+ if(stack1 || stack1 === 0) { buffer += stack1; }
654
+ buffer += "</td>\n<td>";
655
+ if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
656
+ else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
657
+ if(stack1 || stack1 === 0) { buffer += stack1; }
658
+ buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
659
+ return buffer;
660
+ });
661
+ })();
662
+
663
+ (function() {
664
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
665
+ templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
666
+ this.compilerInfo = [4,'>= 1.0.0'];
667
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
668
+ var buffer = "", stack1, stack2, options, self=this, helperMissing=helpers.helperMissing, functionType="function", escapeExpression=this.escapeExpression;
669
+
670
+ function program1(depth0,data) {
671
+
672
+
673
+ return " multiple='multiple'";
674
+ }
675
+
676
+ function program3(depth0,data) {
677
+
678
+
679
+ return "\n ";
680
+ }
681
+
682
+ function program5(depth0,data) {
683
+
684
+ var buffer = "", stack1;
685
+ buffer += "\n ";
686
+ stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
687
+ if(stack1 || stack1 === 0) { buffer += stack1; }
688
+ buffer += "\n ";
689
+ return buffer;
690
+ }
691
+ function program6(depth0,data) {
692
+
693
+
694
+ return "\n ";
695
+ }
696
+
697
+ function program8(depth0,data) {
698
+
699
+ var buffer = "", stack1, stack2, options;
700
+ buffer += "\n ";
701
+ options = {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data};
702
+ stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
703
+ if(stack2 || stack2 === 0) { buffer += stack2; }
704
+ buffer += "\n ";
705
+ return buffer;
706
+ }
707
+ function program9(depth0,data) {
708
+
709
+
710
+ return "\n ";
711
+ }
712
+
713
+ function program11(depth0,data) {
714
+
715
+
716
+ return "\n <option selected=\"\" value=''></option>\n ";
717
+ }
718
+
719
+ function program13(depth0,data) {
720
+
721
+ var buffer = "", stack1;
722
+ buffer += "\n ";
723
+ stack1 = helpers['if'].call(depth0, depth0.isDefault, {hash:{},inverse:self.program(16, program16, data),fn:self.program(14, program14, data),data:data});
724
+ if(stack1 || stack1 === 0) { buffer += stack1; }
725
+ buffer += "\n ";
726
+ return buffer;
727
+ }
728
+ function program14(depth0,data) {
729
+
730
+ var buffer = "", stack1;
731
+ buffer += "\n <option selected=\"\" value='";
732
+ if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
733
+ else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
734
+ buffer += escapeExpression(stack1)
735
+ + "'>";
736
+ if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
737
+ else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
738
+ buffer += escapeExpression(stack1)
739
+ + " (default)</option>\n ";
740
+ return buffer;
741
+ }
742
+
743
+ function program16(depth0,data) {
744
+
745
+ var buffer = "", stack1;
746
+ buffer += "\n <option value='";
747
+ if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
748
+ else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
749
+ buffer += escapeExpression(stack1)
750
+ + "'>";
751
+ if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
752
+ else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
753
+ buffer += escapeExpression(stack1)
754
+ + "</option>\n ";
755
+ return buffer;
756
+ }
757
+
758
+ buffer += "<td class='code'>";
759
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
760
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
761
+ buffer += escapeExpression(stack1)
762
+ + "</td>\n<td>\n <select ";
763
+ options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
764
+ stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
765
+ if(stack2 || stack2 === 0) { buffer += stack2; }
766
+ buffer += " class='parameter' name='";
767
+ if (stack2 = helpers.name) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
768
+ else { stack2 = depth0.name; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
769
+ buffer += escapeExpression(stack2)
770
+ + "'>\n ";
771
+ stack2 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
772
+ if(stack2 || stack2 === 0) { buffer += stack2; }
773
+ buffer += "\n ";
774
+ stack2 = helpers.each.call(depth0, ((stack1 = depth0.allowableValues),stack1 == null || stack1 === false ? stack1 : stack1.descriptiveValues), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
775
+ if(stack2 || stack2 === 0) { buffer += stack2; }
776
+ buffer += "\n </select>\n</td>\n<td>";
777
+ if (stack2 = helpers.description) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
778
+ else { stack2 = depth0.description; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
779
+ if(stack2 || stack2 === 0) { buffer += stack2; }
780
+ buffer += "</td>\n<td>";
781
+ if (stack2 = helpers.paramType) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
782
+ else { stack2 = depth0.paramType; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
783
+ if(stack2 || stack2 === 0) { buffer += stack2; }
784
+ buffer += "</td>\n<td><span class=\"model-signature\"></span></td>";
785
+ return buffer;
786
+ });
787
+ })();
788
+
789
+ (function() {
790
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
791
+ templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
792
+ this.compilerInfo = [4,'>= 1.0.0'];
793
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
794
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
795
+
796
+ function program1(depth0,data) {
797
+
798
+ var buffer = "", stack1;
799
+ buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
800
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
801
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
802
+ buffer += escapeExpression(stack1)
803
+ + "'>";
804
+ if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
805
+ else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
806
+ buffer += escapeExpression(stack1)
807
+ + "</textarea>\n ";
808
+ return buffer;
809
+ }
810
+
811
+ function program3(depth0,data) {
812
+
813
+ var buffer = "", stack1;
814
+ buffer += "\n ";
815
+ stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
816
+ if(stack1 || stack1 === 0) { buffer += stack1; }
817
+ buffer += "\n ";
818
+ return buffer;
819
+ }
820
+ function program4(depth0,data) {
821
+
822
+ var buffer = "", stack1;
823
+ buffer += "\n ";
824
+ if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
825
+ else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
826
+ buffer += escapeExpression(stack1)
827
+ + "\n ";
828
+ return buffer;
829
+ }
830
+
831
+ function program6(depth0,data) {
832
+
833
+
834
+ return "\n (empty)\n ";
835
+ }
836
+
837
+ buffer += "<td class='code'>";
838
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
839
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
840
+ buffer += escapeExpression(stack1)
841
+ + "</td>\n<td>\n ";
842
+ stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
843
+ if(stack1 || stack1 === 0) { buffer += stack1; }
844
+ buffer += "\n</td>\n<td>";
845
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
846
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
847
+ if(stack1 || stack1 === 0) { buffer += stack1; }
848
+ buffer += "</td>\n<td>";
849
+ if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
850
+ else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
851
+ if(stack1 || stack1 === 0) { buffer += stack1; }
852
+ buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
853
+ return buffer;
854
+ });
855
+ })();
856
+
857
+ (function() {
858
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
859
+ templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
860
+ this.compilerInfo = [4,'>= 1.0.0'];
861
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
862
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
863
+
864
+ function program1(depth0,data) {
865
+
866
+ var buffer = "", stack1;
867
+ buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
868
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
869
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
870
+ buffer += escapeExpression(stack1)
871
+ + "'>";
872
+ if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
873
+ else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
874
+ buffer += escapeExpression(stack1)
875
+ + "</textarea>\n ";
876
+ return buffer;
877
+ }
878
+
879
+ function program3(depth0,data) {
880
+
881
+ var buffer = "", stack1;
882
+ buffer += "\n ";
883
+ stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
884
+ if(stack1 || stack1 === 0) { buffer += stack1; }
885
+ buffer += "\n ";
886
+ return buffer;
887
+ }
888
+ function program4(depth0,data) {
889
+
890
+ var buffer = "", stack1;
891
+ buffer += "\n ";
892
+ if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
893
+ else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
894
+ buffer += escapeExpression(stack1)
895
+ + "\n ";
896
+ return buffer;
897
+ }
898
+
899
+ function program6(depth0,data) {
900
+
901
+
902
+ return "\n (empty)\n ";
903
+ }
904
+
905
+ buffer += "<td class='code required'>";
906
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
907
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
908
+ buffer += escapeExpression(stack1)
909
+ + "</td>\n<td>\n ";
910
+ stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
911
+ if(stack1 || stack1 === 0) { buffer += stack1; }
912
+ buffer += "\n</td>\n<td>";
913
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
914
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
915
+ if(stack1 || stack1 === 0) { buffer += stack1; }
916
+ buffer += "</td>\n<td>";
917
+ if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
918
+ else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
919
+ if(stack1 || stack1 === 0) { buffer += stack1; }
920
+ buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
921
+ return buffer;
922
+ });
923
+ })();
924
+
925
+ (function() {
926
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
927
+ templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
928
+ this.compilerInfo = [4,'>= 1.0.0'];
929
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
930
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
931
+
932
+ function program1(depth0,data) {
933
+
934
+ var buffer = "", stack1;
935
+ buffer += "\n ";
936
+ stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
937
+ if(stack1 || stack1 === 0) { buffer += stack1; }
938
+ buffer += "\n ";
939
+ return buffer;
940
+ }
941
+ function program2(depth0,data) {
942
+
943
+ var buffer = "", stack1;
944
+ buffer += "\n <input type=\"file\" name='";
945
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
946
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
947
+ buffer += escapeExpression(stack1)
948
+ + "'/>\n ";
949
+ return buffer;
950
+ }
951
+
952
+ function program4(depth0,data) {
953
+
954
+ var buffer = "", stack1;
955
+ buffer += "\n ";
956
+ stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
957
+ if(stack1 || stack1 === 0) { buffer += stack1; }
958
+ buffer += "\n ";
959
+ return buffer;
960
+ }
961
+ function program5(depth0,data) {
962
+
963
+ var buffer = "", stack1;
964
+ buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
965
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
966
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
967
+ buffer += escapeExpression(stack1)
968
+ + "'>";
969
+ if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
970
+ else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
971
+ buffer += escapeExpression(stack1)
972
+ + "</textarea>\n ";
973
+ return buffer;
974
+ }
975
+
976
+ function program7(depth0,data) {
977
+
978
+ var buffer = "", stack1;
979
+ buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
980
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
981
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
982
+ buffer += escapeExpression(stack1)
983
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
984
+ return buffer;
985
+ }
986
+
987
+ function program9(depth0,data) {
988
+
989
+ var buffer = "", stack1;
990
+ buffer += "\n ";
991
+ stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
992
+ if(stack1 || stack1 === 0) { buffer += stack1; }
993
+ buffer += "\n ";
994
+ return buffer;
995
+ }
996
+ function program10(depth0,data) {
997
+
998
+ var buffer = "", stack1;
999
+ buffer += "\n <input class='parameter' class='required' type='file' name='";
1000
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1001
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1002
+ buffer += escapeExpression(stack1)
1003
+ + "'/>\n ";
1004
+ return buffer;
1005
+ }
1006
+
1007
+ function program12(depth0,data) {
1008
+
1009
+ var buffer = "", stack1;
1010
+ buffer += "\n ";
1011
+ stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data});
1012
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1013
+ buffer += "\n ";
1014
+ return buffer;
1015
+ }
1016
+ function program13(depth0,data) {
1017
+
1018
+ var buffer = "", stack1;
1019
+ buffer += "\n <input class='parameter required' minlength='1' name='";
1020
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1021
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1022
+ buffer += escapeExpression(stack1)
1023
+ + "' placeholder='(required)' type='text' value='";
1024
+ if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1025
+ else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1026
+ buffer += escapeExpression(stack1)
1027
+ + "'/>\n ";
1028
+ return buffer;
1029
+ }
1030
+
1031
+ function program15(depth0,data) {
1032
+
1033
+ var buffer = "", stack1;
1034
+ buffer += "\n <input class='parameter required' minlength='1' name='";
1035
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1036
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1037
+ buffer += escapeExpression(stack1)
1038
+ + "' placeholder='(required)' type='text' value=''/>\n ";
1039
+ return buffer;
1040
+ }
1041
+
1042
+ buffer += "<td class='code required'>";
1043
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1044
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1045
+ buffer += escapeExpression(stack1)
1046
+ + "</td>\n<td>\n ";
1047
+ stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
1048
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1049
+ buffer += "\n</td>\n<td>\n <strong>";
1050
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1051
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1052
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1053
+ buffer += "</strong>\n</td>\n<td>";
1054
+ if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1055
+ else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1056
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1057
+ buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1058
+ return buffer;
1059
+ });
1060
+ })();
1061
+
1062
+ (function() {
1063
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1064
+ templates['parameter_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
1065
+ this.compilerInfo = [4,'>= 1.0.0'];
1066
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1067
+ var buffer = "", stack1, functionType="function", self=this;
1068
+
1069
+ function program1(depth0,data) {
1070
+
1071
+ var buffer = "", stack1;
1072
+ buffer += "\n ";
1073
+ stack1 = helpers.each.call(depth0, depth0.consumes, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1074
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1075
+ buffer += "\n";
1076
+ return buffer;
1077
+ }
1078
+ function program2(depth0,data) {
1079
+
1080
+ var buffer = "", stack1;
1081
+ buffer += "\n <option value=\"";
1082
+ stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1083
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1084
+ buffer += "\">";
1085
+ stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1086
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1087
+ buffer += "</option>\n ";
1088
+ return buffer;
1089
+ }
1090
+
1091
+ function program4(depth0,data) {
1092
+
1093
+
1094
+ return "\n <option value=\"application/json\">application/json</option>\n";
1095
+ }
1096
+
1097
+ buffer += "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1098
+ stack1 = helpers['if'].call(depth0, depth0.consumes, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1099
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1100
+ buffer += "\n</select>\n";
1101
+ return buffer;
1102
+ });
1103
+ })();
1104
+
1105
+ (function() {
1106
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1107
+ templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
1108
+ this.compilerInfo = [4,'>= 1.0.0'];
1109
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1110
+ var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
1111
+
1112
+ function program1(depth0,data) {
1113
+
1114
+
1115
+ return " : ";
1116
+ }
1117
+
1118
+ function program3(depth0,data) {
1119
+
1120
+ var buffer = "", stack1;
1121
+ buffer += "<li>\n <a href='";
1122
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1123
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1124
+ buffer += escapeExpression(stack1)
1125
+ + "'>Raw</a>\n </li>";
1126
+ return buffer;
1127
+ }
1128
+
1129
+ buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
1130
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1131
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1132
+ buffer += escapeExpression(stack1)
1133
+ + "' class=\"toggleEndpointList\" data-id=\"";
1134
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1135
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1136
+ buffer += escapeExpression(stack1)
1137
+ + "\">";
1138
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1139
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1140
+ buffer += escapeExpression(stack1)
1141
+ + "</a> ";
1142
+ options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
1143
+ if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, options); }
1144
+ else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1145
+ if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1146
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1147
+ if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1148
+ else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1149
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1150
+ buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1151
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1152
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1153
+ buffer += escapeExpression(stack1)
1154
+ + "' id='endpointListTogger_";
1155
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1156
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1157
+ buffer += escapeExpression(stack1)
1158
+ + "' class=\"toggleEndpointList\" data-id=\"";
1159
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1160
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1161
+ buffer += escapeExpression(stack1)
1162
+ + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\"";
1163
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1164
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1165
+ buffer += escapeExpression(stack1)
1166
+ + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=";
1167
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1168
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1169
+ buffer += escapeExpression(stack1)
1170
+ + ">\n Expand Operations\n </a>\n </li>\n ";
1171
+ options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data};
1172
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, options); }
1173
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1174
+ if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1175
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1176
+ buffer += "\n </ul>\n</div>\n<ul class='endpoints' id='";
1177
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1178
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1179
+ buffer += escapeExpression(stack1)
1180
+ + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1181
+ return buffer;
1182
+ });
1183
+ })();
1184
+
1185
+ (function() {
1186
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1187
+ templates['response_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
1188
+ this.compilerInfo = [4,'>= 1.0.0'];
1189
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1190
+ var buffer = "", stack1, functionType="function", self=this;
1191
+
1192
+ function program1(depth0,data) {
1193
+
1194
+ var buffer = "", stack1;
1195
+ buffer += "\n ";
1196
+ stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1197
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1198
+ buffer += "\n";
1199
+ return buffer;
1200
+ }
1201
+ function program2(depth0,data) {
1202
+
1203
+ var buffer = "", stack1;
1204
+ buffer += "\n <option value=\"";
1205
+ stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1206
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1207
+ buffer += "\">";
1208
+ stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1209
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1210
+ buffer += "</option>\n ";
1211
+ return buffer;
1212
+ }
1213
+
1214
+ function program4(depth0,data) {
1215
+
1216
+
1217
+ return "\n <option value=\"application/json\">application/json</option>\n";
1218
+ }
1219
+
1220
+ buffer += "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
1221
+ stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1222
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1223
+ buffer += "\n</select>\n";
1224
+ return buffer;
1225
+ });
1226
+ })();
1227
+
1228
+ (function() {
1229
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1230
+ templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
1231
+ this.compilerInfo = [4,'>= 1.0.0'];
1232
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1233
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1234
+
1235
+
1236
+ buffer += "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
1237
+ if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1238
+ else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1239
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1240
+ buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1241
+ if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1242
+ else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1243
+ buffer += escapeExpression(stack1)
1244
+ + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1245
+ return buffer;
1246
+ });
1247
+ })();
1248
+
1249
+ (function() {
1250
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1251
+ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
1252
+ this.compilerInfo = [4,'>= 1.0.0'];
1253
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1254
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1255
+
1256
+
1257
+ buffer += "<td width='15%' class='code'>";
1258
+ if (stack1 = helpers.code) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1259
+ else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1260
+ buffer += escapeExpression(stack1)
1261
+ + "</td>\n<td>";
1262
+ if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1263
+ else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1264
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1265
+ buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
1266
+ return buffer;
1267
+ });
1268
+ })();
1269
+
1270
+
1271
+
1272
+ // Generated by CoffeeScript 1.6.3
1273
+ (function() {
1274
+ var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
1275
+ __hasProp = {}.hasOwnProperty,
1276
+ __extends = 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; };
1277
+
1278
+ SwaggerUi = (function(_super) {
1279
+ __extends(SwaggerUi, _super);
1280
+
1281
+ function SwaggerUi() {
1282
+ _ref = SwaggerUi.__super__.constructor.apply(this, arguments);
1283
+ return _ref;
1284
+ }
1285
+
1286
+ SwaggerUi.prototype.dom_id = "swagger_ui";
1287
+
1288
+ SwaggerUi.prototype.options = null;
1289
+
1290
+ SwaggerUi.prototype.api = null;
1291
+
1292
+ SwaggerUi.prototype.headerView = null;
1293
+
1294
+ SwaggerUi.prototype.mainView = null;
1295
+
1296
+ SwaggerUi.prototype.initialize = function(options) {
1297
+ var _this = this;
1298
+ if (options == null) {
1299
+ options = {};
1300
+ }
1301
+ if (options.dom_id != null) {
1302
+ this.dom_id = options.dom_id;
1303
+ delete options.dom_id;
1304
+ }
1305
+ if ($('#' + this.dom_id) == null) {
1306
+ $('body').append('<div id="' + this.dom_id + '"></div>');
1307
+ }
1308
+ this.options = options;
1309
+ this.options.success = function() {
1310
+ return _this.render();
1311
+ };
1312
+ this.options.progress = function(d) {
1313
+ return _this.showMessage(d);
1314
+ };
1315
+ this.options.failure = function(d) {
1316
+ if (_this.api && _this.api.isValid === false) {
1317
+ log("not a valid 2.0 spec, loading legacy client");
1318
+ _this.api = new SwaggerApi(_this.options);
1319
+ return _this.api.build();
1320
+ } else {
1321
+ return _this.onLoadFailure(d);
1322
+ }
1323
+ };
1324
+ this.headerView = new HeaderView({
1325
+ el: $('#header')
1326
+ });
1327
+ return this.headerView.on('update-swagger-ui', function(data) {
1328
+ return _this.updateSwaggerUi(data);
1329
+ });
1330
+ };
1331
+
1332
+ SwaggerUi.prototype.setOption = function(option, value) {
1333
+ return this.options[option] = value;
1334
+ };
1335
+
1336
+ SwaggerUi.prototype.getOption = function(option) {
1337
+ return this.options[option];
1338
+ };
1339
+
1340
+ SwaggerUi.prototype.updateSwaggerUi = function(data) {
1341
+ this.options.url = data.url;
1342
+ return this.load();
1343
+ };
1344
+
1345
+ SwaggerUi.prototype.load = function() {
1346
+ var url, _ref1;
1347
+ if ((_ref1 = this.mainView) != null) {
1348
+ _ref1.clear();
1349
+ }
1350
+ url = this.options.url;
1351
+ if (url.indexOf("http") !== 0) {
1352
+ url = this.buildUrl(window.location.href.toString(), url);
1353
+ }
1354
+ this.options.url = url;
1355
+ this.headerView.update(url);
1356
+ this.api = new SwaggerClient(this.options);
1357
+ return this.api.build();
1358
+ };
1359
+
1360
+ SwaggerUi.prototype.render = function() {
1361
+ var _this = this;
1362
+ this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1363
+ this.mainView = new MainView({
1364
+ model: this.api,
1365
+ el: $('#' + this.dom_id),
1366
+ swaggerOptions: this.options
1367
+ }).render();
1368
+ this.showMessage();
1369
+ switch (this.options.docExpansion) {
1370
+ case "full":
1371
+ Docs.expandOperationsForResource('');
1372
+ break;
1373
+ case "list":
1374
+ Docs.collapseOperationsForResource('');
1375
+ }
1376
+ if (this.options.onComplete) {
1377
+ this.options.onComplete(this.api, this);
1378
+ }
1379
+ return setTimeout(function() {
1380
+ return Docs.shebang();
1381
+ }, 400);
1382
+ };
1383
+
1384
+ SwaggerUi.prototype.buildUrl = function(base, url) {
1385
+ var endOfPath, parts;
1386
+ log("base is " + base);
1387
+ if (url.indexOf("/") === 0) {
1388
+ parts = base.split("/");
1389
+ base = parts[0] + "//" + parts[2];
1390
+ return base + url;
1391
+ } else {
1392
+ endOfPath = base.length;
1393
+ if (base.indexOf("?") > -1) {
1394
+ endOfPath = Math.min(endOfPath, base.indexOf("?"));
1395
+ }
1396
+ if (base.indexOf("#") > -1) {
1397
+ endOfPath = Math.min(endOfPath, base.indexOf("#"));
1398
+ }
1399
+ base = base.substring(0, endOfPath);
1400
+ if (base.indexOf("/", base.length - 1) !== -1) {
1401
+ return base + url;
1402
+ }
1403
+ return base + "/" + url;
1404
+ }
1405
+ };
1406
+
1407
+ SwaggerUi.prototype.showMessage = function(data) {
1408
+ if (data == null) {
1409
+ data = '';
1410
+ }
1411
+ $('#message-bar').removeClass('message-fail');
1412
+ $('#message-bar').addClass('message-success');
1413
+ return $('#message-bar').html(data);
1414
+ };
1415
+
1416
+ SwaggerUi.prototype.onLoadFailure = function(data) {
1417
+ var val;
1418
+ if (data == null) {
1419
+ data = '';
1420
+ }
1421
+ $('#message-bar').removeClass('message-success');
1422
+ $('#message-bar').addClass('message-fail');
1423
+ val = $('#message-bar').html(data);
1424
+ if (this.options.onFailure != null) {
1425
+ this.options.onFailure(data);
1426
+ }
1427
+ return val;
1428
+ };
1429
+
1430
+ return SwaggerUi;
1431
+
1432
+ })(Backbone.Router);
1433
+
1434
+ window.SwaggerUi = SwaggerUi;
1435
+
1436
+ HeaderView = (function(_super) {
1437
+ __extends(HeaderView, _super);
1438
+
1439
+ function HeaderView() {
1440
+ _ref1 = HeaderView.__super__.constructor.apply(this, arguments);
1441
+ return _ref1;
1442
+ }
1443
+
1444
+ HeaderView.prototype.events = {
1445
+ 'click #show-pet-store-icon': 'showPetStore',
1446
+ 'click #show-wordnik-dev-icon': 'showWordnikDev',
1447
+ 'click #explore': 'showCustom',
1448
+ 'keyup #input_baseUrl': 'showCustomOnKeyup',
1449
+ 'keyup #input_apiKey': 'showCustomOnKeyup'
1450
+ };
1451
+
1452
+ HeaderView.prototype.initialize = function() {};
1453
+
1454
+ HeaderView.prototype.showPetStore = function(e) {
1455
+ return this.trigger('update-swagger-ui', {
1456
+ url: "http://petstore.swagger.wordnik.com/api/api-docs"
1457
+ });
1458
+ };
1459
+
1460
+ HeaderView.prototype.showWordnikDev = function(e) {
1461
+ return this.trigger('update-swagger-ui', {
1462
+ url: "http://api.wordnik.com/v4/resources.json"
1463
+ });
1464
+ };
1465
+
1466
+ HeaderView.prototype.showCustomOnKeyup = function(e) {
1467
+ if (e.keyCode === 13) {
1468
+ return this.showCustom();
1469
+ }
1470
+ };
1471
+
1472
+ HeaderView.prototype.showCustom = function(e) {
1473
+ if (e != null) {
1474
+ e.preventDefault();
1475
+ }
1476
+ return this.trigger('update-swagger-ui', {
1477
+ url: $('#input_baseUrl').val(),
1478
+ apiKey: $('#input_apiKey').val()
1479
+ });
1480
+ };
1481
+
1482
+ HeaderView.prototype.update = function(url, apiKey, trigger) {
1483
+ if (trigger == null) {
1484
+ trigger = false;
1485
+ }
1486
+ $('#input_baseUrl').val(url);
1487
+ if (trigger) {
1488
+ return this.trigger('update-swagger-ui', {
1489
+ url: url
1490
+ });
1491
+ }
1492
+ };
1493
+
1494
+ return HeaderView;
1495
+
1496
+ })(Backbone.View);
1497
+
1498
+ MainView = (function(_super) {
1499
+ var sorters;
1500
+
1501
+ __extends(MainView, _super);
1502
+
1503
+ function MainView() {
1504
+ _ref2 = MainView.__super__.constructor.apply(this, arguments);
1505
+ return _ref2;
1506
+ }
1507
+
1508
+ sorters = {
1509
+ 'alpha': function(a, b) {
1510
+ return a.path.localeCompare(b.path);
1511
+ },
1512
+ 'method': function(a, b) {
1513
+ return a.method.localeCompare(b.method);
1514
+ }
1515
+ };
1516
+
1517
+ MainView.prototype.initialize = function(opts) {
1518
+ var name, route, sorter, sorterName, url, _i, _len, _ref3;
1519
+ if (opts == null) {
1520
+ opts = {};
1521
+ }
1522
+ if (opts.swaggerOptions.sorter) {
1523
+ sorterName = opts.swaggerOptions.sorter;
1524
+ sorter = sorters[sorterName];
1525
+ if (this.model.apisArray) {
1526
+ _ref3 = this.model.apisArray;
1527
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
1528
+ route = _ref3[_i];
1529
+ route.operationsArray.sort(sorter);
1530
+ }
1531
+ if (sorterName === "alpha") {
1532
+ this.model.apisArray.sort(sorter);
1533
+ }
1534
+ }
1535
+ }
1536
+ if (this.model.info && this.model.info.license && typeof this.model.info.license === 'string') {
1537
+ name = this.model.info.license;
1538
+ url = this.model.info.licenseUrl;
1539
+ this.model.info.license = {};
1540
+ this.model.info.license.name = name;
1541
+ this.model.info.license.url = url;
1542
+ }
1543
+ if (!this.model.info) {
1544
+ this.model.info = {};
1545
+ }
1546
+ if (!this.model.info.version) {
1547
+ this.model.info.version = this.model.apiVersion;
1548
+ }
1549
+ if ("validatorUrl" in opts.swaggerOptions) {
1550
+ return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
1551
+ } else if (this.model.url.match(/https?:\/\/localhost/) && this.model.swaggerVersion === 2) {
1552
+ return this.model.validatorUrl = this.model.url;
1553
+ } else {
1554
+ return this.model.validatorUrl = "http://online.swagger.io/validator";
1555
+ }
1556
+ };
1557
+
1558
+ MainView.prototype.render = function() {
1559
+ var counter, id, resource, resources, _i, _len, _ref3;
1560
+ $(this.el).html(Handlebars.templates.main(this.model));
1561
+ resources = {};
1562
+ counter = 0;
1563
+ _ref3 = this.model.apisArray;
1564
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
1565
+ resource = _ref3[_i];
1566
+ id = resource.name;
1567
+ while (typeof resources[id] !== 'undefined') {
1568
+ id = id + "_" + counter;
1569
+ counter += 1;
1570
+ }
1571
+ resource.id = id;
1572
+ resources[id] = resource;
1573
+ this.addResource(resource);
1574
+ }
1575
+ return this;
1576
+ };
1577
+
1578
+ MainView.prototype.addResource = function(resource) {
1579
+ var resourceView;
1580
+ resource.id = resource.id.replace(/\s/g, '_');
1581
+ resourceView = new ResourceView({
1582
+ model: resource,
1583
+ tagName: 'li',
1584
+ id: 'resource_' + resource.id,
1585
+ className: 'resource',
1586
+ swaggerOptions: this.options.swaggerOptions
1587
+ });
1588
+ return $('#resources').append(resourceView.render().el);
1589
+ };
1590
+
1591
+ MainView.prototype.clear = function() {
1592
+ return $(this.el).html('');
1593
+ };
1594
+
1595
+ return MainView;
1596
+
1597
+ })(Backbone.View);
1598
+
1599
+ ResourceView = (function(_super) {
1600
+ __extends(ResourceView, _super);
1601
+
1602
+ function ResourceView() {
1603
+ _ref3 = ResourceView.__super__.constructor.apply(this, arguments);
1604
+ return _ref3;
1605
+ }
1606
+
1607
+ ResourceView.prototype.initialize = function() {
1608
+ if ("" === this.model.description) {
1609
+ return this.model.description = null;
1610
+ }
1611
+ };
1612
+
1613
+ ResourceView.prototype.render = function() {
1614
+ var counter, id, methods, operation, _i, _len, _ref4;
1615
+ $(this.el).html(Handlebars.templates.resource(this.model));
1616
+ methods = {};
1617
+ if (this.model.description) {
1618
+ this.model.summary = this.model.description;
1619
+ }
1620
+ _ref4 = this.model.operationsArray;
1621
+ for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
1622
+ operation = _ref4[_i];
1623
+ counter = 0;
1624
+ id = operation.nickname;
1625
+ while (typeof methods[id] !== 'undefined') {
1626
+ id = id + "_" + counter;
1627
+ counter += 1;
1628
+ }
1629
+ methods[id] = operation;
1630
+ operation.nickname = id;
1631
+ operation.parentId = this.model.id;
1632
+ this.addOperation(operation);
1633
+ }
1634
+ $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
1635
+ $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
1636
+ $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
1637
+ return this;
1638
+ };
1639
+
1640
+ ResourceView.prototype.addOperation = function(operation) {
1641
+ var operationView;
1642
+ operation.number = this.number;
1643
+ operationView = new OperationView({
1644
+ model: operation,
1645
+ tagName: 'li',
1646
+ className: 'endpoint',
1647
+ swaggerOptions: this.options.swaggerOptions
1648
+ });
1649
+ $('.endpoints', $(this.el)).append(operationView.render().el);
1650
+ return this.number++;
1651
+ };
1652
+
1653
+ ResourceView.prototype.callDocs = function(fnName, e) {
1654
+ e.preventDefault();
1655
+ return Docs[fnName](e.currentTarget.getAttribute('data-id'));
1656
+ };
1657
+
1658
+ return ResourceView;
1659
+
1660
+ })(Backbone.View);
1661
+
1662
+ OperationView = (function(_super) {
1663
+ __extends(OperationView, _super);
1664
+
1665
+ function OperationView() {
1666
+ _ref4 = OperationView.__super__.constructor.apply(this, arguments);
1667
+ return _ref4;
1668
+ }
1669
+
1670
+ OperationView.prototype.invocationUrl = null;
1671
+
1672
+ OperationView.prototype.events = {
1673
+ 'submit .sandbox': 'submitOperation',
1674
+ 'click .submit': 'submitOperation',
1675
+ 'click .response_hider': 'hideResponse',
1676
+ 'click .toggleOperation': 'toggleOperationContent',
1677
+ 'mouseenter .api-ic': 'mouseEnter',
1678
+ 'mouseout .api-ic': 'mouseExit'
1679
+ };
1680
+
1681
+ OperationView.prototype.initialize = function() {};
1682
+
1683
+ OperationView.prototype.mouseEnter = function(e) {
1684
+ var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1685
+ elem = $(e.currentTarget.parentNode).find('#api_information_panel');
1686
+ x = e.pageX;
1687
+ y = e.pageY;
1688
+ scX = $(window).scrollLeft();
1689
+ scY = $(window).scrollTop();
1690
+ scMaxX = scX + $(window).width();
1691
+ scMaxY = scY + $(window).height();
1692
+ wd = elem.width();
1693
+ hgh = elem.height();
1694
+ if (x + wd > scMaxX) {
1695
+ x = scMaxX - wd;
1696
+ }
1697
+ if (x < scX) {
1698
+ x = scX;
1699
+ }
1700
+ if (y + hgh > scMaxY) {
1701
+ y = scMaxY - hgh;
1702
+ }
1703
+ if (y < scY) {
1704
+ y = scY;
1705
+ }
1706
+ pos = {};
1707
+ pos.top = y;
1708
+ pos.left = x;
1709
+ elem.css(pos);
1710
+ return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1711
+ };
1712
+
1713
+ OperationView.prototype.mouseExit = function(e) {
1714
+ return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1715
+ };
1716
+
1717
+ OperationView.prototype.render = function() {
1718
+ var code, contentTypeModel, isMethodSubmissionSupported, k, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8, _ref9;
1719
+ isMethodSubmissionSupported = true;
1720
+ if (!isMethodSubmissionSupported) {
1721
+ this.model.isReadOnly = true;
1722
+ }
1723
+ this.model.description = this.model.description || this.model.notes;
1724
+ if (this.model.description) {
1725
+ this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1726
+ }
1727
+ this.model.oauth = null;
1728
+ if (this.model.authorizations) {
1729
+ _ref5 = this.model.authorizations;
1730
+ for (k in _ref5) {
1731
+ v = _ref5[k];
1732
+ if (k === "oauth2") {
1733
+ if (this.model.oauth === null) {
1734
+ this.model.oauth = {};
1735
+ }
1736
+ if (this.model.oauth.scopes === void 0) {
1737
+ this.model.oauth.scopes = [];
1738
+ }
1739
+ for (_i = 0, _len = v.length; _i < _len; _i++) {
1740
+ o = v[_i];
1741
+ this.model.oauth.scopes.push(o);
1742
+ }
1743
+ }
1744
+ }
1745
+ }
1746
+ if (typeof this.model.responses !== 'undefined') {
1747
+ this.model.responseMessages = [];
1748
+ _ref6 = this.model.responses;
1749
+ for (code in _ref6) {
1750
+ value = _ref6[code];
1751
+ schema = null;
1752
+ schemaObj = this.model.responses[code].schema;
1753
+ if (schemaObj && schemaObj['$ref']) {
1754
+ schema = schemaObj['$ref'];
1755
+ if (schema.indexOf('#/definitions/') === 0) {
1756
+ schema = schema.substring('#/definitions/'.length);
1757
+ }
1758
+ }
1759
+ this.model.responseMessages.push({
1760
+ code: code,
1761
+ message: value.description,
1762
+ responseModel: schema
1763
+ });
1764
+ }
1765
+ }
1766
+ if (typeof this.model.responseMessages === 'undefined') {
1767
+ this.model.responseMessages = [];
1768
+ }
1769
+ $(this.el).html(Handlebars.templates.operation(this.model));
1770
+ if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1771
+ signatureModel = {
1772
+ sampleJSON: this.model.responseSampleJSON,
1773
+ isParam: false,
1774
+ signature: this.model.responseClassSignature
1775
+ };
1776
+ responseSignatureView = new SignatureView({
1777
+ model: signatureModel,
1778
+ tagName: 'div'
1779
+ });
1780
+ $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1781
+ } else {
1782
+ this.model.responseClassSignature = 'string';
1783
+ $('.model-signature', $(this.el)).html(this.model.type);
1784
+ }
1785
+ contentTypeModel = {
1786
+ isParam: false
1787
+ };
1788
+ contentTypeModel.consumes = this.model.consumes;
1789
+ contentTypeModel.produces = this.model.produces;
1790
+ _ref7 = this.model.parameters;
1791
+ for (_j = 0, _len1 = _ref7.length; _j < _len1; _j++) {
1792
+ param = _ref7[_j];
1793
+ type = param.type || param.dataType;
1794
+ if (typeof type === 'undefined') {
1795
+ schema = param.schema;
1796
+ if (schema && schema['$ref']) {
1797
+ ref = schema['$ref'];
1798
+ if (ref.indexOf('#/definitions/') === 0) {
1799
+ type = ref.substring('#/definitions/'.length);
1800
+ } else {
1801
+ type = ref;
1802
+ }
1803
+ }
1804
+ }
1805
+ if (type && type.toLowerCase() === 'file') {
1806
+ if (!contentTypeModel.consumes) {
1807
+ contentTypeModel.consumes = 'multipart/form-data';
1808
+ }
1809
+ }
1810
+ param.type = type;
1811
+ }
1812
+ responseContentTypeView = new ResponseContentTypeView({
1813
+ model: contentTypeModel
1814
+ });
1815
+ $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1816
+ _ref8 = this.model.parameters;
1817
+ for (_k = 0, _len2 = _ref8.length; _k < _len2; _k++) {
1818
+ param = _ref8[_k];
1819
+ this.addParameter(param, contentTypeModel.consumes);
1820
+ }
1821
+ _ref9 = this.model.responseMessages;
1822
+ for (_l = 0, _len3 = _ref9.length; _l < _len3; _l++) {
1823
+ statusCode = _ref9[_l];
1824
+ this.addStatusCode(statusCode);
1825
+ }
1826
+ return this;
1827
+ };
1828
+
1829
+ OperationView.prototype.addParameter = function(param, consumes) {
1830
+ var paramView;
1831
+ param.consumes = consumes;
1832
+ paramView = new ParameterView({
1833
+ model: param,
1834
+ tagName: 'tr',
1835
+ readOnly: this.model.isReadOnly
1836
+ });
1837
+ return $('.operation-params', $(this.el)).append(paramView.render().el);
1838
+ };
1839
+
1840
+ OperationView.prototype.addStatusCode = function(statusCode) {
1841
+ var statusCodeView;
1842
+ statusCodeView = new StatusCodeView({
1843
+ model: statusCode,
1844
+ tagName: 'tr'
1845
+ });
1846
+ return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1847
+ };
1848
+
1849
+ OperationView.prototype.submitOperation = function(e) {
1850
+ var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1851
+ if (e != null) {
1852
+ e.preventDefault();
1853
+ }
1854
+ form = $('.sandbox', $(this.el));
1855
+ error_free = true;
1856
+ form.find("input.required").each(function() {
1857
+ var _this = this;
1858
+ $(this).removeClass("error");
1859
+ if (jQuery.trim($(this).val()) === "") {
1860
+ $(this).addClass("error");
1861
+ $(this).wiggle({
1862
+ callback: function() {
1863
+ return $(_this).focus();
1864
+ }
1865
+ });
1866
+ return error_free = false;
1867
+ }
1868
+ });
1869
+ if (error_free) {
1870
+ map = {};
1871
+ opts = {
1872
+ parent: this
1873
+ };
1874
+ isFileUpload = false;
1875
+ _ref5 = form.find("input");
1876
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1877
+ o = _ref5[_i];
1878
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1879
+ map[o.name] = o.value;
1880
+ }
1881
+ if (o.type === "file") {
1882
+ isFileUpload = true;
1883
+ }
1884
+ }
1885
+ _ref6 = form.find("textarea");
1886
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1887
+ o = _ref6[_j];
1888
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1889
+ map[o.name] = o.value;
1890
+ }
1891
+ }
1892
+ _ref7 = form.find("select");
1893
+ for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1894
+ o = _ref7[_k];
1895
+ val = this.getSelectedValue(o);
1896
+ if ((val != null) && jQuery.trim(val).length > 0) {
1897
+ map[o.name] = val;
1898
+ }
1899
+ }
1900
+ opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1901
+ opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1902
+ $(".response_throbber", $(this.el)).show();
1903
+ if (isFileUpload) {
1904
+ return this.handleFileUpload(map, form);
1905
+ } else {
1906
+ return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1907
+ }
1908
+ }
1909
+ };
1910
+
1911
+ OperationView.prototype.success = function(response, parent) {
1912
+ return parent.showCompleteStatus(response);
1913
+ };
1914
+
1915
+ OperationView.prototype.handleFileUpload = function(map, form) {
1916
+ var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
1917
+ _this = this;
1918
+ _ref5 = form.serializeArray();
1919
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1920
+ o = _ref5[_i];
1921
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1922
+ map[o.name] = o.value;
1923
+ }
1924
+ }
1925
+ bodyParam = new FormData();
1926
+ params = 0;
1927
+ _ref6 = this.model.parameters;
1928
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1929
+ param = _ref6[_j];
1930
+ if (param.paramType === 'form') {
1931
+ if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1932
+ bodyParam.append(param.name, map[param.name]);
1933
+ }
1934
+ }
1935
+ }
1936
+ headerParams = {};
1937
+ _ref7 = this.model.parameters;
1938
+ for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1939
+ param = _ref7[_k];
1940
+ if (param.paramType === 'header') {
1941
+ headerParams[param.name] = map[param.name];
1942
+ }
1943
+ }
1944
+ _ref8 = form.find('input[type~="file"]');
1945
+ for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
1946
+ el = _ref8[_l];
1947
+ if (typeof el.files[0] !== 'undefined') {
1948
+ bodyParam.append($(el).attr('name'), el.files[0]);
1949
+ params += 1;
1950
+ }
1951
+ }
1952
+ this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1953
+ $(".request_url", $(this.el)).html("<pre></pre>");
1954
+ $(".request_url pre", $(this.el)).text(this.invocationUrl);
1955
+ obj = {
1956
+ type: this.model.method,
1957
+ url: this.invocationUrl,
1958
+ headers: headerParams,
1959
+ data: bodyParam,
1960
+ dataType: 'json',
1961
+ contentType: false,
1962
+ processData: false,
1963
+ error: function(data, textStatus, error) {
1964
+ return _this.showErrorStatus(_this.wrap(data), _this);
1965
+ },
1966
+ success: function(data) {
1967
+ return _this.showResponse(data, _this);
1968
+ },
1969
+ complete: function(data) {
1970
+ return _this.showCompleteStatus(_this.wrap(data), _this);
1971
+ }
1972
+ };
1973
+ if (window.authorizations) {
1974
+ window.authorizations.apply(obj);
1975
+ }
1976
+ if (params === 0) {
1977
+ obj.data.append("fake", "true");
1978
+ }
1979
+ jQuery.ajax(obj);
1980
+ return false;
1981
+ };
1982
+
1983
+ OperationView.prototype.wrap = function(data) {
1984
+ var h, headerArray, headers, i, o, _i, _len;
1985
+ headers = {};
1986
+ headerArray = data.getAllResponseHeaders().split("\r");
1987
+ for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1988
+ i = headerArray[_i];
1989
+ h = i.split(':');
1990
+ if (h[0] !== void 0 && h[1] !== void 0) {
1991
+ headers[h[0].trim()] = h[1].trim();
1992
+ }
1993
+ }
1994
+ o = {};
1995
+ o.content = {};
1996
+ o.content.data = data.responseText;
1997
+ o.headers = headers;
1998
+ o.request = {};
1999
+ o.request.url = this.invocationUrl;
2000
+ o.status = data.status;
2001
+ return o;
2002
+ };
2003
+
2004
+ OperationView.prototype.getSelectedValue = function(select) {
2005
+ var opt, options, _i, _len, _ref5;
2006
+ if (!select.multiple) {
2007
+ return select.value;
2008
+ } else {
2009
+ options = [];
2010
+ _ref5 = select.options;
2011
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
2012
+ opt = _ref5[_i];
2013
+ if (opt.selected) {
2014
+ options.push(opt.value);
2015
+ }
2016
+ }
2017
+ if (options.length > 0) {
2018
+ return options;
2019
+ } else {
2020
+ return null;
2021
+ }
2022
+ }
2023
+ };
2024
+
2025
+ OperationView.prototype.hideResponse = function(e) {
2026
+ if (e != null) {
2027
+ e.preventDefault();
2028
+ }
2029
+ $(".response", $(this.el)).slideUp();
2030
+ return $(".response_hider", $(this.el)).fadeOut();
2031
+ };
2032
+
2033
+ OperationView.prototype.showResponse = function(response) {
2034
+ var prettyJson;
2035
+ prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
2036
+ return $(".response_body", $(this.el)).html(escape(prettyJson));
2037
+ };
2038
+
2039
+ OperationView.prototype.showErrorStatus = function(data, parent) {
2040
+ return parent.showStatus(data);
2041
+ };
2042
+
2043
+ OperationView.prototype.showCompleteStatus = function(data, parent) {
2044
+ return parent.showStatus(data);
2045
+ };
2046
+
2047
+ OperationView.prototype.formatXml = function(xml) {
2048
+ var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
2049
+ reg = /(>)(<)(\/*)/g;
2050
+ wsexp = /[ ]*(.*)[ ]+\n/g;
2051
+ contexp = /(<.+>)(.+\n)/g;
2052
+ xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
2053
+ pad = 0;
2054
+ formatted = '';
2055
+ lines = xml.split('\n');
2056
+ indent = 0;
2057
+ lastType = 'other';
2058
+ transitions = {
2059
+ 'single->single': 0,
2060
+ 'single->closing': -1,
2061
+ 'single->opening': 0,
2062
+ 'single->other': 0,
2063
+ 'closing->single': 0,
2064
+ 'closing->closing': -1,
2065
+ 'closing->opening': 0,
2066
+ 'closing->other': 0,
2067
+ 'opening->single': 1,
2068
+ 'opening->closing': 0,
2069
+ 'opening->opening': 1,
2070
+ 'opening->other': 1,
2071
+ 'other->single': 0,
2072
+ 'other->closing': -1,
2073
+ 'other->opening': 0,
2074
+ 'other->other': 0
2075
+ };
2076
+ _fn = function(ln) {
2077
+ var fromTo, j, key, padding, type, types, value;
2078
+ types = {
2079
+ single: Boolean(ln.match(/<.+\/>/)),
2080
+ closing: Boolean(ln.match(/<\/.+>/)),
2081
+ opening: Boolean(ln.match(/<[^!?].*>/))
2082
+ };
2083
+ type = ((function() {
2084
+ var _results;
2085
+ _results = [];
2086
+ for (key in types) {
2087
+ value = types[key];
2088
+ if (value) {
2089
+ _results.push(key);
2090
+ }
2091
+ }
2092
+ return _results;
2093
+ })())[0];
2094
+ type = type === void 0 ? 'other' : type;
2095
+ fromTo = lastType + '->' + type;
2096
+ lastType = type;
2097
+ padding = '';
2098
+ indent += transitions[fromTo];
2099
+ padding = ((function() {
2100
+ var _j, _ref5, _results;
2101
+ _results = [];
2102
+ for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
2103
+ _results.push(' ');
2104
+ }
2105
+ return _results;
2106
+ })()).join('');
2107
+ if (fromTo === 'opening->closing') {
2108
+ return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
2109
+ } else {
2110
+ return formatted += padding + ln + '\n';
2111
+ }
2112
+ };
2113
+ for (_i = 0, _len = lines.length; _i < _len; _i++) {
2114
+ ln = lines[_i];
2115
+ _fn(ln);
2116
+ }
2117
+ return formatted;
2118
+ };
2119
+
2120
+ OperationView.prototype.showStatus = function(response) {
2121
+ var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
2122
+ if (response.content === void 0) {
2123
+ content = response.data;
2124
+ url = response.url;
2125
+ } else {
2126
+ content = response.content.data;
2127
+ url = response.request.url;
2128
+ }
2129
+ headers = response.headers;
2130
+ contentType = headers && headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
2131
+ if (!content) {
2132
+ code = $('<code />').text("no content");
2133
+ pre = $('<pre class="json" />').append(code);
2134
+ } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
2135
+ json = null;
2136
+ try {
2137
+ json = JSON.stringify(JSON.parse(content), null, " ");
2138
+ } catch (_error) {
2139
+ e = _error;
2140
+ json = "can't parse JSON. Raw result:\n\n" + content;
2141
+ }
2142
+ code = $('<code />').text(json);
2143
+ pre = $('<pre class="json" />').append(code);
2144
+ } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
2145
+ code = $('<code />').text(this.formatXml(content));
2146
+ pre = $('<pre class="xml" />').append(code);
2147
+ } else if (contentType === "text/html") {
2148
+ code = $('<code />').html(_.escape(content));
2149
+ pre = $('<pre class="xml" />').append(code);
2150
+ } else if (/^image\//.test(contentType)) {
2151
+ pre = $('<img>').attr('src', url);
2152
+ } else {
2153
+ code = $('<code />').text(content);
2154
+ pre = $('<pre class="json" />').append(code);
2155
+ }
2156
+ response_body = pre;
2157
+ $(".request_url", $(this.el)).html("<pre></pre>");
2158
+ $(".request_url pre", $(this.el)).text(url);
2159
+ $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
2160
+ $(".response_body", $(this.el)).html(response_body);
2161
+ $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
2162
+ $(".response", $(this.el)).slideDown();
2163
+ $(".response_hider", $(this.el)).show();
2164
+ $(".response_throbber", $(this.el)).hide();
2165
+ response_body_el = $('.response_body', $(this.el))[0];
2166
+ opts = this.options.swaggerOptions;
2167
+ if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
2168
+ return response_body_el;
2169
+ } else {
2170
+ return hljs.highlightBlock(response_body_el);
2171
+ }
2172
+ };
2173
+
2174
+ OperationView.prototype.toggleOperationContent = function() {
2175
+ var elem;
2176
+ elem = $('#' + Docs.escapeResourceName(this.model.parentId) + "_" + this.model.nickname + "_content");
2177
+ if (elem.is(':visible')) {
2178
+ return Docs.collapseOperation(elem);
2179
+ } else {
2180
+ return Docs.expandOperation(elem);
2181
+ }
2182
+ };
2183
+
2184
+ return OperationView;
2185
+
2186
+ })(Backbone.View);
2187
+
2188
+ StatusCodeView = (function(_super) {
2189
+ __extends(StatusCodeView, _super);
2190
+
2191
+ function StatusCodeView() {
2192
+ _ref5 = StatusCodeView.__super__.constructor.apply(this, arguments);
2193
+ return _ref5;
2194
+ }
2195
+
2196
+ StatusCodeView.prototype.initialize = function() {};
2197
+
2198
+ StatusCodeView.prototype.render = function() {
2199
+ var responseModel, responseModelView, template;
2200
+ template = this.template();
2201
+ $(this.el).html(template(this.model));
2202
+ if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2203
+ responseModel = {
2204
+ sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2205
+ isParam: false,
2206
+ signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2207
+ };
2208
+ responseModelView = new SignatureView({
2209
+ model: responseModel,
2210
+ tagName: 'div'
2211
+ });
2212
+ $('.model-signature', this.$el).append(responseModelView.render().el);
2213
+ } else {
2214
+ $('.model-signature', this.$el).html('');
2215
+ }
2216
+ return this;
2217
+ };
2218
+
2219
+ StatusCodeView.prototype.template = function() {
2220
+ return Handlebars.templates.status_code;
2221
+ };
2222
+
2223
+ return StatusCodeView;
2224
+
2225
+ })(Backbone.View);
2226
+
2227
+ ParameterView = (function(_super) {
2228
+ __extends(ParameterView, _super);
2229
+
2230
+ function ParameterView() {
2231
+ _ref6 = ParameterView.__super__.constructor.apply(this, arguments);
2232
+ return _ref6;
2233
+ }
2234
+
2235
+ ParameterView.prototype.initialize = function() {
2236
+ return Handlebars.registerHelper('isArray', function(param, opts) {
2237
+ if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
2238
+ return opts.fn(this);
2239
+ } else {
2240
+ return opts.inverse(this);
2241
+ }
2242
+ });
2243
+ };
2244
+
2245
+ ParameterView.prototype.render = function() {
2246
+ var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
2247
+ type = this.model.type || this.model.dataType;
2248
+ if (typeof type === 'undefined') {
2249
+ schema = this.model.schema;
2250
+ if (schema && schema['$ref']) {
2251
+ ref = schema['$ref'];
2252
+ if (ref.indexOf('#/definitions/') === 0) {
2253
+ type = ref.substring('#/definitions/'.length);
2254
+ } else {
2255
+ type = ref;
2256
+ }
2257
+ }
2258
+ }
2259
+ this.model.type = type;
2260
+ this.model.paramType = this.model["in"] || this.model.paramType;
2261
+ if (this.model.paramType === 'body') {
2262
+ this.model.isBody = true;
2263
+ }
2264
+ if (type && type.toLowerCase() === 'file') {
2265
+ this.model.isFile = true;
2266
+ }
2267
+ this.model["default"] = this.model["default"] || this.model.defaultValue;
2268
+ template = this.template();
2269
+ $(this.el).html(template(this.model));
2270
+ signatureModel = {
2271
+ sampleJSON: this.model.sampleJSON,
2272
+ isParam: true,
2273
+ signature: this.model.signature
2274
+ };
2275
+ if (this.model.sampleJSON) {
2276
+ signatureView = new SignatureView({
2277
+ model: signatureModel,
2278
+ tagName: 'div'
2279
+ });
2280
+ $('.model-signature', $(this.el)).append(signatureView.render().el);
2281
+ } else {
2282
+ $('.model-signature', $(this.el)).html(this.model.signature);
2283
+ }
2284
+ isParam = false;
2285
+ if (this.model.isBody) {
2286
+ isParam = true;
2287
+ }
2288
+ contentTypeModel = {
2289
+ isParam: isParam
2290
+ };
2291
+ contentTypeModel.consumes = this.model.consumes;
2292
+ if (isParam) {
2293
+ parameterContentTypeView = new ParameterContentTypeView({
2294
+ model: contentTypeModel
2295
+ });
2296
+ $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
2297
+ } else {
2298
+ responseContentTypeView = new ResponseContentTypeView({
2299
+ model: contentTypeModel
2300
+ });
2301
+ $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
2302
+ }
2303
+ return this;
2304
+ };
2305
+
2306
+ ParameterView.prototype.template = function() {
2307
+ if (this.model.isList) {
2308
+ return Handlebars.templates.param_list;
2309
+ } else {
2310
+ if (this.options.readOnly) {
2311
+ if (this.model.required) {
2312
+ return Handlebars.templates.param_readonly_required;
2313
+ } else {
2314
+ return Handlebars.templates.param_readonly;
2315
+ }
2316
+ } else {
2317
+ if (this.model.required) {
2318
+ return Handlebars.templates.param_required;
2319
+ } else {
2320
+ return Handlebars.templates.param;
2321
+ }
2322
+ }
2323
+ }
2324
+ };
2325
+
2326
+ return ParameterView;
2327
+
2328
+ })(Backbone.View);
2329
+
2330
+ SignatureView = (function(_super) {
2331
+ __extends(SignatureView, _super);
2332
+
2333
+ function SignatureView() {
2334
+ _ref7 = SignatureView.__super__.constructor.apply(this, arguments);
2335
+ return _ref7;
2336
+ }
2337
+
2338
+ SignatureView.prototype.events = {
2339
+ 'click a.description-link': 'switchToDescription',
2340
+ 'click a.snippet-link': 'switchToSnippet',
2341
+ 'mousedown .snippet': 'snippetToTextArea'
2342
+ };
2343
+
2344
+ SignatureView.prototype.initialize = function() {};
2345
+
2346
+ SignatureView.prototype.render = function() {
2347
+ var template;
2348
+ template = this.template();
2349
+ $(this.el).html(template(this.model));
2350
+ this.switchToSnippet();
2351
+ this.isParam = this.model.isParam;
2352
+ if (this.isParam) {
2353
+ $('.notice', $(this.el)).text('Click to set as parameter value');
2354
+ }
2355
+ return this;
2356
+ };
2357
+
2358
+ SignatureView.prototype.template = function() {
2359
+ return Handlebars.templates.signature;
2360
+ };
2361
+
2362
+ SignatureView.prototype.switchToDescription = function(e) {
2363
+ if (e != null) {
2364
+ e.preventDefault();
2365
+ }
2366
+ $(".snippet", $(this.el)).hide();
2367
+ $(".description", $(this.el)).show();
2368
+ $('.description-link', $(this.el)).addClass('selected');
2369
+ return $('.snippet-link', $(this.el)).removeClass('selected');
2370
+ };
2371
+
2372
+ SignatureView.prototype.switchToSnippet = function(e) {
2373
+ if (e != null) {
2374
+ e.preventDefault();
2375
+ }
2376
+ $(".description", $(this.el)).hide();
2377
+ $(".snippet", $(this.el)).show();
2378
+ $('.snippet-link', $(this.el)).addClass('selected');
2379
+ return $('.description-link', $(this.el)).removeClass('selected');
2380
+ };
2381
+
2382
+ SignatureView.prototype.snippetToTextArea = function(e) {
2383
+ var textArea;
2384
+ if (this.isParam) {
2385
+ if (e != null) {
2386
+ e.preventDefault();
2387
+ }
2388
+ textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2389
+ if ($.trim(textArea.val()) === '') {
2390
+ return textArea.val(this.model.sampleJSON);
2391
+ }
2392
+ }
2393
+ };
2394
+
2395
+ return SignatureView;
2396
+
2397
+ })(Backbone.View);
2398
+
2399
+ ContentTypeView = (function(_super) {
2400
+ __extends(ContentTypeView, _super);
2401
+
2402
+ function ContentTypeView() {
2403
+ _ref8 = ContentTypeView.__super__.constructor.apply(this, arguments);
2404
+ return _ref8;
2405
+ }
2406
+
2407
+ ContentTypeView.prototype.initialize = function() {};
2408
+
2409
+ ContentTypeView.prototype.render = function() {
2410
+ var template;
2411
+ template = this.template();
2412
+ $(this.el).html(template(this.model));
2413
+ $('label[for=contentType]', $(this.el)).text('Response Content Type');
2414
+ return this;
2415
+ };
2416
+
2417
+ ContentTypeView.prototype.template = function() {
2418
+ return Handlebars.templates.content_type;
2419
+ };
2420
+
2421
+ return ContentTypeView;
2422
+
2423
+ })(Backbone.View);
2424
+
2425
+ ResponseContentTypeView = (function(_super) {
2426
+ __extends(ResponseContentTypeView, _super);
2427
+
2428
+ function ResponseContentTypeView() {
2429
+ _ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2430
+ return _ref9;
2431
+ }
2432
+
2433
+ ResponseContentTypeView.prototype.initialize = function() {};
2434
+
2435
+ ResponseContentTypeView.prototype.render = function() {
2436
+ var template;
2437
+ template = this.template();
2438
+ $(this.el).html(template(this.model));
2439
+ $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2440
+ return this;
2441
+ };
2442
+
2443
+ ResponseContentTypeView.prototype.template = function() {
2444
+ return Handlebars.templates.response_content_type;
2445
+ };
2446
+
2447
+ return ResponseContentTypeView;
2448
+
2449
+ })(Backbone.View);
2450
+
2451
+ ParameterContentTypeView = (function(_super) {
2452
+ __extends(ParameterContentTypeView, _super);
2453
+
2454
+ function ParameterContentTypeView() {
2455
+ _ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments);
2456
+ return _ref10;
2457
+ }
2458
+
2459
+ ParameterContentTypeView.prototype.initialize = function() {};
2460
+
2461
+ ParameterContentTypeView.prototype.render = function() {
2462
+ var template;
2463
+ template = this.template();
2464
+ $(this.el).html(template(this.model));
2465
+ $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
2466
+ return this;
2467
+ };
2468
+
2469
+ ParameterContentTypeView.prototype.template = function() {
2470
+ return Handlebars.templates.parameter_content_type;
2471
+ };
2472
+
2473
+ return ParameterContentTypeView;
2474
+
2475
+ })(Backbone.View);
2476
+
2477
+ }).call(this);