swagger-ui_rails 0.1.3 → 0.1.4

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: c709525db72d72f5f8cb394daed1300a63a3d454
4
- data.tar.gz: 368c1395f69ca16538d22a7f98dcc6af388109fd
3
+ metadata.gz: d950c3d781a21ff560e820970cf5e47b39f0dc77
4
+ data.tar.gz: b91a5c51df35ca1450dc283e151897c1b9d001da
5
5
  SHA512:
6
- metadata.gz: 8ac3db5823cc5be78ff1966d7f974c4a5924ea7081870209d01b11726a9cace978a01086349390a6860555c7a83b86e75c8277ec031d6ed36fd50bb0832a2438
7
- data.tar.gz: 98dee61f3da5d891698107d6139717fa69eedeae11849a8dbc5df9465f55973cbc7f0256a63ba3bd2985d7808a15e46d86700c7c9a27ab45148c4bfed7226823
6
+ metadata.gz: 203a67f2b1416fccab48a26e5d07cd41e7094e839d4c71dc618c09a8c4cfc5277c85aea9ea2a3c25270b5a6a0898a58fdf23e87a853b553e829bc48ea35fef4a
7
+ data.tar.gz: 045403f8c10c5ff43e2906c498b0f5e4b30d05eaccccf9113b1f45fbc5131c575106721e81515ad7fbe5bd9d1678c7ded7659289bdb9d288331fc4651efcff6a
@@ -1,9 +1,15 @@
1
1
  // Generated by CoffeeScript 1.6.3
2
2
  (function() {
3
- var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource,
3
+ var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource, log,
4
4
  __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
5
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
6
 
7
+ log = function() {
8
+ if (window.console) {
9
+ return console.log.apply(console, arguments);
10
+ }
11
+ };
12
+
7
13
  SwaggerApi = (function() {
8
14
  SwaggerApi.prototype.url = "http://api.wordnik.com/v4/resources.json";
9
15
 
@@ -53,7 +59,9 @@
53
59
  useJQuery: this.useJQuery,
54
60
  url: this.url,
55
61
  method: "get",
56
- headers: {},
62
+ headers: {
63
+ accept: "application/json"
64
+ },
57
65
  on: {
58
66
  error: function(response) {
59
67
  if (_this.url.substring(0, 4) !== 'http') {
@@ -304,7 +312,9 @@
304
312
  url: this.url,
305
313
  method: "get",
306
314
  useJQuery: this.useJQuery,
307
- headers: {},
315
+ headers: {
316
+ accept: "application/json"
317
+ },
308
318
  on: {
309
319
  error: function(response) {
310
320
  return _this.api.fail("Unable to read api '" + _this.name + "' from path " + _this.url + " (server returned " + response.statusText + ")");
@@ -529,7 +539,7 @@
529
539
  _ref1 = this.properties;
530
540
  for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
531
541
  prop = _ref1[_j];
532
- if ((prop.refModel != null) && (modelsToIgnore[prop.refModel] !== 'undefined') === -1) {
542
+ if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel) === -1) {
533
543
  returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
534
544
  }
535
545
  }
@@ -592,9 +602,9 @@
592
602
  result = this.refModel.createJSONSample(modelsToIgnore);
593
603
  } else {
594
604
  if (this.isCollection) {
595
- result = this.refDataType;
605
+ result = this.toSampleValue(this.refDataType);
596
606
  } else {
597
- result = this.dataType;
607
+ result = this.toSampleValue(this.dataType);
598
608
  }
599
609
  }
600
610
  if (this.isCollection) {
@@ -604,6 +614,22 @@
604
614
  }
605
615
  };
606
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
+
607
633
  SwaggerModelProperty.prototype.toString = function() {
608
634
  var req, str;
609
635
  req = this.required ? 'propReq' : 'propOpt';
@@ -997,7 +1023,7 @@
997
1023
  _results = [];
998
1024
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
999
1025
  param = _ref[_i];
1000
- if (type.toLowerCase() === "file") {
1026
+ if (typeof type !== 'undefined' && type.toLowerCase() === "file") {
1001
1027
  _results.push(param);
1002
1028
  }
1003
1029
  }
@@ -1451,4 +1477,4 @@
1451
1477
 
1452
1478
  this.authorizations = new SwaggerAuthorizations();
1453
1479
 
1454
- }).call(this);
1480
+ }).call(this);
@@ -1,18 +1,5 @@
1
- //= require lib/shred.bundle.js
2
- //= require lib/jquery-1.8.0.min.js
3
- //= require lib/jquery.slideto.min.js
4
- //= require lib/jquery.wiggle.min.js
5
- //= require lib/jquery.ba-bbq.min.js
6
- //= require lib/handlebars-1.0.0.js
7
- //= require lib/underscore-min.js
8
- //= require lib/backbone-min.js
9
- //= require lib/swagger.js
10
- //= require_self
11
- //= require lib/highlight.7.3.pack.js
12
-
13
1
  $(function() {
14
2
 
15
- // buja!
16
3
  // Helper function for vertically aligning DOM elements
17
4
  // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
18
5
  $.fn.vAlign = function() {
@@ -365,7 +352,7 @@ function program9(depth0,data) {
365
352
  function program11(depth0,data) {
366
353
 
367
354
 
368
- 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='<%=asset_path('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='<%= asset_path('throbber.gif' %>' style='display:none' />\n </div>\n ";
369
356
  }
370
357
 
371
358
  buffer += "\n <ul class='operations' >\n <li class='";
@@ -1294,13 +1281,24 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1294
1281
  };
1295
1282
 
1296
1283
  SwaggerUi.prototype.buildUrl = function(base, url) {
1297
- var parts;
1284
+ var endOfPath, parts;
1298
1285
  log("base is " + base);
1299
- parts = base.split("/");
1300
- base = parts[0] + "//" + parts[2];
1301
1286
  if (url.indexOf("/") === 0) {
1287
+ parts = base.split("/");
1288
+ base = parts[0] + "//" + parts[2];
1302
1289
  return base + url;
1303
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
+ }
1304
1302
  return base + "/" + url;
1305
1303
  }
1306
1304
  };
@@ -1,5 +1,5 @@
1
1
  module Swagger
2
2
  module UiRails
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger-ui_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-30 00:00:00.000000000 Z
11
+ date: 2014-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler