grape-swagger-rails 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 152bb90be94cae05b81b87f42368c6719a2a21f3
4
- data.tar.gz: b9bc6765e65eeff9c2be89c1585a9fb1fe510c0c
3
+ metadata.gz: 2bfe13ae83fc3b7f7cfb25f755c82eb07edf7eaa
4
+ data.tar.gz: 3f9a15bf857253b985ede095b3dcfbbf9d0d6a17
5
5
  SHA512:
6
- metadata.gz: bf8357616fb1ad5c37eedd898974cab1a490896ad1db7c3b22074ec059e4449d20c33c439b87d35786e765821b10e61cbcccb49848ed6d292d785f14ce6781d8
7
- data.tar.gz: 5809915de4360518b98217321d4487f5455c067b745b4a304d798b86382965ff743e6493adcec4dbeaee00e64903d7eabbbb5afa41d8eeb45fa56c7ec12c95b6
6
+ metadata.gz: 48c7269055cf898aa636b0999b14079819ec29753c789ad327b25909abac89c9754efab47105a4710e95944dae69dba91cc4daefe60bdf79750c5bdfa978e299
7
+ data.tar.gz: 4be87ec4ad572c8efdcab73b5251d085774ed1430c76d88d6a910efbfe98eebd98f5d257ec8a42b94b913a50b03acb0b5f485cbbb8b0c13cc46f986ca7c79de5
data/README.md CHANGED
@@ -6,7 +6,9 @@ Swagger UI as Rails Engine for grape-swagger gem
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'grape-swagger-rails'
9
+ ```ruby
10
+ gem 'grape-swagger-rails'
11
+ ```
10
12
 
11
13
  And then execute:
12
14
 
@@ -16,22 +18,75 @@ Or install it yourself as:
16
18
 
17
19
  $ gem install grape-swagger-rails
18
20
 
19
- ## Usage: add this line to your routes.rb
21
+ ## Usage
20
22
 
21
- mount GrapeSwaggerRails::Engine => '/swagger'
23
+ Add this line to `./config/routes.rb`:
22
24
 
23
- Create `./config/initializer/swagger.rb` with lines:
25
+ ```ruby
26
+ mount GrapeSwaggerRails::Engine => '/swagger'
27
+ ```
24
28
 
25
- GrapeSwaggerRails.options.url = "/swagger_doc.json"
26
- GrapeSwaggerRails.options.app_name = 'Swagger'
27
- GrapeSwaggerRails.options.app_url = 'http://swagger.wordnik.com'
29
+ Create an initializer (e.g. `./config/initializer/swagger.rb`) and specify the URL to your Swagger API schema:
30
+
31
+ ```ruby
32
+ GrapeSwaggerRails.options.url = '/swagger_doc.json'
33
+ GrapeSwaggerRails.options.app_name = 'Swagger'
34
+ GrapeSwaggerRails.options.app_url = 'http://swagger.wordnik.com'
35
+ ```
36
+
37
+ You can specify additional headers to add to each request:
38
+
39
+ ```ruby
40
+ GrapeSwaggerRails.options.headers['Special-Header'] = 'Some Secret Value'
41
+ ```
42
+
43
+ Using the `headers` option above, you could hard-code Basic Authentication credentials.
44
+ Alternatively, you can configure Basic Authentication through the UI, as described below.
45
+
46
+ ### Basic Authentication
47
+
48
+ If your application uses Basic Authentication, you can setup Swagger to send the username and password to the server with each request to your API:
49
+
50
+ ```ruby
51
+ GrapeSwaggerRails.options.api_auth = 'basic'
52
+ GrapeSwaggerRails.options.api_key_name = 'Authorization'
53
+ GrapeSwaggerRails.options.api_key_type = 'header'
54
+ ```
55
+
56
+ Now you can specify the username and password to your API in the Swagger "API key" field by concatenating the values like this:
57
+
58
+ username:password
59
+
60
+ The javascript that loads on the Swagger page automatically encodes the username and password and adds the authorization header to your API request.
61
+ See the official Swagger documentation about [Custom Header Parameters](https://github.com/wordnik/swagger-ui#custom-header-parameters---for-basic-auth-etc)
62
+
63
+ ### Swagger UI Authorization
64
+
65
+ You may want to authenticate users before displaying the Swagger UI, particularly when the API is protected by Basic Authentication.
66
+ Use the `authenticate_with` option to inspect the request to the Swagger UI:
67
+
68
+ ```ruby
69
+ GrapeSwaggerRails.options.authenticate_with do |request|
70
+ # 1. Inspect the `request` or access the Swagger UI controller via `self`
71
+ # 2. Check `current_user` or `can? :access, :api`, etc....
72
+ # 3. return a boolean value
73
+ end
74
+ ```
75
+
76
+ The block above is stored in the `authentication_proc` option:
77
+
78
+ ```ruby
79
+ GrapeSwaggerRails.options.authentication_proc: Proc.new{|request| # return a boolean value}
80
+ ```
28
81
 
29
82
  ## Known problems
30
83
 
31
84
  To avoid problems with the validation parameters in `POST` request using this gem,
32
85
  please use the head version:
33
86
 
34
- gem 'grape-swagger', :git=>'git://github.com/jhecking/grape-swagger.git'
87
+ ```ruby
88
+ gem 'grape-swagger', :git=>'git://github.com/jhecking/grape-swagger.git'
89
+ ```
35
90
 
36
91
  ## Contributing
37
92
 
@@ -352,7 +352,7 @@ function program9(depth0,data) {
352
352
  function program11(depth0,data) {
353
353
 
354
354
 
355
- 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 <img alt='Throbber' class='response_throbber' src='/assets/grape_swagger_rails/throbber.gif' style='display:none' />\n </div>\n ";
355
+ 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 <img alt='Throbber' class='response_throbber' src='<%= image_path("grape_swagger_rails/throbber.gif") %>' style='display:none' />\n </div>\n ";
356
356
  }
357
357
 
358
358
  buffer += "\n <ul class='operations' >\n <li class='";
@@ -1281,13 +1281,24 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1281
1281
  };
1282
1282
 
1283
1283
  SwaggerUi.prototype.buildUrl = function(base, url) {
1284
- var parts;
1285
- console.log("base is " + base);
1286
- parts = base.split("/");
1287
- base = parts[0] + "//" + parts[2];
1284
+ var endOfPath, parts;
1285
+ log("base is " + base);
1288
1286
  if (url.indexOf("/") === 0) {
1287
+ parts = base.split("/");
1288
+ base = parts[0] + "//" + parts[2];
1289
1289
  return base + url;
1290
1290
  } else {
1291
+ endOfPath = base.length;
1292
+ if (base.indexOf("?") > -1) {
1293
+ endOfPath = Math.min(endOfPath, base.indexOf("?"));
1294
+ }
1295
+ if (base.indexOf("#") > -1) {
1296
+ endOfPath = Math.min(endOfPath, base.indexOf("#"));
1297
+ }
1298
+ base = base.substring(0, endOfPath);
1299
+ if (base.indexOf("/", base.length - 1) !== -1) {
1300
+ return base + url;
1301
+ }
1291
1302
  return base + "/" + url;
1292
1303
  }
1293
1304
  };
@@ -1435,7 +1446,6 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1435
1446
 
1436
1447
  ResourceView.prototype.render = function() {
1437
1448
  var operation, _i, _len, _ref4;
1438
- console.log(this.model.description);
1439
1449
  $(this.el).html(Handlebars.templates.resource(this.model));
1440
1450
  this.number = 0;
1441
1451
  _ref4 = this.model.operationsArray;
@@ -1513,7 +1523,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1513
1523
  type = param.type || param.dataType;
1514
1524
  if (type.toLowerCase() === 'file') {
1515
1525
  if (!contentTypeModel.consumes) {
1516
- console.log("set content type ");
1526
+ log("set content type ");
1517
1527
  contentTypeModel.consumes = 'multipart/form-data';
1518
1528
  }
1519
1529
  }
@@ -1622,9 +1632,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1622
1632
  };
1623
1633
 
1624
1634
  OperationView.prototype.handleFileUpload = function(map, form) {
1625
- var bodyParam, headerParams, o, obj, param, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7,
1635
+ var bodyParam, el, headerParams, o, obj, param, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
1626
1636
  _this = this;
1627
- console.log("it's a file upload");
1637
+ log("it's a file upload");
1628
1638
  _ref5 = form.serializeArray();
1629
1639
  for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1630
1640
  o = _ref5[_i];
@@ -1648,11 +1658,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1648
1658
  headerParams[param.name] = map[param.name];
1649
1659
  }
1650
1660
  }
1651
- console.log(headerParams);
1652
- $.each($('input[type~="file"]'), function(i, el) {
1653
- return bodyParam.append($(el).attr('name'), el.files[0]);
1654
- });
1655
- console.log(bodyParam);
1661
+ log(headerParams);
1662
+ _ref8 = form.find('input[type~="file"]');
1663
+ for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
1664
+ el = _ref8[_l];
1665
+ bodyParam.append($(el).attr('name'), el.files[0]);
1666
+ }
1667
+ log(bodyParam);
1656
1668
  this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1657
1669
  $(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
1658
1670
  obj = {
@@ -1688,7 +1700,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1688
1700
  o.content.data = data.responseText;
1689
1701
  o.getHeaders = function() {
1690
1702
  return {
1691
- "Content-Type": data.getResponseHeader("Content-Type")
1703
+ "Content-Type": data.headers("Content-Type")
1692
1704
  };
1693
1705
  };
1694
1706
  o.request = {};
@@ -1813,34 +1825,34 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1813
1825
  return formatted;
1814
1826
  };
1815
1827
 
1816
- OperationView.prototype.showStatus = function(data) {
1828
+ OperationView.prototype.showStatus = function(response) {
1817
1829
  var code, content, contentType, headers, pre, response_body;
1818
- content = data.content.data;
1819
- headers = data.getHeaders();
1820
- contentType = headers["Content-Type"];
1821
- if (content === void 0) {
1830
+ content = response.data;
1831
+ headers = response.headers;
1832
+ contentType = headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
1833
+ if (!content) {
1822
1834
  code = $('<code />').text("no content");
1823
1835
  pre = $('<pre class="json" />').append(code);
1824
- } else if (contentType.indexOf("application/json") === 0 || contentType.indexOf("application/hal+json") === 0) {
1825
- code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2));
1836
+ } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1837
+ code = $('<code />').text(JSON.stringify(JSON.parse(content), null, " "));
1826
1838
  pre = $('<pre class="json" />').append(code);
1827
- } else if (contentType.indexOf("application/xml") === 0) {
1839
+ } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1828
1840
  code = $('<code />').text(this.formatXml(content));
1829
1841
  pre = $('<pre class="xml" />').append(code);
1830
- } else if (contentType.indexOf("text/html") === 0) {
1842
+ } else if (contentType === "text/html") {
1831
1843
  code = $('<code />').html(content);
1832
1844
  pre = $('<pre class="xml" />').append(code);
1833
- } else if (contentType.indexOf("image/") === 0) {
1834
- pre = $('<img>').attr('src', data.request.url);
1845
+ } else if (/^image\//.test(contentType)) {
1846
+ pre = $('<img>').attr('src', response.url);
1835
1847
  } else {
1836
1848
  code = $('<code />').text(content);
1837
1849
  pre = $('<pre class="json" />').append(code);
1838
1850
  }
1839
1851
  response_body = pre;
1840
- $(".request_url", $(this.el)).html("<pre>" + data.request.url + "</pre>");
1841
- $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
1852
+ $(".request_url", $(this.el)).html("<pre>" + response.url + "</pre>");
1853
+ $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1842
1854
  $(".response_body", $(this.el)).html(response_body);
1843
- $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(data.getHeaders(), null, " ").replace(/\n/g, "<br>") + "</pre>");
1855
+ $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>");
1844
1856
  $(".response", $(this.el)).slideDown();
1845
1857
  $(".response_hider", $(this.el)).show();
1846
1858
  $(".response_throbber", $(this.el)).hide();
@@ -1 +1 @@
1
- $(function(){$.fn.vAlign=function(){return this.each(function(c){var a=$(this).height();var d=$(this).parent().height();var b=(d-a)/2;$(this).css("margin-top",b)})};$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(b){var d=$(this).closest("form").innerWidth();var c=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10);var a=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",d-c-a)})};$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent();$("ul.downplayed li div.content p").vAlign();$("form.sandbox").submit(function(){var a=true;$(this).find("input.required").each(function(){$(this).removeClass("error");if($(this).val()==""){$(this).addClass("error");$(this).wiggle();a=false}});return a})});function clippyCopiedCallback(b){$("#api_key_copied").fadeIn().delay(1000).fadeOut()}function log(){if(window.console){console.log.apply(console,arguments)}}if(Function.prototype.bind&&console&&typeof console.log=="object"){["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(a){console[a]=this.bind(console[a],console)},Function.prototype.call)}var Docs={shebang:function(){var b=$.param.fragment().split("/");b.shift();switch(b.length){case 1:var d="resource_"+b[0];Docs.expandEndpointListForResource(b[0]);$("#"+d).slideto({highlight:false});break;case 2:Docs.expandEndpointListForResource(b[0]);$("#"+d).slideto({highlight:false});var c=b.join("_");var a=c+"_content";Docs.expandOperation($("#"+a));$("#"+c).slideto({highlight:false});break}},toggleEndpointListForResource:function(b){var a=$("li#resource_"+Docs.escapeResourceName(b)+" ul.endpoints");if(a.is(":visible")){Docs.collapseEndpointListForResource(b)}else{Docs.expandEndpointListForResource(b)}},expandEndpointListForResource:function(b){var b=Docs.escapeResourceName(b);if(b==""){$(".resource ul.endpoints").slideDown();return}$("li#resource_"+b).addClass("active");var a=$("li#resource_"+b+" ul.endpoints");a.slideDown()},collapseEndpointListForResource:function(b){var b=Docs.escapeResourceName(b);$("li#resource_"+b).removeClass("active");var a=$("li#resource_"+b+" ul.endpoints");a.slideUp()},expandOperationsForResource:function(a){Docs.expandEndpointListForResource(a);if(a==""){$(".resource ul.endpoints li.operation div.content").slideDown();return}$("li#resource_"+Docs.escapeResourceName(a)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(a){Docs.expandEndpointListForResource(a);$("li#resource_"+Docs.escapeResourceName(a)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(a){return a.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(a){a.slideDown()},collapseOperation:function(a){a.slideUp()}};(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="contentType"></label>\n<select name="contentType">\n';c=f["if"].call(l,l.produces,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n</select>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.main=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",c,h="function",j=this.escapeExpression,p=this;function e(v,u){var r="",t,s;r+='\n <div class="info_title">'+j(((t=((t=v.info),t==null||t===false?t:t.title)),typeof t===h?t.apply(v):t))+'</div>\n <div class="info_description">';s=((t=((t=v.info),t==null||t===false?t:t.description)),typeof t===h?t.apply(v):t);if(s||s===0){r+=s}r+="</div>\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.termsOfServiceUrl),{hash:{},inverse:p.noop,fn:p.program(2,d,u),data:u});if(s||s===0){r+=s}r+="\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.contact),{hash:{},inverse:p.noop,fn:p.program(4,q,u),data:u});if(s||s===0){r+=s}r+="\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.license),{hash:{},inverse:p.noop,fn:p.program(6,o,u),data:u});if(s||s===0){r+=s}r+="\n ";return r}function d(u,t){var r="",s;r+='<div class="info_tos"><a href="'+j(((s=((s=u.info),s==null||s===false?s:s.termsOfServiceUrl)),typeof s===h?s.apply(u):s))+'">Terms of service</a></div>';return r}function q(u,t){var r="",s;r+="<div class='info_contact'><a href=\"mailto:"+j(((s=((s=u.info),s==null||s===false?s:s.contact)),typeof s===h?s.apply(u):s))+'">Contact the developer</a></div>';return r}function o(u,t){var r="",s;r+="<div class='info_license'><a href='"+j(((s=((s=u.info),s==null||s===false?s:s.licenseUrl)),typeof s===h?s.apply(u):s))+"'>"+j(((s=((s=u.info),s==null||s===false?s:s.license)),typeof s===h?s.apply(u):s))+"</a></div>";return r}function n(u,t){var r="",s;r+='\n , <span style="font-variant: small-caps">api version</span>: ';if(s=f.apiVersion){s=s.call(u,{hash:{},data:t})}else{s=u.apiVersion;s=typeof s===h?s.apply(u):s}r+=j(s)+"\n ";return r}i+="<div class='info' id='api_info'>\n ";c=f["if"].call(m,m.info,{hash:{},inverse:p.noop,fn:p.program(1,e,k),data:k});if(c||c===0){i+=c}i+="\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>: ";if(c=f.basePath){c=c.call(m,{hash:{},data:k})}else{c=m.basePath;c=typeof c===h?c.apply(m):c}i+=j(c)+"\n ";c=f["if"].call(m,m.apiVersion,{hash:{},inverse:p.noop,fn:p.program(8,n,k),data:k});if(c||c===0){i+=c}i+="]</h4>\n </div>\n</div>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.operation=b(function(h,n,g,m,l){this.compilerInfo=[4,">= 1.0.0"];g=this.merge(g,h.helpers);l=l||{};var j="",d,i="function",k=this.escapeExpression,r=this;function f(v,u){var s="",t;s+="\n <h4>Implementation Notes</h4>\n <p>";if(t=g.notes){t=t.call(v,{hash:{},data:u})}else{t=v.notes;t=typeof t===i?t.apply(v):t}if(t||t===0){s+=t}s+="</p>\n ";return s}function c(t,s){return'\n <h4>Response Class</h4>\n <p><span class="model-signature" /></p>\n <br/>\n <div class="response-content-type" />\n '}function q(t,s){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 '}function p(t,s){return"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "}function o(t,s){return"\n "}function e(t,s){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 <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n "}j+="\n <ul class='operations' >\n <li class='";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+" operation' id='";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+"'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"</a>\n </span>\n <span class='path'>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.path){d=d.call(n,{hash:{},data:l})}else{d=n.path;d=typeof d===i?d.apply(n):d}j+=k(d)+"</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.summary){d=d.call(n,{hash:{},data:l})}else{d=n.summary;d=typeof d===i?d.apply(n):d}if(d||d===0){j+=d}j+="</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+"_content' style='display:none'>\n ";d=g["if"].call(n,n.notes,{hash:{},inverse:r.noop,fn:r.program(1,f,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.type,{hash:{},inverse:r.noop,fn:r.program(3,c,l),data:l});if(d||d===0){j+=d}j+="\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";d=g["if"].call(n,n.parameters,{hash:{},inverse:r.noop,fn:r.program(5,q,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.responseMessages,{hash:{},inverse:r.noop,fn:r.program(7,p,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.isReadOnly,{hash:{},inverse:r.program(11,e,l),fn:r.program(9,o,l),data:l});if(d||d===0){j+=d}j+="\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";return j})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param=b(function(f,q,o,j,s){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);s=s||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.isFile,{hash:{},inverse:n.program(4,k,w),fn:n.program(2,l,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function l(x,w){var u="",v;u+='\n <input type="file" name=\'';if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+'\'/>\n <div class="parameter-content-type" />\n ';return u}function k(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(7,h,w),fn:n.program(5,i,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function i(x,w){var u="",v;u+="\n <textarea class='body-textarea' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"'>";if(v=o.defaultValue){v=v.call(x,{hash:{},data:w})}else{v=x.defaultValue;v=typeof v===d?v.apply(x):v}u+=c(v)+"</textarea>\n ";return u}function h(x,w){var u="",v;u+="\n <textarea class='body-textarea' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n ';return u}function e(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(12,r,w),fn:n.program(10,t,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function t(x,w){var u="",v;u+="\n <input class='parameter' minlength='0' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"' placeholder='' type='text' value='";if(v=o.defaultValue){v=v.call(x,{hash:{},data:w})}else{v=x.defaultValue;v=typeof v===d?v.apply(x):v}u+=c(v)+"'/>\n ";return u}function r(x,w){var u="",v;u+="\n <input class='parameter' minlength='0' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"' placeholder='' type='text' value=''/>\n ";return u}p+="<td class='code'>";if(g=o.name){g=g.call(q,{hash:{},data:s})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+"</td>\n<td>\n\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,s),fn:n.program(1,m,s),data:s});if(g||g===0){p+=g}p+="\n\n</td>\n<td>";if(g=o.description){g=g.call(q,{hash:{},data:s})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+="</td>\n<td>";if(g=o.paramType){g=g.call(q,{hash:{},data:s})}else{g=q.paramType;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+='</td>\n<td>\n <span class="model-signature"></span>\n</td>\n';return p})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_list=b(function(g,r,p,l,w){this.compilerInfo=[4,">= 1.0.0"];p=this.merge(p,g.helpers);w=w||{};var q="",i,e,o=this,d="function",c=this.escapeExpression;function n(y,x){return" multiple='multiple'"}function m(y,x){return"\n "}function k(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.defaultValue,{hash:{},inverse:o.program(8,h,z),fn:o.program(6,j,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function j(y,x){return"\n "}function h(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.allowMultiple,{hash:{},inverse:o.program(11,v,z),fn:o.program(9,f,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function f(y,x){return"\n "}function v(y,x){return"\n <option selected=\"\" value=''></option>\n "}function u(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.isDefault,{hash:{},inverse:o.program(16,s,z),fn:o.program(14,t,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function t(A,z){var x="",y;x+='\n <option selected="" value=\'';if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"'>";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+" (default)</option>\n ";return x}function s(A,z){var x="",y;x+="\n <option value='";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"'>";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"</option>\n ";return x}q+="<td class='code'>";if(i=p.name){i=i.call(r,{hash:{},data:w})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+"</td>\n<td>\n <select ";i=p["if"].call(r,r.allowMultiple,{hash:{},inverse:o.noop,fn:o.program(1,n,w),data:w});if(i||i===0){q+=i}q+=" class='parameter' name='";if(i=p.name){i=i.call(r,{hash:{},data:w})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+"'>\n ";i=p["if"].call(r,r.required,{hash:{},inverse:o.program(5,k,w),fn:o.program(3,m,w),data:w});if(i||i===0){q+=i}q+="\n ";e=p.each.call(r,((i=r.allowableValues),i==null||i===false?i:i.descriptiveValues),{hash:{},inverse:o.noop,fn:o.program(13,u,w),data:w});if(e||e===0){q+=e}q+="\n </select>\n</td>\n<td>";if(e=p.description){e=e.call(r,{hash:{},data:w})}else{e=r.description;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+="</td>\n<td>";if(e=p.paramType){e=e.call(r,{hash:{},data:w})}else{e=r.paramType;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+='</td>\n<td><span class="model-signature"></span></td>';return q})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,h="function",j=this.escapeExpression,o=this;function e(t,s){var q="",r;q+="\n <textarea class='body-textarea' readonly='readonly' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{hash:{},inverse:o.program(6,n,s),fn:o.program(4,p,s),data:s});if(r||r===0){q+=r}q+="\n ";return q}function p(t,s){var q="",r;q+="\n ";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code'>";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+"</td>\n<td>\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:o.program(3,c,k),fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n</td>\n<td>";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+="</td>\n<td>";if(d=f.paramType){d=d.call(m,{hash:{},data:k})}else{d=m.paramType;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+='</td>\n<td><span class="model-signature"></span></td>\n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly_required=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,h="function",j=this.escapeExpression,o=this;function e(t,s){var q="",r;q+="\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{hash:{},inverse:o.program(6,n,s),fn:o.program(4,p,s),data:s});if(r||r===0){q+=r}q+="\n ";return q}function p(t,s){var q="",r;q+="\n ";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code required'>";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+"</td>\n<td>\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:o.program(3,c,k),fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n</td>\n<td>";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+="</td>\n<td>";if(d=f.paramType){d=d.call(m,{hash:{},data:k})}else{d=m.paramType;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+='</td>\n<td><span class="model-signature"></span></td>\n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_required=b(function(f,q,o,j,u){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);u=u||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.isFile,{hash:{},inverse:n.program(4,k,y),fn:n.program(2,l,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function l(z,y){var w="",x;w+='\n <input type="file" name=\'';if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function k(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{hash:{},inverse:n.program(7,h,y),fn:n.program(5,i,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function i(z,y){var w="",x;w+="\n <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'>";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"</textarea>\n ";return w}function h(z,y){var w="",x;w+="\n <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n ';return w}function e(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.isFile,{hash:{},inverse:n.program(12,t,y),fn:n.program(10,v,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function v(z,y){var w="",x;w+="\n <input class='parameter' class='required' type='file' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function t(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{hash:{},inverse:n.program(15,r,y),fn:n.program(13,s,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function s(z,y){var w="",x;w+="\n <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value='";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function r(z,y){var w="",x;w+="\n <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value=''/>\n ";return w}p+="<td class='code required'>";if(g=o.name){g=g.call(q,{hash:{},data:u})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+"</td>\n<td>\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,u),fn:n.program(1,m,u),data:u});if(g||g===0){p+=g}p+="\n</td>\n<td>\n <strong>";if(g=o.description){g=g.call(q,{hash:{},data:u})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+="</strong>\n</td>\n<td>";if(g=o.paramType){g=g.call(q,{hash:{},data:u})}else{g=q.paramType;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+='</td>\n<td><span class="model-signature"></span></td>\n';return p})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.parameter_content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.consumes,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="parameterContentType"></label>\n<select name="parameterContentType">\n';c=f["if"].call(l,l.consumes,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n</select>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.resource=b(function(f,l,e,k,j){this.compilerInfo=[4,">= 1.0.0"];e=this.merge(e,f.helpers);j=j||{};var h="",c,o,g="function",i=this.escapeExpression,n=this,m=e.blockHelperMissing;function d(q,p){return" : "}h+="<div class='heading'>\n <h2>\n <a href='#!/";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"' onclick=\"Docs.toggleEndpointListForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"');\">";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"</a> ";o={hash:{},inverse:n.noop,fn:n.program(1,d,j),data:j};if(c=e.description){c=c.call(l,o)}else{c=l.description;c=typeof c===g?c.apply(l):c}if(!e.description){c=m.call(l,c,o)}if(c||c===0){h+=c}if(c=e.description){c=c.call(l,{hash:{},data:j})}else{c=l.description;c=typeof c===g?c.apply(l):c}if(c||c===0){h+=c}h+="\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"' id='endpointListTogger_";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'\n onclick=\"Docs.toggleEndpointListForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";if(c=e.url){c=c.call(l,{hash:{},data:j})}else{c=l.url;c=typeof c===g?c.apply(l):c}h+=i(c)+"'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"_endpoint_list' style='display:none'>\n\n</ul>\n";return h})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.response_content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="responseContentType"></label>\n<select name="responseContentType">\n';c=f["if"].call(l,l.produces,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n</select>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.signature=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+='<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 ';if(c=d.signature){c=c.call(k,{hash:{},data:i})}else{c=k.signature;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+='\n </div>\n\n <div class="snippet">\n <pre><code>';if(c=d.sampleJSON){c=c.call(k,{hash:{},data:i})}else{c=k.sampleJSON;c=typeof c===f?c.apply(k):c}g+=h(c)+'</code></pre>\n <small class="notice"></small>\n </div>\n</div>\n\n';return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.status_code=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="<td width='15%' class='code'>";if(c=d.code){c=c.call(k,{hash:{},data:i})}else{c=k.code;c=typeof c===f?c.apply(k):c}g+=h(c)+"</td>\n<td>";if(c=d.message){c=c.call(k,{hash:{},data:i})}else{c=k.message;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+="</td>\n";return g})})();(function(){var j,r,u,o,l,k,n,m,i,p,s,q,h,c,g,f,e,d,b,a,x,w,t={}.hasOwnProperty,v=function(B,z){for(var y in z){if(t.call(z,y)){B[y]=z[y]}}function A(){this.constructor=B}A.prototype=z.prototype;B.prototype=new A();B.__super__=z.prototype;return B};s=(function(z){v(y,z);function y(){q=y.__super__.constructor.apply(this,arguments);return q}y.prototype.dom_id="swagger_ui";y.prototype.options=null;y.prototype.api=null;y.prototype.headerView=null;y.prototype.mainView=null;y.prototype.initialize=function(A){var B=this;if(A==null){A={}}if(A.dom_id!=null){this.dom_id=A.dom_id;delete A.dom_id}if($("#"+this.dom_id)==null){$("body").append('<div id="'+this.dom_id+'"></div>')}this.options=A;this.options.success=function(){return B.render()};this.options.progress=function(C){return B.showMessage(C)};this.options.failure=function(C){return B.onLoadFailure(C)};this.headerView=new r({el:$("#header")});return this.headerView.on("update-swagger-ui",function(C){return B.updateSwaggerUi(C)})};y.prototype.updateSwaggerUi=function(A){this.options.url=A.url;return this.load()};y.prototype.load=function(){var B,A;if((A=this.mainView)!=null){A.clear()}B=this.options.url;if(B.indexOf("http")!==0){B=this.buildUrl(window.location.href.toString(),B)}this.options.url=B;this.headerView.update(B);this.api=new SwaggerApi(this.options);this.api.build();return this.api};y.prototype.render=function(){var A=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new u({model:this.api,el:$("#"+this.dom_id)}).render();this.showMessage();switch(this.options.docExpansion){case"full":Docs.expandOperationsForResource("");break;case"list":Docs.collapseOperationsForResource("")}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};y.prototype.buildUrl=function(B,A){var C;console.log("base is "+B);C=B.split("/");B=C[0]+"//"+C[2];if(A.indexOf("/")===0){return B+A}else{return B+"/"+A}};y.prototype.showMessage=function(A){if(A==null){A=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(A)};y.prototype.onLoadFailure=function(A){var B;if(A==null){A=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");B=$("#message-bar").html(A);if(this.options.onFailure!=null){this.options.onFailure(A)}return B};return y})(Backbone.Router);window.SwaggerUi=s;r=(function(z){v(y,z);function y(){h=y.__super__.constructor.apply(this,arguments);return h}y.prototype.events={"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"};y.prototype.initialize=function(){};y.prototype.showPetStore=function(A){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})};y.prototype.showWordnikDev=function(A){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})};y.prototype.showCustomOnKeyup=function(A){if(A.keyCode===13){return this.showCustom()}};y.prototype.showCustom=function(A){if(A!=null){A.preventDefault()}return this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};y.prototype.update=function(B,C,A){if(A==null){A=false}$("#input_baseUrl").val(B);if(A){return this.trigger("update-swagger-ui",{url:B})}};return y})(Backbone.View);u=(function(y){v(z,y);function z(){g=z.__super__.constructor.apply(this,arguments);return g}z.prototype.initialize=function(){};z.prototype.render=function(){var C,B,A,D;$(this.el).html(Handlebars.templates.main(this.model));D=this.model.apisArray;for(B=0,A=D.length;B<A;B++){C=D[B];this.addResource(C)}return this};z.prototype.addResource=function(B){var A;A=new n({model:B,tagName:"li",id:"resource_"+B.name,className:"resource"});return $("#resources").append(A.render().el)};z.prototype.clear=function(){return $(this.el).html("")};return z})(Backbone.View);n=(function(z){v(y,z);function y(){f=y.__super__.constructor.apply(this,arguments);return f}y.prototype.initialize=function(){};y.prototype.render=function(){var B,C,A,D;console.log(this.model.description);$(this.el).html(Handlebars.templates.resource(this.model));this.number=0;D=this.model.operationsArray;for(C=0,A=D.length;C<A;C++){B=D[C];this.addOperation(B)}return this};y.prototype.addOperation=function(A){var B;A.number=this.number;B=new o({model:A,tagName:"li",className:"endpoint"});$(".endpoints",$(this.el)).append(B.render().el);return this.number++};return y})(Backbone.View);o=(function(z){v(y,z);function y(){e=y.__super__.constructor.apply(this,arguments);return e}y.prototype.invocationUrl=null;y.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent"};y.prototype.initialize=function(){};y.prototype.render=function(){var A,P,G,M,K,Q,L,N,J,I,H,O,E,C,F,D,B;P=true;if(!P){this.model.isReadOnly=true}$(this.el).html(Handlebars.templates.operation(this.model));if(this.model.responseClassSignature&&this.model.responseClassSignature!=="string"){Q={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};K=new i({model:Q,tagName:"div"});$(".model-signature",$(this.el)).append(K.render().el)}else{$(".model-signature",$(this.el)).html(this.model.type)}A={isParam:false};A.consumes=this.model.consumes;A.produces=this.model.produces;F=this.model.parameters;for(J=0,O=F.length;J<O;J++){G=F[J];N=G.type||G.dataType;if(N.toLowerCase()==="file"){if(!A.consumes){console.log("set content type ");A.consumes="multipart/form-data"}}}M=new m({model:A});$(".response-content-type",$(this.el)).append(M.render().el);D=this.model.parameters;for(I=0,E=D.length;I<E;I++){G=D[I];this.addParameter(G,A.consumes)}B=this.model.responseMessages;for(H=0,C=B.length;H<C;H++){L=B[H];this.addStatusCode(L)}return this};y.prototype.addParameter=function(C,A){var B;C.consumes=A;B=new k({model:C,tagName:"tr",readOnly:this.model.isReadOnly});return $(".operation-params",$(this.el)).append(B.render().el)};y.prototype.addStatusCode=function(B){var A;A=new p({model:B,tagName:"tr"});return $(".operation-status",$(this.el)).append(A.render().el)};y.prototype.submitOperation=function(O){var Q,G,N,D,I,A,J,M,L,K,P,F,C,H,E,B;if(O!=null){O.preventDefault()}G=$(".sandbox",$(this.el));Q=true;G.find("input.required").each(function(){var R=this;$(this).removeClass("error");if(jQuery.trim($(this).val())===""){$(this).addClass("error");$(this).wiggle({callback:function(){return $(R).focus()}});return Q=false}});if(Q){D={};A={parent:this};N=false;H=G.find("input");for(M=0,P=H.length;M<P;M++){I=H[M];if((I.value!=null)&&jQuery.trim(I.value).length>0){D[I.name]=I.value}if(I.type==="file"){N=true}}E=G.find("textarea");for(L=0,F=E.length;L<F;L++){I=E[L];if((I.value!=null)&&jQuery.trim(I.value).length>0){D.body=I.value}}B=G.find("select");for(K=0,C=B.length;K<C;K++){I=B[K];J=this.getSelectedValue(I);if((J!=null)&&jQuery.trim(J).length>0){D[I.name]=J}}A.responseContentType=$("div select[name=responseContentType]",$(this.el)).val();A.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val();$(".response_throbber",$(this.el)).show();if(N){return this.handleFileUpload(D,G)}else{return this.model["do"](D,A,this.showCompleteStatus,this.showErrorStatus,this)}}};y.prototype.success=function(A,B){return B.showCompleteStatus(A)};y.prototype.handleFileUpload=function(C,F){var Q,P,H,M,I,L,K,J,O,E,B,G,D,A,N=this;console.log("it's a file upload");G=F.serializeArray();for(L=0,O=G.length;L<O;L++){H=G[L];if((H.value!=null)&&jQuery.trim(H.value).length>0){C[H.name]=H.value}}Q=new FormData();D=this.model.parameters;for(K=0,E=D.length;K<E;K++){I=D[K];if(I.paramType==="form"){Q.append(I.name,C[I.name])}}P={};A=this.model.parameters;for(J=0,B=A.length;J<B;J++){I=A[J];if(I.paramType==="header"){P[I.name]=C[I.name]}}console.log(P);$.each($('input[type~="file"]'),function(R,S){return Q.append($(S).attr("name"),S.files[0])});console.log(Q);this.invocationUrl=this.model.supportHeaderParams()?(P=this.model.getHeaderParams(C),this.model.urlify(C,false)):this.model.urlify(C,true);$(".request_url",$(this.el)).html("<pre>"+this.invocationUrl+"</pre>");M={type:this.model.method,url:this.invocationUrl,headers:P,data:Q,dataType:"json",contentType:false,processData:false,error:function(S,T,R){return N.showErrorStatus(N.wrap(S),N)},success:function(R){return N.showResponse(R,N)},complete:function(R){return N.showCompleteStatus(N.wrap(R),N)}};if(window.authorizations){window.authorizations.apply(M)}jQuery.ajax(M);return false};y.prototype.wrap=function(A){var B,C=this;B={};B.content={};B.content.data=A.responseText;B.getHeaders=function(){return{"Content-Type":A.getResponseHeader("Content-Type")}};B.request={};B.request.url=this.invocationUrl;B.status=A.status;return B};y.prototype.getSelectedValue=function(A){var D,C,F,B,E;if(!A.multiple){return A.value}else{C=[];E=A.options;for(F=0,B=E.length;F<B;F++){D=E[F];if(D.selected){C.push(D.value)}}if(C.length>0){return C.join(",")}else{return null}}};y.prototype.hideResponse=function(A){if(A!=null){A.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};y.prototype.showResponse=function(A){var B;B=JSON.stringify(A,null,"\t").replace(/\n/g,"<br>");return $(".response_body",$(this.el)).html(escape(B))};y.prototype.showErrorStatus=function(B,A){return A.showStatus(B)};y.prototype.showCompleteStatus=function(B,A){return A.showStatus(B)};y.prototype.formatXml=function(H){var D,G,B,I,N,J,C,A,L,M,F,E,K;A=/(>)(<)(\/*)/g;M=/[ ]*(.*)[ ]+\n/g;D=/(<.+>)(.+\n)/g;H=H.replace(A,"$1\n$2$3").replace(M,"$1\n").replace(D,"$1\n$2");C=0;G="";N=H.split("\n");B=0;I="other";L={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0};F=function(T){var P,O,R,V,S,Q,U;Q={single:Boolean(T.match(/<.+\/>/)),closing:Boolean(T.match(/<\/.+>/)),opening:Boolean(T.match(/<[^!?].*>/))};S=((function(){var W;W=[];for(R in Q){U=Q[R];if(U){W.push(R)}}return W})())[0];S=S===void 0?"other":S;P=I+"->"+S;I=S;V="";B+=L[P];V=((function(){var X,Y,W;W=[];for(O=X=0,Y=B;0<=Y?X<Y:X>Y;O=0<=Y?++X:--X){W.push(" ")}return W})()).join("");if(P==="opening->closing"){return G=G.substr(0,G.length-1)+T+"\n"}else{return G+=V+T+"\n"}};for(E=0,K=N.length;E<K;E++){J=N[E];F(J)}return G};y.prototype.showStatus=function(D){var C,B,G,F,E,A;B=D.content.data;F=D.getHeaders();G=F["Content-Type"];if(B===void 0){C=$("<code />").text("no content");E=$('<pre class="json" />').append(C)}else{if(G.indexOf("application/json")===0||G.indexOf("application/hal+json")===0){C=$("<code />").text(JSON.stringify(JSON.parse(B),null,2));E=$('<pre class="json" />').append(C)}else{if(G.indexOf("application/xml")===0){C=$("<code />").text(this.formatXml(B));E=$('<pre class="xml" />').append(C)}else{if(G.indexOf("text/html")===0){C=$("<code />").html(B);E=$('<pre class="xml" />').append(C)}else{if(G.indexOf("image/")===0){E=$("<img>").attr("src",D.request.url)}else{C=$("<code />").text(B);E=$('<pre class="json" />').append(C)}}}}}A=E;$(".request_url",$(this.el)).html("<pre>"+D.request.url+"</pre>");$(".response_code",$(this.el)).html("<pre>"+D.status+"</pre>");$(".response_body",$(this.el)).html(A);$(".response_headers",$(this.el)).html("<pre>"+JSON.stringify(D.getHeaders(),null," ").replace(/\n/g,"<br>")+"</pre>");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();return hljs.highlightBlock($(".response_body",$(this.el))[0])};y.prototype.toggleOperationContent=function(){var A;A=$("#"+Docs.escapeResourceName(this.model.resourceName)+"_"+this.model.nickname+"_"+this.model.method+"_"+this.model.number+"_content");if(A.is(":visible")){return Docs.collapseOperation(A)}else{return Docs.expandOperation(A)}};return y})(Backbone.View);p=(function(z){v(y,z);function y(){d=y.__super__.constructor.apply(this,arguments);return d}y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));return this};y.prototype.template=function(){return Handlebars.templates.status_code};return y})(Backbone.View);k=(function(z){v(y,z);function y(){b=y.__super__.constructor.apply(this,arguments);return b}y.prototype.initialize=function(){};y.prototype.render=function(){var G,A,C,F,B,H,E,D;D=this.model.type||this.model.dataType;if(this.model.paramType==="body"){this.model.isBody=true}if(D.toLowerCase()==="file"){this.model.isFile=true}E=this.template();$(this.el).html(E(this.model));B={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){H=new i({model:B,tagName:"div"});$(".model-signature",$(this.el)).append(H.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}A=false;if(this.model.isBody){A=true}G={isParam:A};G.consumes=this.model.consumes;if(A){C=new l({model:G});$(".parameter-content-type",$(this.el)).append(C.render().el)}else{F=new m({model:G});$(".response-content-type",$(this.el)).append(F.render().el)}return this};y.prototype.template=function(){if(this.model.isList){return Handlebars.templates.param_list}else{if(this.options.readOnly){if(this.model.required){return Handlebars.templates.param_readonly_required}else{return Handlebars.templates.param_readonly}}else{if(this.model.required){return Handlebars.templates.param_required}else{return Handlebars.templates.param}}}};return y})(Backbone.View);i=(function(z){v(y,z);function y(){a=y.__super__.constructor.apply(this,arguments);return a}y.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));this.switchToDescription();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};y.prototype.template=function(){return Handlebars.templates.signature};y.prototype.switchToDescription=function(A){if(A!=null){A.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};y.prototype.switchToSnippet=function(A){if(A!=null){A.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};y.prototype.snippetToTextArea=function(A){var B;if(this.isParam){if(A!=null){A.preventDefault()}B=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(B.val())===""){return B.val(this.model.sampleJSON)}}};return y})(Backbone.View);j=(function(y){v(z,y);function z(){x=z.__super__.constructor.apply(this,arguments);return x}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=contentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.content_type};return z})(Backbone.View);m=(function(y){v(z,y);function z(){w=z.__super__.constructor.apply(this,arguments);return w}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=responseContentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.response_content_type};return z})(Backbone.View);l=(function(z){v(y,z);function y(){c=y.__super__.constructor.apply(this,arguments);return c}y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:");return this};y.prototype.template=function(){return Handlebars.templates.parameter_content_type};return y})(Backbone.View)}).call(this);
1
+ $(function(){$.fn.vAlign=function(){return this.each(function(c){var a=$(this).height();var d=$(this).parent().height();var b=(d-a)/2;$(this).css("margin-top",b)})};$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(b){var d=$(this).closest("form").innerWidth();var c=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10);var a=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",d-c-a)})};$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent();$("ul.downplayed li div.content p").vAlign();$("form.sandbox").submit(function(){var a=true;$(this).find("input.required").each(function(){$(this).removeClass("error");if($(this).val()==""){$(this).addClass("error");$(this).wiggle();a=false}});return a})});function clippyCopiedCallback(b){$("#api_key_copied").fadeIn().delay(1000).fadeOut()}function log(){if(window.console){console.log.apply(console,arguments)}}if(Function.prototype.bind&&console&&typeof console.log=="object"){["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(a){console[a]=this.bind(console[a],console)},Function.prototype.call)}var Docs={shebang:function(){var b=$.param.fragment().split("/");b.shift();switch(b.length){case 1:var d="resource_"+b[0];Docs.expandEndpointListForResource(b[0]);$("#"+d).slideto({highlight:false});break;case 2:Docs.expandEndpointListForResource(b[0]);$("#"+d).slideto({highlight:false});var c=b.join("_");var a=c+"_content";Docs.expandOperation($("#"+a));$("#"+c).slideto({highlight:false});break}},toggleEndpointListForResource:function(b){var a=$("li#resource_"+Docs.escapeResourceName(b)+" ul.endpoints");if(a.is(":visible")){Docs.collapseEndpointListForResource(b)}else{Docs.expandEndpointListForResource(b)}},expandEndpointListForResource:function(b){var b=Docs.escapeResourceName(b);if(b==""){$(".resource ul.endpoints").slideDown();return}$("li#resource_"+b).addClass("active");var a=$("li#resource_"+b+" ul.endpoints");a.slideDown()},collapseEndpointListForResource:function(b){var b=Docs.escapeResourceName(b);$("li#resource_"+b).removeClass("active");var a=$("li#resource_"+b+" ul.endpoints");a.slideUp()},expandOperationsForResource:function(a){Docs.expandEndpointListForResource(a);if(a==""){$(".resource ul.endpoints li.operation div.content").slideDown();return}$("li#resource_"+Docs.escapeResourceName(a)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(a){Docs.expandEndpointListForResource(a);$("li#resource_"+Docs.escapeResourceName(a)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(a){return a.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(a){a.slideDown()},collapseOperation:function(a){a.slideUp()}};(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="contentType"></label>\n<select name="contentType">\n';c=f["if"].call(l,l.produces,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n</select>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.main=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",c,h="function",j=this.escapeExpression,p=this;function e(v,u){var r="",t,s;r+='\n <div class="info_title">'+j(((t=((t=v.info),t==null||t===false?t:t.title)),typeof t===h?t.apply(v):t))+'</div>\n <div class="info_description">';s=((t=((t=v.info),t==null||t===false?t:t.description)),typeof t===h?t.apply(v):t);if(s||s===0){r+=s}r+="</div>\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.termsOfServiceUrl),{hash:{},inverse:p.noop,fn:p.program(2,d,u),data:u});if(s||s===0){r+=s}r+="\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.contact),{hash:{},inverse:p.noop,fn:p.program(4,q,u),data:u});if(s||s===0){r+=s}r+="\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.license),{hash:{},inverse:p.noop,fn:p.program(6,o,u),data:u});if(s||s===0){r+=s}r+="\n ";return r}function d(u,t){var r="",s;r+='<div class="info_tos"><a href="'+j(((s=((s=u.info),s==null||s===false?s:s.termsOfServiceUrl)),typeof s===h?s.apply(u):s))+'">Terms of service</a></div>';return r}function q(u,t){var r="",s;r+="<div class='info_contact'><a href=\"mailto:"+j(((s=((s=u.info),s==null||s===false?s:s.contact)),typeof s===h?s.apply(u):s))+'">Contact the developer</a></div>';return r}function o(u,t){var r="",s;r+="<div class='info_license'><a href='"+j(((s=((s=u.info),s==null||s===false?s:s.licenseUrl)),typeof s===h?s.apply(u):s))+"'>"+j(((s=((s=u.info),s==null||s===false?s:s.license)),typeof s===h?s.apply(u):s))+"</a></div>";return r}function n(u,t){var r="",s;r+='\n , <span style="font-variant: small-caps">api version</span>: ';if(s=f.apiVersion){s=s.call(u,{hash:{},data:t})}else{s=u.apiVersion;s=typeof s===h?s.apply(u):s}r+=j(s)+"\n ";return r}i+="<div class='info' id='api_info'>\n ";c=f["if"].call(m,m.info,{hash:{},inverse:p.noop,fn:p.program(1,e,k),data:k});if(c||c===0){i+=c}i+="\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>: ";if(c=f.basePath){c=c.call(m,{hash:{},data:k})}else{c=m.basePath;c=typeof c===h?c.apply(m):c}i+=j(c)+"\n ";c=f["if"].call(m,m.apiVersion,{hash:{},inverse:p.noop,fn:p.program(8,n,k),data:k});if(c||c===0){i+=c}i+="]</h4>\n </div>\n</div>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.operation=b(function(h,n,g,m,l){this.compilerInfo=[4,">= 1.0.0"];g=this.merge(g,h.helpers);l=l||{};var j="",d,i="function",k=this.escapeExpression,r=this;function f(v,u){var s="",t;s+="\n <h4>Implementation Notes</h4>\n <p>";if(t=g.notes){t=t.call(v,{hash:{},data:u})}else{t=v.notes;t=typeof t===i?t.apply(v):t}if(t||t===0){s+=t}s+="</p>\n ";return s}function c(t,s){return'\n <h4>Response Class</h4>\n <p><span class="model-signature" /></p>\n <br/>\n <div class="response-content-type" />\n '}function q(t,s){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 '}function p(t,s){return"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "}function o(t,s){return"\n "}function e(t,s){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 <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n "}j+="\n <ul class='operations' >\n <li class='";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+" operation' id='";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+"'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"</a>\n </span>\n <span class='path'>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.path){d=d.call(n,{hash:{},data:l})}else{d=n.path;d=typeof d===i?d.apply(n):d}j+=k(d)+"</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.summary){d=d.call(n,{hash:{},data:l})}else{d=n.summary;d=typeof d===i?d.apply(n):d}if(d||d===0){j+=d}j+="</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+"_content' style='display:none'>\n ";d=g["if"].call(n,n.notes,{hash:{},inverse:r.noop,fn:r.program(1,f,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.type,{hash:{},inverse:r.noop,fn:r.program(3,c,l),data:l});if(d||d===0){j+=d}j+="\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";d=g["if"].call(n,n.parameters,{hash:{},inverse:r.noop,fn:r.program(5,q,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.responseMessages,{hash:{},inverse:r.noop,fn:r.program(7,p,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.isReadOnly,{hash:{},inverse:r.program(11,e,l),fn:r.program(9,o,l),data:l});if(d||d===0){j+=d}j+="\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";return j})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param=b(function(f,q,o,j,s){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);s=s||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.isFile,{hash:{},inverse:n.program(4,k,w),fn:n.program(2,l,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function l(x,w){var u="",v;u+='\n <input type="file" name=\'';if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+'\'/>\n <div class="parameter-content-type" />\n ';return u}function k(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(7,h,w),fn:n.program(5,i,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function i(x,w){var u="",v;u+="\n <textarea class='body-textarea' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"'>";if(v=o.defaultValue){v=v.call(x,{hash:{},data:w})}else{v=x.defaultValue;v=typeof v===d?v.apply(x):v}u+=c(v)+"</textarea>\n ";return u}function h(x,w){var u="",v;u+="\n <textarea class='body-textarea' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n ';return u}function e(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(12,r,w),fn:n.program(10,t,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function t(x,w){var u="",v;u+="\n <input class='parameter' minlength='0' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"' placeholder='' type='text' value='";if(v=o.defaultValue){v=v.call(x,{hash:{},data:w})}else{v=x.defaultValue;v=typeof v===d?v.apply(x):v}u+=c(v)+"'/>\n ";return u}function r(x,w){var u="",v;u+="\n <input class='parameter' minlength='0' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"' placeholder='' type='text' value=''/>\n ";return u}p+="<td class='code'>";if(g=o.name){g=g.call(q,{hash:{},data:s})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+"</td>\n<td>\n\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,s),fn:n.program(1,m,s),data:s});if(g||g===0){p+=g}p+="\n\n</td>\n<td>";if(g=o.description){g=g.call(q,{hash:{},data:s})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+="</td>\n<td>";if(g=o.paramType){g=g.call(q,{hash:{},data:s})}else{g=q.paramType;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+='</td>\n<td>\n <span class="model-signature"></span>\n</td>\n';return p})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_list=b(function(g,r,p,l,w){this.compilerInfo=[4,">= 1.0.0"];p=this.merge(p,g.helpers);w=w||{};var q="",i,e,o=this,d="function",c=this.escapeExpression;function n(y,x){return" multiple='multiple'"}function m(y,x){return"\n "}function k(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.defaultValue,{hash:{},inverse:o.program(8,h,z),fn:o.program(6,j,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function j(y,x){return"\n "}function h(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.allowMultiple,{hash:{},inverse:o.program(11,v,z),fn:o.program(9,f,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function f(y,x){return"\n "}function v(y,x){return"\n <option selected=\"\" value=''></option>\n "}function u(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.isDefault,{hash:{},inverse:o.program(16,s,z),fn:o.program(14,t,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function t(A,z){var x="",y;x+='\n <option selected="" value=\'';if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"'>";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+" (default)</option>\n ";return x}function s(A,z){var x="",y;x+="\n <option value='";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"'>";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"</option>\n ";return x}q+="<td class='code'>";if(i=p.name){i=i.call(r,{hash:{},data:w})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+"</td>\n<td>\n <select ";i=p["if"].call(r,r.allowMultiple,{hash:{},inverse:o.noop,fn:o.program(1,n,w),data:w});if(i||i===0){q+=i}q+=" class='parameter' name='";if(i=p.name){i=i.call(r,{hash:{},data:w})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+"'>\n ";i=p["if"].call(r,r.required,{hash:{},inverse:o.program(5,k,w),fn:o.program(3,m,w),data:w});if(i||i===0){q+=i}q+="\n ";e=p.each.call(r,((i=r.allowableValues),i==null||i===false?i:i.descriptiveValues),{hash:{},inverse:o.noop,fn:o.program(13,u,w),data:w});if(e||e===0){q+=e}q+="\n </select>\n</td>\n<td>";if(e=p.description){e=e.call(r,{hash:{},data:w})}else{e=r.description;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+="</td>\n<td>";if(e=p.paramType){e=e.call(r,{hash:{},data:w})}else{e=r.paramType;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+='</td>\n<td><span class="model-signature"></span></td>';return q})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,h="function",j=this.escapeExpression,o=this;function e(t,s){var q="",r;q+="\n <textarea class='body-textarea' readonly='readonly' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{hash:{},inverse:o.program(6,n,s),fn:o.program(4,p,s),data:s});if(r||r===0){q+=r}q+="\n ";return q}function p(t,s){var q="",r;q+="\n ";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code'>";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+"</td>\n<td>\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:o.program(3,c,k),fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n</td>\n<td>";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+="</td>\n<td>";if(d=f.paramType){d=d.call(m,{hash:{},data:k})}else{d=m.paramType;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+='</td>\n<td><span class="model-signature"></span></td>\n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly_required=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,h="function",j=this.escapeExpression,o=this;function e(t,s){var q="",r;q+="\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{hash:{},inverse:o.program(6,n,s),fn:o.program(4,p,s),data:s});if(r||r===0){q+=r}q+="\n ";return q}function p(t,s){var q="",r;q+="\n ";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code required'>";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+"</td>\n<td>\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:o.program(3,c,k),fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n</td>\n<td>";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+="</td>\n<td>";if(d=f.paramType){d=d.call(m,{hash:{},data:k})}else{d=m.paramType;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+='</td>\n<td><span class="model-signature"></span></td>\n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_required=b(function(f,q,o,j,u){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);u=u||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.isFile,{hash:{},inverse:n.program(4,k,y),fn:n.program(2,l,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function l(z,y){var w="",x;w+='\n <input type="file" name=\'';if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function k(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{hash:{},inverse:n.program(7,h,y),fn:n.program(5,i,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function i(z,y){var w="",x;w+="\n <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'>";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"</textarea>\n ";return w}function h(z,y){var w="",x;w+="\n <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n ';return w}function e(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.isFile,{hash:{},inverse:n.program(12,t,y),fn:n.program(10,v,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function v(z,y){var w="",x;w+="\n <input class='parameter' class='required' type='file' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function t(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{hash:{},inverse:n.program(15,r,y),fn:n.program(13,s,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function s(z,y){var w="",x;w+="\n <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value='";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function r(z,y){var w="",x;w+="\n <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value=''/>\n ";return w}p+="<td class='code required'>";if(g=o.name){g=g.call(q,{hash:{},data:u})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+"</td>\n<td>\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,u),fn:n.program(1,m,u),data:u});if(g||g===0){p+=g}p+="\n</td>\n<td>\n <strong>";if(g=o.description){g=g.call(q,{hash:{},data:u})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+="</strong>\n</td>\n<td>";if(g=o.paramType){g=g.call(q,{hash:{},data:u})}else{g=q.paramType;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+='</td>\n<td><span class="model-signature"></span></td>\n';return p})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.parameter_content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.consumes,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="parameterContentType"></label>\n<select name="parameterContentType">\n';c=f["if"].call(l,l.consumes,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n</select>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.resource=b(function(f,l,e,k,j){this.compilerInfo=[4,">= 1.0.0"];e=this.merge(e,f.helpers);j=j||{};var h="",c,o,g="function",i=this.escapeExpression,n=this,m=e.blockHelperMissing;function d(q,p){return" : "}h+="<div class='heading'>\n <h2>\n <a href='#!/";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"' onclick=\"Docs.toggleEndpointListForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"');\">";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"</a> ";o={hash:{},inverse:n.noop,fn:n.program(1,d,j),data:j};if(c=e.description){c=c.call(l,o)}else{c=l.description;c=typeof c===g?c.apply(l):c}if(!e.description){c=m.call(l,c,o)}if(c||c===0){h+=c}if(c=e.description){c=c.call(l,{hash:{},data:j})}else{c=l.description;c=typeof c===g?c.apply(l):c}if(c||c===0){h+=c}h+="\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"' id='endpointListTogger_";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'\n onclick=\"Docs.toggleEndpointListForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";if(c=e.url){c=c.call(l,{hash:{},data:j})}else{c=l.url;c=typeof c===g?c.apply(l):c}h+=i(c)+"'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"_endpoint_list' style='display:none'>\n\n</ul>\n";return h})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.response_content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="responseContentType"></label>\n<select name="responseContentType">\n';c=f["if"].call(l,l.produces,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n</select>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.signature=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+='<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 ';if(c=d.signature){c=c.call(k,{hash:{},data:i})}else{c=k.signature;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+='\n </div>\n\n <div class="snippet">\n <pre><code>';if(c=d.sampleJSON){c=c.call(k,{hash:{},data:i})}else{c=k.sampleJSON;c=typeof c===f?c.apply(k):c}g+=h(c)+'</code></pre>\n <small class="notice"></small>\n </div>\n</div>\n\n';return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.status_code=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="<td width='15%' class='code'>";if(c=d.code){c=c.call(k,{hash:{},data:i})}else{c=k.code;c=typeof c===f?c.apply(k):c}g+=h(c)+"</td>\n<td>";if(c=d.message){c=c.call(k,{hash:{},data:i})}else{c=k.message;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+="</td>\n";return g})})();(function(){var j,r,u,o,l,k,n,m,i,p,s,q,h,c,g,f,e,d,b,a,x,w,t={}.hasOwnProperty,v=function(B,z){for(var y in z){if(t.call(z,y)){B[y]=z[y]}}function A(){this.constructor=B}A.prototype=z.prototype;B.prototype=new A();B.__super__=z.prototype;return B};s=(function(z){v(y,z);function y(){q=y.__super__.constructor.apply(this,arguments);return q}y.prototype.dom_id="swagger_ui";y.prototype.options=null;y.prototype.api=null;y.prototype.headerView=null;y.prototype.mainView=null;y.prototype.initialize=function(A){var B=this;if(A==null){A={}}if(A.dom_id!=null){this.dom_id=A.dom_id;delete A.dom_id}if($("#"+this.dom_id)==null){$("body").append('<div id="'+this.dom_id+'"></div>')}this.options=A;this.options.success=function(){return B.render()};this.options.progress=function(C){return B.showMessage(C)};this.options.failure=function(C){return B.onLoadFailure(C)};this.headerView=new r({el:$("#header")});return this.headerView.on("update-swagger-ui",function(C){return B.updateSwaggerUi(C)})};y.prototype.updateSwaggerUi=function(A){this.options.url=A.url;return this.load()};y.prototype.load=function(){var B,A;if((A=this.mainView)!=null){A.clear()}B=this.options.url;if(B.indexOf("http")!==0){B=this.buildUrl(window.location.href.toString(),B)}this.options.url=B;this.headerView.update(B);this.api=new SwaggerApi(this.options);this.api.build();return this.api};y.prototype.render=function(){var A=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new u({model:this.api,el:$("#"+this.dom_id)}).render();this.showMessage();switch(this.options.docExpansion){case"full":Docs.expandOperationsForResource("");break;case"list":Docs.collapseOperationsForResource("")}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};y.prototype.buildUrl=function(C,A){var B,D;log("base is "+C);if(A.indexOf("/")===0){D=C.split("/");C=D[0]+"//"+D[2];return C+A}else{B=C.length;if(C.indexOf("?")>-1){B=Math.min(B,C.indexOf("?"))}if(C.indexOf("#")>-1){B=Math.min(B,C.indexOf("#"))}C=C.substring(0,B);if(C.indexOf("/",C.length-1)!==-1){return C+A}return C+"/"+A}};y.prototype.showMessage=function(A){if(A==null){A=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(A)};y.prototype.onLoadFailure=function(A){var B;if(A==null){A=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");B=$("#message-bar").html(A);if(this.options.onFailure!=null){this.options.onFailure(A)}return B};return y})(Backbone.Router);window.SwaggerUi=s;r=(function(z){v(y,z);function y(){h=y.__super__.constructor.apply(this,arguments);return h}y.prototype.events={"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"};y.prototype.initialize=function(){};y.prototype.showPetStore=function(A){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})};y.prototype.showWordnikDev=function(A){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})};y.prototype.showCustomOnKeyup=function(A){if(A.keyCode===13){return this.showCustom()}};y.prototype.showCustom=function(A){if(A!=null){A.preventDefault()}return this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};y.prototype.update=function(B,C,A){if(A==null){A=false}$("#input_baseUrl").val(B);if(A){return this.trigger("update-swagger-ui",{url:B})}};return y})(Backbone.View);u=(function(y){v(z,y);function z(){g=z.__super__.constructor.apply(this,arguments);return g}z.prototype.initialize=function(){};z.prototype.render=function(){var C,B,A,D;$(this.el).html(Handlebars.templates.main(this.model));D=this.model.apisArray;for(B=0,A=D.length;B<A;B++){C=D[B];this.addResource(C)}return this};z.prototype.addResource=function(B){var A;A=new n({model:B,tagName:"li",id:"resource_"+B.name,className:"resource"});return $("#resources").append(A.render().el)};z.prototype.clear=function(){return $(this.el).html("")};return z})(Backbone.View);n=(function(z){v(y,z);function y(){f=y.__super__.constructor.apply(this,arguments);return f}y.prototype.initialize=function(){};y.prototype.render=function(){var B,C,A,D;$(this.el).html(Handlebars.templates.resource(this.model));this.number=0;D=this.model.operationsArray;for(C=0,A=D.length;C<A;C++){B=D[C];this.addOperation(B)}return this};y.prototype.addOperation=function(A){var B;A.number=this.number;B=new o({model:A,tagName:"li",className:"endpoint"});$(".endpoints",$(this.el)).append(B.render().el);return this.number++};return y})(Backbone.View);o=(function(z){v(y,z);function y(){e=y.__super__.constructor.apply(this,arguments);return e}y.prototype.invocationUrl=null;y.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent"};y.prototype.initialize=function(){};y.prototype.render=function(){var A,P,G,M,K,Q,L,N,J,I,H,O,E,C,F,D,B;P=true;if(!P){this.model.isReadOnly=true}$(this.el).html(Handlebars.templates.operation(this.model));if(this.model.responseClassSignature&&this.model.responseClassSignature!=="string"){Q={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};K=new i({model:Q,tagName:"div"});$(".model-signature",$(this.el)).append(K.render().el)}else{$(".model-signature",$(this.el)).html(this.model.type)}A={isParam:false};A.consumes=this.model.consumes;A.produces=this.model.produces;F=this.model.parameters;for(J=0,O=F.length;J<O;J++){G=F[J];N=G.type||G.dataType;if(N.toLowerCase()==="file"){if(!A.consumes){log("set content type ");A.consumes="multipart/form-data"}}}M=new m({model:A});$(".response-content-type",$(this.el)).append(M.render().el);D=this.model.parameters;for(I=0,E=D.length;I<E;I++){G=D[I];this.addParameter(G,A.consumes)}B=this.model.responseMessages;for(H=0,C=B.length;H<C;H++){L=B[H];this.addStatusCode(L)}return this};y.prototype.addParameter=function(C,A){var B;C.consumes=A;B=new k({model:C,tagName:"tr",readOnly:this.model.isReadOnly});return $(".operation-params",$(this.el)).append(B.render().el)};y.prototype.addStatusCode=function(B){var A;A=new p({model:B,tagName:"tr"});return $(".operation-status",$(this.el)).append(A.render().el)};y.prototype.submitOperation=function(O){var Q,G,N,D,I,A,J,M,L,K,P,F,C,H,E,B;if(O!=null){O.preventDefault()}G=$(".sandbox",$(this.el));Q=true;G.find("input.required").each(function(){var R=this;$(this).removeClass("error");if(jQuery.trim($(this).val())===""){$(this).addClass("error");$(this).wiggle({callback:function(){return $(R).focus()}});return Q=false}});if(Q){D={};A={parent:this};N=false;H=G.find("input");for(M=0,P=H.length;M<P;M++){I=H[M];if((I.value!=null)&&jQuery.trim(I.value).length>0){D[I.name]=I.value}if(I.type==="file"){N=true}}E=G.find("textarea");for(L=0,F=E.length;L<F;L++){I=E[L];if((I.value!=null)&&jQuery.trim(I.value).length>0){D.body=I.value}}B=G.find("select");for(K=0,C=B.length;K<C;K++){I=B[K];J=this.getSelectedValue(I);if((J!=null)&&jQuery.trim(J).length>0){D[I.name]=J}}A.responseContentType=$("div select[name=responseContentType]",$(this.el)).val();A.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val();$(".response_throbber",$(this.el)).show();if(N){return this.handleFileUpload(D,G)}else{return this.model["do"](D,A,this.showCompleteStatus,this.showErrorStatus,this)}}};y.prototype.success=function(A,B){return B.showCompleteStatus(A)};y.prototype.handleFileUpload=function(Q,I){var M,H,C,N,L,K,J,G,E,D,P,T,S,R,F,B,A,U,O=this;log("it's a file upload");F=I.serializeArray();for(J=0,P=F.length;J<P;J++){N=F[J];if((N.value!=null)&&jQuery.trim(N.value).length>0){Q[N.name]=N.value}}M=new FormData();B=this.model.parameters;for(G=0,T=B.length;G<T;G++){K=B[G];if(K.paramType==="form"){M.append(K.name,Q[K.name])}}C={};A=this.model.parameters;for(E=0,S=A.length;E<S;E++){K=A[E];if(K.paramType==="header"){C[K.name]=Q[K.name]}}log(C);U=I.find('input[type~="file"]');for(D=0,R=U.length;D<R;D++){H=U[D];M.append($(H).attr("name"),H.files[0])}log(M);this.invocationUrl=this.model.supportHeaderParams()?(C=this.model.getHeaderParams(Q),this.model.urlify(Q,false)):this.model.urlify(Q,true);$(".request_url",$(this.el)).html("<pre>"+this.invocationUrl+"</pre>");L={type:this.model.method,url:this.invocationUrl,headers:C,data:M,dataType:"json",contentType:false,processData:false,error:function(W,X,V){return O.showErrorStatus(O.wrap(W),O)},success:function(V){return O.showResponse(V,O)},complete:function(V){return O.showCompleteStatus(O.wrap(V),O)}};if(window.authorizations){window.authorizations.apply(L)}jQuery.ajax(L);return false};y.prototype.wrap=function(A){var B,C=this;B={};B.content={};B.content.data=A.responseText;B.getHeaders=function(){return{"Content-Type":A.headers("Content-Type")}};B.request={};B.request.url=this.invocationUrl;B.status=A.status;return B};y.prototype.getSelectedValue=function(A){var D,C,F,B,E;if(!A.multiple){return A.value}else{C=[];E=A.options;for(F=0,B=E.length;F<B;F++){D=E[F];if(D.selected){C.push(D.value)}}if(C.length>0){return C.join(",")}else{return null}}};y.prototype.hideResponse=function(A){if(A!=null){A.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};y.prototype.showResponse=function(A){var B;B=JSON.stringify(A,null,"\t").replace(/\n/g,"<br>");return $(".response_body",$(this.el)).html(escape(B))};y.prototype.showErrorStatus=function(B,A){return A.showStatus(B)};y.prototype.showCompleteStatus=function(B,A){return A.showStatus(B)};y.prototype.formatXml=function(H){var D,G,B,I,N,J,C,A,L,M,F,E,K;A=/(>)(<)(\/*)/g;M=/[ ]*(.*)[ ]+\n/g;D=/(<.+>)(.+\n)/g;H=H.replace(A,"$1\n$2$3").replace(M,"$1\n").replace(D,"$1\n$2");C=0;G="";N=H.split("\n");B=0;I="other";L={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0};F=function(T){var P,O,R,V,S,Q,U;Q={single:Boolean(T.match(/<.+\/>/)),closing:Boolean(T.match(/<\/.+>/)),opening:Boolean(T.match(/<[^!?].*>/))};S=((function(){var W;W=[];for(R in Q){U=Q[R];if(U){W.push(R)}}return W})())[0];S=S===void 0?"other":S;P=I+"->"+S;I=S;V="";B+=L[P];V=((function(){var X,Y,W;W=[];for(O=X=0,Y=B;0<=Y?X<Y:X>Y;O=0<=Y?++X:--X){W.push(" ")}return W})()).join("");if(P==="opening->closing"){return G=G.substr(0,G.length-1)+T+"\n"}else{return G+=V+T+"\n"}};for(E=0,K=N.length;E<K;E++){J=N[E];F(J)}return G};y.prototype.showStatus=function(A){var D,C,G,F,E,B;C=A.data;F=A.headers;G=F["Content-Type"]?F["Content-Type"].split(";")[0].trim():null;if(!C){D=$("<code />").text("no content");E=$('<pre class="json" />').append(D)}else{if(G==="application/json"||/\+json$/.test(G)){D=$("<code />").text(JSON.stringify(JSON.parse(C),null," "));E=$('<pre class="json" />').append(D)}else{if(G==="application/xml"||/\+xml$/.test(G)){D=$("<code />").text(this.formatXml(C));E=$('<pre class="xml" />').append(D)}else{if(G==="text/html"){D=$("<code />").html(C);E=$('<pre class="xml" />').append(D)}else{if(/^image\//.test(G)){E=$("<img>").attr("src",A.url)}else{D=$("<code />").text(C);E=$('<pre class="json" />').append(D)}}}}}B=E;$(".request_url",$(this.el)).html("<pre>"+A.url+"</pre>");$(".response_code",$(this.el)).html("<pre>"+A.status+"</pre>");$(".response_body",$(this.el)).html(B);$(".response_headers",$(this.el)).html("<pre>"+JSON.stringify(A.headers,null," ").replace(/\n/g,"<br>")+"</pre>");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();return hljs.highlightBlock($(".response_body",$(this.el))[0])};y.prototype.toggleOperationContent=function(){var A;A=$("#"+Docs.escapeResourceName(this.model.resourceName)+"_"+this.model.nickname+"_"+this.model.method+"_"+this.model.number+"_content");if(A.is(":visible")){return Docs.collapseOperation(A)}else{return Docs.expandOperation(A)}};return y})(Backbone.View);p=(function(z){v(y,z);function y(){d=y.__super__.constructor.apply(this,arguments);return d}y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));return this};y.prototype.template=function(){return Handlebars.templates.status_code};return y})(Backbone.View);k=(function(z){v(y,z);function y(){b=y.__super__.constructor.apply(this,arguments);return b}y.prototype.initialize=function(){};y.prototype.render=function(){var G,A,C,F,B,H,E,D;D=this.model.type||this.model.dataType;if(this.model.paramType==="body"){this.model.isBody=true}if(D.toLowerCase()==="file"){this.model.isFile=true}E=this.template();$(this.el).html(E(this.model));B={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){H=new i({model:B,tagName:"div"});$(".model-signature",$(this.el)).append(H.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}A=false;if(this.model.isBody){A=true}G={isParam:A};G.consumes=this.model.consumes;if(A){C=new l({model:G});$(".parameter-content-type",$(this.el)).append(C.render().el)}else{F=new m({model:G});$(".response-content-type",$(this.el)).append(F.render().el)}return this};y.prototype.template=function(){if(this.model.isList){return Handlebars.templates.param_list}else{if(this.options.readOnly){if(this.model.required){return Handlebars.templates.param_readonly_required}else{return Handlebars.templates.param_readonly}}else{if(this.model.required){return Handlebars.templates.param_required}else{return Handlebars.templates.param}}}};return y})(Backbone.View);i=(function(z){v(y,z);function y(){a=y.__super__.constructor.apply(this,arguments);return a}y.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));this.switchToDescription();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};y.prototype.template=function(){return Handlebars.templates.signature};y.prototype.switchToDescription=function(A){if(A!=null){A.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};y.prototype.switchToSnippet=function(A){if(A!=null){A.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};y.prototype.snippetToTextArea=function(A){var B;if(this.isParam){if(A!=null){A.preventDefault()}B=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(B.val())===""){return B.val(this.model.sampleJSON)}}};return y})(Backbone.View);j=(function(y){v(z,y);function z(){x=z.__super__.constructor.apply(this,arguments);return x}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=contentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.content_type};return z})(Backbone.View);m=(function(y){v(z,y);function z(){w=z.__super__.constructor.apply(this,arguments);return w}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=responseContentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.response_content_type};return z})(Backbone.View);l=(function(z){v(y,z);function y(){c=y.__super__.constructor.apply(this,arguments);return c}y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:");return this};y.prototype.template=function(){return Handlebars.templates.parameter_content_type};return y})(Backbone.View)}).call(this);
@@ -1,7 +1,14 @@
1
1
  // Generated by CoffeeScript 1.6.3
2
2
  (function() {
3
- var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource,
4
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
3
+ var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource, log,
4
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
5
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
6
+
7
+ log = function() {
8
+ if (window.console) {
9
+ return console.log.apply(console, arguments);
10
+ }
11
+ };
5
12
 
6
13
  SwaggerApi = (function() {
7
14
  SwaggerApi.prototype.url = "http://api.wordnik.com/v4/resources.json";
@@ -16,6 +23,8 @@
16
23
 
17
24
  SwaggerApi.prototype.info = null;
18
25
 
26
+ SwaggerApi.prototype.useJQuery = null;
27
+
19
28
  function SwaggerApi(url, options) {
20
29
  if (options == null) {
21
30
  options = {};
@@ -47,9 +56,12 @@
47
56
  _this = this;
48
57
  this.progress('fetching resource list: ' + this.url);
49
58
  obj = {
59
+ useJQuery: this.useJQuery,
50
60
  url: this.url,
51
61
  method: "get",
52
- headers: {},
62
+ headers: {
63
+ accept: "application/json"
64
+ },
53
65
  on: {
54
66
  error: function(response) {
55
67
  if (_this.url.substring(0, 4) !== 'http') {
@@ -62,14 +74,14 @@
62
74
  return _this.fail(response.status + ' : ' + response.statusText + ' ' + _this.url);
63
75
  }
64
76
  },
65
- response: function(rawResponse) {
66
- var response;
67
- response = JSON.parse(rawResponse.content.data);
68
- _this.swaggerVersion = response.swaggerVersion;
77
+ response: function(response) {
78
+ var responseObj;
79
+ responseObj = JSON.parse(response.data);
80
+ _this.swaggerVersion = responseObj.swaggerVersion;
69
81
  if (_this.swaggerVersion === "1.2") {
70
- return _this.buildFromSpec(response);
82
+ return _this.buildFromSpec(responseObj);
71
83
  } else {
72
- return _this.buildFrom1_1Spec(response);
84
+ return _this.buildFrom1_1Spec(responseObj);
73
85
  }
74
86
  }
75
87
  }
@@ -139,7 +151,7 @@
139
151
 
140
152
  SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
141
153
  var api, isApi, newName, operation, res, resource, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
142
- console.log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info");
154
+ log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info");
143
155
  if (response.apiVersion != null) {
144
156
  this.apiVersion = response.apiVersion;
145
157
  }
@@ -241,15 +253,15 @@
241
253
  _ref = this.apis;
242
254
  for (resource_name in _ref) {
243
255
  resource = _ref[resource_name];
244
- console.log(resource_name);
256
+ log(resource_name);
245
257
  _ref1 = resource.operations;
246
258
  for (operation_name in _ref1) {
247
259
  operation = _ref1[operation_name];
248
- console.log(" " + operation.nickname);
260
+ log(" " + operation.nickname);
249
261
  _ref2 = operation.parameters;
250
262
  for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
251
263
  parameter = _ref2[_i];
252
- console.log(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description);
264
+ log(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description);
253
265
  }
254
266
  }
255
267
  }
@@ -283,6 +295,7 @@
283
295
  this.operationsArray = [];
284
296
  this.modelsArray = [];
285
297
  this.models = {};
298
+ this.rawModels = {};
286
299
  if ((resourceObj.apis != null) && (this.api.resourcePath != null)) {
287
300
  this.addApiDeclaration(resourceObj);
288
301
  } else {
@@ -298,15 +311,18 @@
298
311
  obj = {
299
312
  url: this.url,
300
313
  method: "get",
301
- headers: {},
314
+ useJQuery: this.useJQuery,
315
+ headers: {
316
+ accept: "application/json"
317
+ },
302
318
  on: {
303
319
  error: function(response) {
304
320
  return _this.api.fail("Unable to read api '" + _this.name + "' from path " + _this.url + " (server returned " + response.statusText + ")");
305
321
  },
306
- response: function(rawResponse) {
307
- var response;
308
- response = JSON.parse(rawResponse.content.data);
309
- return _this.addApiDeclaration(response);
322
+ response: function(response) {
323
+ var responseObj;
324
+ responseObj = JSON.parse(response.data);
325
+ return _this.addApiDeclaration(responseObj);
310
326
  }
311
327
  }
312
328
  };
@@ -321,6 +337,25 @@
321
337
  }
322
338
  }
323
339
 
340
+ SwaggerResource.prototype.getAbsoluteBasePath = function(relativeBasePath) {
341
+ var parts, pos, url;
342
+ url = this.api.basePath;
343
+ pos = url.lastIndexOf(relativeBasePath);
344
+ if (pos === -1) {
345
+ parts = url.split("/");
346
+ url = parts[0] + "//" + parts[2];
347
+ if (relativeBasePath.indexOf("/") === 0) {
348
+ return url + relativeBasePath;
349
+ } else {
350
+ return url + "/" + relativeBasePath;
351
+ }
352
+ } else if (relativeBasePath === "/") {
353
+ return url.substring(0, pos);
354
+ } else {
355
+ return url.substring(0, pos) + relativeBasePath;
356
+ }
357
+ };
358
+
324
359
  SwaggerResource.prototype.addApiDeclaration = function(response) {
325
360
  var endpoint, _i, _len, _ref;
326
361
  if (response.produces != null) {
@@ -330,7 +365,7 @@
330
365
  this.consumes = response.consumes;
331
366
  }
332
367
  if ((response.basePath != null) && response.basePath.replace(/\s/g, '').length > 0) {
333
- this.basePath = response.basePath;
368
+ this.basePath = response.basePath.indexOf("http") === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath;
334
369
  }
335
370
  this.addModels(response.models);
336
371
  if (response.apis) {
@@ -353,6 +388,7 @@
353
388
  swaggerModel = new SwaggerModel(modelName, models[modelName]);
354
389
  this.modelsArray.push(swaggerModel);
355
390
  this.models[modelName] = swaggerModel;
391
+ this.rawModels[modelName] = models[modelName];
356
392
  }
357
393
  }
358
394
  _ref = this.modelsArray;
@@ -408,7 +444,7 @@
408
444
  }
409
445
  }
410
446
  o.nickname = this.sanitize(o.nickname);
411
- op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces);
447
+ op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations);
412
448
  this.operations[op.nickname] = op;
413
449
  _results.push(this.operationsArray.push(op));
414
450
  }
@@ -503,7 +539,7 @@
503
539
  _ref1 = this.properties;
504
540
  for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
505
541
  prop = _ref1[_j];
506
- if ((prop.refModel != null) && (modelsToIgnore.indexOf(prop.refModel)) === -1) {
542
+ if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel) === -1) {
507
543
  returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
508
544
  }
509
545
  }
@@ -562,13 +598,13 @@
562
598
 
563
599
  SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
564
600
  var result;
565
- if ((this.refModel != null) && (modelsToIgnore.indexOf(this.refModel.name) === -1)) {
601
+ if ((this.refModel != null) && (modelsToIgnore[this.refModel.name] === 'undefined')) {
566
602
  result = this.refModel.createJSONSample(modelsToIgnore);
567
603
  } else {
568
604
  if (this.isCollection) {
569
- result = this.refDataType;
605
+ result = this.toSampleValue(this.refDataType);
570
606
  } else {
571
- result = this.dataType;
607
+ result = this.toSampleValue(this.dataType);
572
608
  }
573
609
  }
574
610
  if (this.isCollection) {
@@ -578,6 +614,22 @@
578
614
  }
579
615
  };
580
616
 
617
+ SwaggerModelProperty.prototype.toSampleValue = function(value) {
618
+ var result;
619
+ if (value === "integer") {
620
+ result = 0;
621
+ } else if (value === "boolean") {
622
+ result = false;
623
+ } else if (value === "double") {
624
+ result = 0.0;
625
+ } else if (value === "string") {
626
+ result = "";
627
+ } else {
628
+ result = value;
629
+ }
630
+ return result;
631
+ };
632
+
581
633
  SwaggerModelProperty.prototype.toString = function() {
582
634
  var req, str;
583
635
  req = this.required ? 'propReq' : 'propOpt';
@@ -600,7 +652,7 @@
600
652
  })();
601
653
 
602
654
  SwaggerOperation = (function() {
603
- function SwaggerOperation(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces) {
655
+ function SwaggerOperation(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
604
656
  var parameter, v, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3,
605
657
  _this = this;
606
658
  this.nickname = nickname;
@@ -614,6 +666,7 @@
614
666
  this.resource = resource;
615
667
  this.consumes = consumes;
616
668
  this.produces = produces;
669
+ this.authorizations = authorizations;
617
670
  this["do"] = __bind(this["do"], this);
618
671
  if (this.nickname == null) {
619
672
  this.resource.api.fail("SwaggerOperations must have a nickname.");
@@ -656,12 +709,12 @@
656
709
  v = _ref2[_j];
657
710
  if ((parameter.defaultValue != null) && parameter.defaultValue === v) {
658
711
  parameter.allowableValues.descriptiveValues.push({
659
- value: v,
712
+ value: String(v),
660
713
  isDefault: true
661
714
  });
662
715
  } else {
663
716
  parameter.allowableValues.descriptiveValues.push({
664
- value: v,
717
+ value: String(v),
665
718
  isDefault: false
666
719
  });
667
720
  }
@@ -756,19 +809,19 @@
756
809
  }
757
810
  if (error == null) {
758
811
  error = function(xhr, textStatus, error) {
759
- return console.log(xhr, textStatus, error);
812
+ return log(xhr, textStatus, error);
760
813
  };
761
814
  }
762
815
  if (callback == null) {
763
- callback = function(data) {
816
+ callback = function(response) {
764
817
  var content;
765
818
  content = null;
766
- if (data.content != null) {
767
- content = data.content.data;
819
+ if (response != null) {
820
+ content = response.data;
768
821
  } else {
769
822
  content = "no data";
770
823
  }
771
- return console.log("default callback: " + content);
824
+ return log("default callback: " + content);
772
825
  };
773
826
  }
774
827
  params = {};
@@ -915,7 +968,7 @@
915
968
 
916
969
  SwaggerRequest = (function() {
917
970
  function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) {
918
- var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
971
+ var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, status, urlEncoded, value, values,
919
972
  _this = this;
920
973
  this.type = type;
921
974
  this.url = url;
@@ -970,7 +1023,7 @@
970
1023
  _results = [];
971
1024
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
972
1025
  param = _ref[_i];
973
- if (type.toLowerCase() === "file") {
1026
+ if (typeof type !== 'undefined' && type.toLowerCase() === "file") {
974
1027
  _results.push(param);
975
1028
  }
976
1029
  }
@@ -985,8 +1038,8 @@
985
1038
  }
986
1039
  }
987
1040
  if (requestContentType && this.operation.consumes) {
988
- if (this.operation.consumes.indexOf(requestContentType) === -1) {
989
- console.log("server doesn't consume " + requestContentType + ", try " + JSON.stringify(this.operation.consumes));
1041
+ if (this.operation.consumes[requestContentType] === 'undefined') {
1042
+ log("server doesn't consume " + requestContentType + ", try " + JSON.stringify(this.operation.consumes));
990
1043
  if (this.requestContentType === null) {
991
1044
  requestContentType = this.operation.consumes[0];
992
1045
  }
@@ -1003,8 +1056,8 @@
1003
1056
  responseContentType = null;
1004
1057
  }
1005
1058
  if (responseContentType && this.operation.produces) {
1006
- if (this.operation.produces.indexOf(responseContentType) === -1) {
1007
- console.log("server can't produce " + responseContentType);
1059
+ if (this.operation.produces[responseContentType] === 'undefined') {
1060
+ log("server can't produce " + responseContentType);
1008
1061
  }
1009
1062
  }
1010
1063
  if (requestContentType && requestContentType.indexOf("application/x-www-form-urlencoded") === 0) {
@@ -1053,6 +1106,7 @@
1053
1106
  method: this.type,
1054
1107
  headers: myHeaders,
1055
1108
  body: body,
1109
+ useJQuery: this.useJQuery,
1056
1110
  on: {
1057
1111
  error: function(response) {
1058
1112
  return _this.errorCallback(response, _this.opts.parent);
@@ -1074,11 +1128,14 @@
1074
1128
  } else {
1075
1129
  e = exports;
1076
1130
  }
1077
- e.authorizations.apply(obj);
1131
+ status = e.authorizations.apply(obj, this.operation.authorizations);
1078
1132
  if (opts.mock == null) {
1079
- new SwaggerHttp().execute(obj);
1133
+ if (status !== false) {
1134
+ new SwaggerHttp().execute(obj);
1135
+ } else {
1136
+ obj.canceled = true;
1137
+ }
1080
1138
  } else {
1081
- console.log(obj);
1082
1139
  return obj;
1083
1140
  }
1084
1141
  }
@@ -1104,13 +1161,15 @@
1104
1161
  })();
1105
1162
 
1106
1163
  SwaggerHttp = (function() {
1164
+ function SwaggerHttp() {}
1165
+
1107
1166
  SwaggerHttp.prototype.Shred = null;
1108
1167
 
1109
1168
  SwaggerHttp.prototype.shred = null;
1110
1169
 
1111
1170
  SwaggerHttp.prototype.content = null;
1112
1171
 
1113
- function SwaggerHttp() {
1172
+ SwaggerHttp.prototype.initShred = function() {
1114
1173
  var identity, toString,
1115
1174
  _this = this;
1116
1175
  if (typeof window !== 'undefined') {
@@ -1127,22 +1186,174 @@
1127
1186
  };
1128
1187
  if (typeof window !== 'undefined') {
1129
1188
  this.content = require("./shred/content");
1130
- this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
1189
+ return this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
1131
1190
  parser: identity,
1132
1191
  stringify: toString
1133
1192
  });
1134
1193
  } else {
1135
- this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
1194
+ return this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
1136
1195
  parser: identity,
1137
1196
  stringify: toString
1138
1197
  });
1139
1198
  }
1140
- }
1199
+ };
1141
1200
 
1142
1201
  SwaggerHttp.prototype.execute = function(obj) {
1202
+ if (this.isIE() || obj.useJQuery) {
1203
+ return this.executeWithJQuery(obj);
1204
+ } else {
1205
+ return this.executeWithShred(obj);
1206
+ }
1207
+ };
1208
+
1209
+ SwaggerHttp.prototype.executeWithShred = function(obj) {
1210
+ var cb, res,
1211
+ _this = this;
1212
+ if (!this.Shred) {
1213
+ this.initShred();
1214
+ }
1215
+ cb = obj.on;
1216
+ res = {
1217
+ error: function(raw) {
1218
+ var headers, out;
1219
+ if (obj) {
1220
+ headers = raw._headers;
1221
+ out = {
1222
+ headers: headers,
1223
+ url: raw.request.url,
1224
+ method: raw.request.method,
1225
+ status: raw.status,
1226
+ data: raw.content.data
1227
+ };
1228
+ return cb.error(out);
1229
+ }
1230
+ },
1231
+ redirect: function(raw) {
1232
+ var headers, out;
1233
+ if (obj) {
1234
+ headers = raw._headers;
1235
+ out = {
1236
+ headers: headers,
1237
+ url: raw.request.url,
1238
+ method: raw.request.method,
1239
+ status: raw.status,
1240
+ data: raw.content.data
1241
+ };
1242
+ return cb.redirect(out);
1243
+ }
1244
+ },
1245
+ 307: function(raw) {
1246
+ var headers, out;
1247
+ if (obj) {
1248
+ headers = raw._headers;
1249
+ out = {
1250
+ headers: headers,
1251
+ url: raw.request.url,
1252
+ method: raw.request.method,
1253
+ status: raw.status,
1254
+ data: raw.content.data
1255
+ };
1256
+ return cb.redirect(out);
1257
+ }
1258
+ },
1259
+ response: function(raw) {
1260
+ var headers, out;
1261
+ if (obj) {
1262
+ headers = raw._headers;
1263
+ out = {
1264
+ headers: headers,
1265
+ url: raw.request.url,
1266
+ method: raw.request.method,
1267
+ status: raw.status,
1268
+ data: raw.content.data
1269
+ };
1270
+ return cb.response(out);
1271
+ }
1272
+ }
1273
+ };
1274
+ if (obj) {
1275
+ obj.on = res;
1276
+ }
1143
1277
  return this.shred.request(obj);
1144
1278
  };
1145
1279
 
1280
+ SwaggerHttp.prototype.executeWithJQuery = function(obj) {
1281
+ var beforeSend, cb, request,
1282
+ _this = this;
1283
+ cb = obj.on;
1284
+ request = obj;
1285
+ obj.type = obj.method;
1286
+ obj.cache = false;
1287
+ beforeSend = function(xhr) {
1288
+ var key, _results;
1289
+ if (obj.headers) {
1290
+ _results = [];
1291
+ for (key in obj.headers) {
1292
+ if (key.toLowerCase() === "content-type") {
1293
+ _results.push(obj.contentType = obj.headers[key]);
1294
+ } else if (key.toLowerCase() === "accept") {
1295
+ _results.push(obj.accepts = obj.headers[key]);
1296
+ } else {
1297
+ _results.push(xhr.setRequestHeader(key, obj.headers[key]));
1298
+ }
1299
+ }
1300
+ return _results;
1301
+ }
1302
+ };
1303
+ obj.beforeSend = beforeSend;
1304
+ obj.data = obj.body;
1305
+ obj.complete = function(response, textStatus, opts) {
1306
+ var headerArray, headers, i, out, _i, _j, _k, _ref, _ref1, _ref2, _ref3, _results, _results1;
1307
+ headers = {};
1308
+ headerArray = response.getAllResponseHeaders().split(":");
1309
+ for (i = _i = 0, _ref = headerArray.length / 2, _ref1 = 2.; _ref1 > 0 ? _i <= _ref : _i >= _ref; i = _i += _ref1) {
1310
+ headers[headerArray[i]] = headerArray[i + 1];
1311
+ }
1312
+ out = {
1313
+ headers: headers,
1314
+ url: request.url,
1315
+ method: request.method,
1316
+ status: response.status,
1317
+ data: response.responseText,
1318
+ headers: headers
1319
+ };
1320
+ if (_ref2 = response.status, __indexOf.call((function() {
1321
+ _results = [];
1322
+ for (_j = 200; _j <= 299; _j++){ _results.push(_j); }
1323
+ return _results;
1324
+ }).apply(this), _ref2) >= 0) {
1325
+ cb.response(out);
1326
+ }
1327
+ if ((_ref3 = response.status, __indexOf.call((function() {
1328
+ _results1 = [];
1329
+ for (_k = 400; _k <= 599; _k++){ _results1.push(_k); }
1330
+ return _results1;
1331
+ }).apply(this), _ref3) >= 0) || response.status === 0) {
1332
+ cb.error(out);
1333
+ }
1334
+ return cb.response(out);
1335
+ };
1336
+ $.support.cors = true;
1337
+ return $.ajax(obj);
1338
+ };
1339
+
1340
+ SwaggerHttp.prototype.isIE = function() {
1341
+ var isIE, nav, version;
1342
+ ({
1343
+ isIE: false
1344
+ });
1345
+ if (typeof navigator !== 'undefined' && navigator.userAgent) {
1346
+ nav = navigator.userAgent.toLowerCase();
1347
+ if (nav.indexOf('msie') !== -1) {
1348
+ version = parseInt(nav.split('msie')[1]);
1349
+ if (version <= 8) {
1350
+ isIE = true;
1351
+ }
1352
+ }
1353
+ }
1354
+ return isIE;
1355
+ };
1356
+
1146
1357
  return SwaggerHttp;
1147
1358
 
1148
1359
  })();
@@ -1159,15 +1370,25 @@
1159
1370
  return auth;
1160
1371
  };
1161
1372
 
1162
- SwaggerAuthorizations.prototype.apply = function(obj) {
1163
- var key, value, _ref, _results;
1373
+ SwaggerAuthorizations.prototype.remove = function(name) {
1374
+ return delete this.authz[name];
1375
+ };
1376
+
1377
+ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
1378
+ var key, result, status, value, _ref;
1379
+ status = null;
1164
1380
  _ref = this.authz;
1165
- _results = [];
1166
1381
  for (key in _ref) {
1167
1382
  value = _ref[key];
1168
- _results.push(value.apply(obj));
1383
+ result = value.apply(obj, authorizations);
1384
+ if (result === false) {
1385
+ status = false;
1386
+ }
1387
+ if (result === true) {
1388
+ status = true;
1389
+ }
1169
1390
  }
1170
- return _results;
1391
+ return status;
1171
1392
  };
1172
1393
 
1173
1394
  return SwaggerAuthorizations;
@@ -1187,7 +1408,7 @@
1187
1408
  this.type = type;
1188
1409
  }
1189
1410
 
1190
- ApiKeyAuthorization.prototype.apply = function(obj) {
1411
+ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
1191
1412
  if (this.type === "query") {
1192
1413
  if (obj.url.indexOf('?') > 0) {
1193
1414
  obj.url = obj.url + "&" + this.name + "=" + this.value;
@@ -1196,7 +1417,8 @@
1196
1417
  }
1197
1418
  return true;
1198
1419
  } else if (this.type === "header") {
1199
- return obj.headers[this.name] = this.value;
1420
+ obj.headers[this.name] = this.value;
1421
+ return true;
1200
1422
  }
1201
1423
  };
1202
1424
 
@@ -1205,6 +1427,8 @@
1205
1427
  })();
1206
1428
 
1207
1429
  PasswordAuthorization = (function() {
1430
+ PasswordAuthorization._btoa = null;
1431
+
1208
1432
  PasswordAuthorization.prototype.name = null;
1209
1433
 
1210
1434
  PasswordAuthorization.prototype.username = null;
@@ -1215,10 +1439,20 @@
1215
1439
  this.name = name;
1216
1440
  this.username = username;
1217
1441
  this.password = password;
1442
+ PasswordAuthorization._ensureBtoa();
1218
1443
  }
1219
1444
 
1220
- PasswordAuthorization.prototype.apply = function(obj) {
1221
- return obj.headers["Authorization"] = "Basic " + btoa(this.username + ":" + this.password);
1445
+ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
1446
+ obj.headers["Authorization"] = "Basic " + PasswordAuthorization._btoa(this.username + ":" + this.password);
1447
+ return true;
1448
+ };
1449
+
1450
+ PasswordAuthorization._ensureBtoa = function() {
1451
+ if (typeof window !== 'undefined') {
1452
+ return this._btoa = btoa;
1453
+ } else {
1454
+ return this._btoa = require("btoa");
1455
+ }
1222
1456
  };
1223
1457
 
1224
1458
  return PasswordAuthorization;
@@ -1239,6 +1473,8 @@
1239
1473
 
1240
1474
  this.PasswordAuthorization = PasswordAuthorization;
1241
1475
 
1476
+ this.SwaggerHttp = SwaggerHttp;
1477
+
1242
1478
  this.authorizations = new SwaggerAuthorizations();
1243
1479
 
1244
1480
  }).call(this);