diff --git a/build/index.html b/build/index.html index 770d5b06..6c673534 100644 --- a/build/index.html +++ b/build/index.html @@ -159,7 +159,7 @@
Sexy API documentation from diff --git a/build/javascripts/app.js b/build/javascripts/app.js index 768e8b6e..1428ba70 100644 --- a/build/javascripts/app.js +++ b/build/javascripts/app.js @@ -2529,12 +2529,8 @@ arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return th // adeed by ayush createAll: function(values){ - // debugger; values = this.fromJSON(values); - - // debugger; - - for (var i=0, il = values.length; i < il; i++) { + for (var i=0, il = values.length; i < il; i++) { var record = values[i]; record.newRecord = false; record.id = record.id || Spine.guid(); diff --git a/build/javascripts/spine.js b/build/javascripts/spine.js index 5f2f0e8e..49ee4d14 100644 --- a/build/javascripts/spine.js +++ b/build/javascripts/spine.js @@ -233,12 +233,8 @@ // adeed by ayush createAll: function(values){ - // debugger; values = this.fromJSON(values); - - // debugger; - - for (var i=0, il = values.length; i < il; i++) { + for (var i=0, il = values.length; i < il; i++) { var record = values[i]; record.newRecord = false; record.id = record.id || Spine.guid(); diff --git a/build/javascripts/swagger-service.js b/build/javascripts/swagger-service.js index 6b3cd3a7..f99eba24 100644 --- a/build/javascripts/swagger-service.js +++ b/build/javascripts/swagger-service.js @@ -11,17 +11,9 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { baseUrl = ("http://" + baseUrl); } - // baseUrl = baseUrl + "/resources.json"; - - // log("using base url " + baseUrl); var apiHost = baseUrl.substr(0, baseUrl.lastIndexOf("/")); - // debugger - // var rootResourcesApiName = baseUrl.substr(baseUrl.lastIndexOf("/") + 1, (baseUrl.lastIndexOf(".") - baseUrl.lastIndexOf("/") - 1)); - - // assuming root swagger is resources - var rootResourcesApiName = "resources"; - if (baseUrl.indexOf(".json") > -1) rootResourcesApiName += ".json"; - + var discoParts = baseUrl.split("/"); + var rootResourcesApiName = discoParts[discoParts.length-1]; var formatString = ".{format}"; var statusListener = statusCallback; var apiKey = _apiKey; @@ -79,7 +71,7 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { }, addApis: function(apiObjects) { - log("apiObjects: %o", apiObjects); + // log("apiObjects: %o", apiObjects); this.apiList.createAll(apiObjects); }, @@ -402,10 +394,9 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { var controller = this; updateStatus("Fetching " + apiResource.name + "..."); var resourceUrl = apiHost + apiResource.path_json + apiKeySuffix; - log("resourceUrl: %o", resourceUrl); + // log("resourceUrl: %o", resourceUrl); $.getJSON(resourceUrl, function(response) { - log(response); controller.loadResources(response, apiResource); }); }, @@ -432,7 +423,7 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { updateStatus(); } finally { if (this.countLoaded == ApiResource.count()) { - log("all models/api loaded"); + // log("all models/api loaded"); ApiResource.trigger("refresh"); } } diff --git a/build/javascripts/swagger-ui.js b/build/javascripts/swagger-ui.js index c8f6acff..0f4e557f 100644 --- a/build/javascripts/swagger-ui.js +++ b/build/javascripts/swagger-ui.js @@ -1,8 +1,6 @@ jQuery(function($) { - // this.baseUrl = "http://swagr.api.wordnik.com/v4"; - - // this.baseUrl = "http://petstore.swagger.wordnik.com/api"; + // this.baseUrl = "http://petstore.swagger.wordnik.com/api/resources.json"; // this.apiKey = "special-key"; var ApiSelectionController = Spine.Controller.create({ @@ -37,15 +35,17 @@ jQuery(function($) { handleEnter: function(){ var self = this; - var submit = function() { self.showApi() } + var submit = function() { + self.showApi(); + }; $('#input_baseUrl').keydown(function(e) { if(e.which != 13) return; submit(); - }) + }); $('#input_apiKey').keydown(function(e) { if(e.which != 13) return; submit(); - }) + }); }, adaptToScale: function() { @@ -145,7 +145,6 @@ jQuery(function($) { // Create convenience references to Spine models this.ApiResource = swaggerService.ApiResource(); - debugger; this.ApiResource.bind("refresh", this.addAll); }, diff --git a/source/javascripts/spine.js b/source/javascripts/spine.js index 1d25bffe..6714507a 100644 --- a/source/javascripts/spine.js +++ b/source/javascripts/spine.js @@ -233,12 +233,8 @@ // adeed by ayush createAll: function(values){ - // debugger; values = this.fromJSON(values); - - // debugger; - - for (var i=0, il = values.length; i < il; i++) { + for (var i=0, il = values.length; i < il; i++) { var record = values[i]; record.newRecord = false; record.id = record.id || Spine.guid(); diff --git a/source/javascripts/swagger-service.js b/source/javascripts/swagger-service.js index 6b3cd3a7..f99eba24 100644 --- a/source/javascripts/swagger-service.js +++ b/source/javascripts/swagger-service.js @@ -11,17 +11,9 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { baseUrl = ("http://" + baseUrl); } - // baseUrl = baseUrl + "/resources.json"; - - // log("using base url " + baseUrl); var apiHost = baseUrl.substr(0, baseUrl.lastIndexOf("/")); - // debugger - // var rootResourcesApiName = baseUrl.substr(baseUrl.lastIndexOf("/") + 1, (baseUrl.lastIndexOf(".") - baseUrl.lastIndexOf("/") - 1)); - - // assuming root swagger is resources - var rootResourcesApiName = "resources"; - if (baseUrl.indexOf(".json") > -1) rootResourcesApiName += ".json"; - + var discoParts = baseUrl.split("/"); + var rootResourcesApiName = discoParts[discoParts.length-1]; var formatString = ".{format}"; var statusListener = statusCallback; var apiKey = _apiKey; @@ -79,7 +71,7 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { }, addApis: function(apiObjects) { - log("apiObjects: %o", apiObjects); + // log("apiObjects: %o", apiObjects); this.apiList.createAll(apiObjects); }, @@ -402,10 +394,9 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { var controller = this; updateStatus("Fetching " + apiResource.name + "..."); var resourceUrl = apiHost + apiResource.path_json + apiKeySuffix; - log("resourceUrl: %o", resourceUrl); + // log("resourceUrl: %o", resourceUrl); $.getJSON(resourceUrl, function(response) { - log(response); controller.loadResources(response, apiResource); }); }, @@ -432,7 +423,7 @@ function SwaggerService(baseUrl, _apiKey, statusCallback) { updateStatus(); } finally { if (this.countLoaded == ApiResource.count()) { - log("all models/api loaded"); + // log("all models/api loaded"); ApiResource.trigger("refresh"); } } diff --git a/source/javascripts/swagger-ui.js b/source/javascripts/swagger-ui.js index c8f6acff..0f4e557f 100644 --- a/source/javascripts/swagger-ui.js +++ b/source/javascripts/swagger-ui.js @@ -1,8 +1,6 @@ jQuery(function($) { - // this.baseUrl = "http://swagr.api.wordnik.com/v4"; - - // this.baseUrl = "http://petstore.swagger.wordnik.com/api"; + // this.baseUrl = "http://petstore.swagger.wordnik.com/api/resources.json"; // this.apiKey = "special-key"; var ApiSelectionController = Spine.Controller.create({ @@ -37,15 +35,17 @@ jQuery(function($) { handleEnter: function(){ var self = this; - var submit = function() { self.showApi() } + var submit = function() { + self.showApi(); + }; $('#input_baseUrl').keydown(function(e) { if(e.which != 13) return; submit(); - }) + }); $('#input_apiKey').keydown(function(e) { if(e.which != 13) return; submit(); - }) + }); }, adaptToScale: function() { @@ -145,7 +145,6 @@ jQuery(function($) { // Create convenience references to Spine models this.ApiResource = swaggerService.ApiResource(); - debugger; this.ApiResource.bind("refresh", this.addAll); }, diff --git a/source/layout.haml b/source/layout.haml index 501f5b62..4d571a81 100644 --- a/source/layout.haml +++ b/source/layout.haml @@ -29,7 +29,7 @@ #content_message Enter the base URL of the API that you wish to explore, or try - = link_to("petstore.swagger.wordnik.com/api", "#", :onclick => "$('#input_baseUrl').val('http://petstore.swagger.wordnik.com/api'); apiSelectionController.showApi(); return false;") + = link_to("petstore.swagger.wordnik.com/api/resources.json", "#", :onclick => "$('#input_baseUrl').val('http://petstore.swagger.wordnik.com/api/resources.json'); apiSelectionController.showApi(); return false;") %p#colophon{:style => 'display:none'} Sexy API documentation from