dpn_swagger_engine 2.0.3.rc → 2.0.4.rc

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,7 @@
1
- /* the order matches swagger-ui dist/index.html */
1
+ /*
2
+ The order matches swagger-ui dist/index.html;
3
+ Rails automatically handles .css and .css.erb files
4
+ */
2
5
 
3
6
  @import "typography";
4
7
  @import "reset";
@@ -880,7 +880,7 @@
880
880
  padding: 6px 8px;
881
881
  }
882
882
  .swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber {
883
- background-image: url('../images/throbber.gif');
883
+ background-image: url(<%= asset_data_uri 'dpn_swagger_engine/throbber.gif' %>);
884
884
  width: 128px;
885
885
  height: 16px;
886
886
  display: block;
@@ -1222,7 +1222,7 @@
1222
1222
  height: 18px;
1223
1223
  vertical-align: middle;
1224
1224
  display: inline-block;
1225
- background: url(../images/explorer_icons.png) no-repeat;
1225
+ background: url(<%= asset_data_uri 'dpn_swagger_engine/explorer_icons.png' %>) no-repeat;
1226
1226
  }
1227
1227
  .swagger-section .authorize__btn_operation_login {
1228
1228
  background-position: 0 0;
@@ -880,7 +880,7 @@
880
880
  padding: 6px 8px;
881
881
  }
882
882
  .swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber {
883
- background-image: url('../images/throbber.gif');
883
+ background-image: url(<%= asset_data_uri 'dpn_swagger_engine/throbber.gif' %>);
884
884
  width: 128px;
885
885
  height: 16px;
886
886
  display: block;
@@ -1222,7 +1222,7 @@
1222
1222
  height: 18px;
1223
1223
  vertical-align: middle;
1224
1224
  display: inline-block;
1225
- background: url(../images/explorer_icons.png) no-repeat;
1225
+ background: url(<%= asset_data_uri 'dpn_swagger_engine/explorer_icons.png' %>) no-repeat;
1226
1226
  }
1227
1227
  .swagger-section .authorize__btn_operation_login {
1228
1228
  background-position: 0 0;
@@ -1354,7 +1354,7 @@
1354
1354
  height: 18px;
1355
1355
  vertical-align: middle;
1356
1356
  display: inline-block;
1357
- background: url(../images/explorer_icons.png) no-repeat;
1357
+ background: url(<%= asset_data_uri 'dpn_swagger_engine/explorer_icons.png' %>) no-repeat;
1358
1358
  }
1359
1359
  .swagger-section .api-ic .api_information_panel {
1360
1360
  position: relative;
@@ -2,7 +2,7 @@
2
2
  font-size: 1.5em;
3
3
  font-weight: bold;
4
4
  text-decoration: none;
5
- background: transparent url(../images/logo.png) no-repeat left center;
5
+ background: transparent url(<%= asset_data_uri 'dpn_swagger_engine/logo.png' %>) no-repeat left center;
6
6
  padding: 20px 0 20px 40px;
7
7
  }
8
8
  #text-head {
@@ -64,7 +64,7 @@ h1 {
64
64
  width: 1500px;
65
65
  margin: auto;
66
66
  margin-top: 0;
67
- background-image: url('../images/shield.png');
67
+ background-image: url(<%= asset_data_uri 'dpn_swagger_engine/shield.png' %>);
68
68
  background-repeat: no-repeat;
69
69
  background-position: -40px -20px;
70
70
  margin-bottom: 210px;
@@ -0,0 +1,14 @@
1
+ /* Google Font's Droid Sans */
2
+ @font-face {
3
+ font-family: 'Droid Sans';
4
+ font-style: normal;
5
+ font-weight: 400;
6
+ src: local('Droid Sans'), local('DroidSans'), url(<%= asset_data_uri 'dpn_swagger_engine/DroidSans.ttf' %>), format('truetype');
7
+ }
8
+ /* Google Font's Droid Sans Bold */
9
+ @font-face {
10
+ font-family: 'Droid Sans';
11
+ font-style: normal;
12
+ font-weight: 700;
13
+ src: local('Droid Sans Bold'), local('DroidSans-Bold'), url(<%= asset_data_uri 'dpn_swagger_engine/DroidSans-Bold.ttf' %>), format('truetype');
14
+ }
@@ -6,14 +6,14 @@
6
6
 
7
7
  <!-- Content in this file is derived from swagger-ui:dist/index.html -->
8
8
 
9
- <%#= favicon_link_tag 'favicon-32x32.png', rel: 'icon', type: 'image/png', sizes: '32x32' %>
10
- <%#= favicon_link_tag 'favicon-16x16.png', rel: 'icon', type: 'image/png', sizes: '16x16' %>
9
+ <%= favicon_link_tag 'dpn_swagger_engine/favicon-32x32.png', rel: 'icon', type: 'image/png', sizes: '32x32' %>
10
+ <%= favicon_link_tag 'dpn_swagger_engine/favicon-16x16.png', rel: 'icon', type: 'image/png', sizes: '16x16' %>
11
11
 
12
- <%= stylesheet_link_tag "dpn_swagger_engine/application" %>
13
- <%= stylesheet_link_tag "dpn_swagger_engine/reset", media: "print" %>
14
- <%= stylesheet_link_tag "dpn_swagger_engine/print", media: "print" %>
12
+ <%= stylesheet_link_tag 'dpn_swagger_engine/application' %>
13
+ <%= stylesheet_link_tag 'dpn_swagger_engine/reset', media: 'print' %>
14
+ <%= stylesheet_link_tag 'dpn_swagger_engine/print', media: 'print' %>
15
15
 
16
- <%= javascript_include_tag "dpn_swagger_engine/application" %>
16
+ <%= javascript_include_tag 'dpn_swagger_engine/application' %>
17
17
 
18
18
  <%= csrf_meta_tags %>
19
19
 
@@ -38,7 +38,7 @@
38
38
  window.swaggerUi = new SwaggerUi({
39
39
  url: url,
40
40
  dom_id: "swagger-ui-container",
41
- supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
41
+ supportedSubmitMethods: ["get", "post", "put", "delete", "patch"],
42
42
  onComplete: function(swaggerApi, swaggerUi){
43
43
  if(typeof initOAuth == "function") {
44
44
  initOAuth({
@@ -61,7 +61,7 @@
61
61
  log("Unable to Load SwaggerUI");
62
62
  },
63
63
  docExpansion: "none",
64
- jsonEditor: true,
64
+ jsonEditor: false,
65
65
  // apisSorter: "alpha",
66
66
  defaultModelRendering: 'schema',
67
67
  showRequestHeaders: false
@@ -71,10 +71,8 @@
71
71
  function headerTokenAuthorization(){
72
72
  var token = encodeURIComponent($('#input_apiKey')[0].value);
73
73
  if(token && token.trim() != "") {
74
- var tokenAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", "Token token=" + token, "header"));
75
- window.swaggerUi.api.clientAuthorizations.add("api_key", tokenAuth);
76
- // var tokenAuth = new ApiKeyAuthorization("Authorization", "Token token=" + token, "header"));
77
- // window.authorizations.add("api_key", tokenAuth);
74
+ var tokenAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", "Token token=" + token, "header");
75
+ window.swaggerUi.api.clientAuthorizations.add("dpn_token", tokenAuth);
78
76
  log("added token " + token);
79
77
  }
80
78
  }
@@ -100,16 +98,13 @@
100
98
  <div id='header'>
101
99
  <div class="swagger-ui-wrap">
102
100
  <a id="logo" href="http://swagger.io">
103
- <img class="logo__img" alt="swagger" height="30" width="30" src="images/logo_small.png" />
101
+ <%= image_tag 'dpn_swagger_engine/logo_small.png', class: 'logo__img', height: '30', width: '30', alt: 'swagger' %>
104
102
  <span class="logo__title">swagger</span>
105
103
  </a>
106
104
  <form id='api_selector'>
107
- <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
108
- <!--
109
- <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
110
- <div class='input'><a id="explore" href="#" data-sw-translate>Explore</a></div>
111
- -->
112
- <div id='auth_container'></div>
105
+ <div class='input'><input placeholder="https://raw.githubusercontent.com/dpn-admin/dpn-rest-spec/api-v2/dist/swagger.yaml" id="input_baseUrl" name="baseUrl" type="text"/></div>
106
+ <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
107
+ <!-- <div id='auth_container'></div> -->
113
108
  <div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
114
109
  </form>
115
110
  </div>
@@ -2,20 +2,32 @@ module DpnSwaggerEngine
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace DpnSwaggerEngine
4
4
 
5
- #https://gist.github.com/parndt/11381872
6
- =begin
7
- initializer "dpn_swagger_engine.assets.precompile", group: :all do |app|
5
+ initializer :assets do |app|
6
+ # Rails.application.config.assets.precompile += [
8
7
  app.config.assets.precompile += [
9
8
  'dpn_swagger_engine/print.css',
10
- 'dpn_swagger_engine/reset.css'
11
- ]
12
- end
13
- =end
14
- config.to_prepare do
15
- Rails.application.config.assets.precompile += [
16
- 'dpn_swagger_engine/print.css',
17
- 'dpn_swagger_engine/reset.css'
9
+ 'dpn_swagger_engine/reset.css',
10
+ # fonts
11
+ 'dpn_swagger_engine/DroidSans.ttf',
12
+ 'dpn_swagger_engine/DroidSans-Bold.ttf',
13
+ # images
14
+ 'dpn_swagger_engine/collapse.gif',
15
+ 'dpn_swagger_engine/expand.gif',
16
+ 'dpn_swagger_engine/explorer_icons.png',
17
+ 'dpn_swagger_engine/favicon-16x16.png',
18
+ 'dpn_swagger_engine/favicon-32x32.png',
19
+ 'dpn_swagger_engine/favicon.ico',
20
+ 'dpn_swagger_engine/logo_small.png',
21
+ 'dpn_swagger_engine/pet_store_api.png',
22
+ 'dpn_swagger_engine/throbber.gif',
23
+ 'dpn_swagger_engine/wordnik_api.png'
18
24
  ]
25
+ app.config.assets.paths << root.join(
26
+ 'app', 'assets', 'images', 'dpn_swagger_engine', 'dpn_swagger_engine'
27
+ )
28
+ app.config.assets.paths << root.join(
29
+ 'app', 'assets', 'fonts', 'dpn_swagger_engine', 'dpn_swagger_engine'
30
+ )
19
31
  end
20
32
  end
21
33
 
@@ -1,4 +1,4 @@
1
1
  module DpnSwaggerEngine
2
2
  # Major version number matches DPN REST API version
3
- VERSION = '2.0.3.rc'.freeze
3
+ VERSION = '2.0.4.rc'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpn_swagger_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3.rc
4
+ version: 2.0.4.rc
5
5
  platform: ruby
6
6
  authors:
7
7
  - batdevis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-09-07 00:00:00.000000000 Z
12
+ date: 2016-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -185,11 +185,11 @@ files:
185
185
  - app/assets/javascripts/dpn_swagger_engine/swagger-ui.min.js
186
186
  - app/assets/javascripts/dpn_swagger_engine/swagger.json
187
187
  - app/assets/stylesheets/dpn_swagger_engine/application.css
188
- - app/assets/stylesheets/dpn_swagger_engine/print.css
188
+ - app/assets/stylesheets/dpn_swagger_engine/print.css.erb
189
189
  - app/assets/stylesheets/dpn_swagger_engine/reset.css
190
- - app/assets/stylesheets/dpn_swagger_engine/screen.css
191
- - app/assets/stylesheets/dpn_swagger_engine/style.css
192
- - app/assets/stylesheets/dpn_swagger_engine/typography.css
190
+ - app/assets/stylesheets/dpn_swagger_engine/screen.css.erb
191
+ - app/assets/stylesheets/dpn_swagger_engine/style.css.erb
192
+ - app/assets/stylesheets/dpn_swagger_engine/typography.css.erb
193
193
  - app/controllers/dpn_swagger_engine/application_controller.rb
194
194
  - app/controllers/dpn_swagger_engine/swaggers_controller.rb
195
195
  - app/helpers/dpn_swagger_engine/application_helper.rb
@@ -198,7 +198,6 @@ files:
198
198
  - app/views/dpn_swagger_engine/swaggers/o2c.html
199
199
  - app/views/dpn_swagger_engine/swaggers/show.html.erb
200
200
  - app/views/layouts/dpn_swagger_engine/application.html.erb
201
- - app/views/swagger_engine/swaggers/show.html.erb
202
201
  - bin/rails
203
202
  - bin/setup
204
203
  - config/routes.rb
@@ -1,14 +0,0 @@
1
- /* Google Font's Droid Sans */
2
- @font-face {
3
- font-family: 'Droid Sans';
4
- font-style: normal;
5
- font-weight: 400;
6
- src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf'), format('truetype');
7
- }
8
- /* Google Font's Droid Sans Bold */
9
- @font-face {
10
- font-family: 'Droid Sans';
11
- font-style: normal;
12
- font-weight: 700;
13
- src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf'), format('truetype');
14
- }
@@ -1,121 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Swagger UI</title>
6
-
7
- <!-- Content in this file is derived from swagger-ui:dist/index.html -->
8
-
9
- <%#= favicon_link_tag 'favicon-32x32.png', rel: 'icon', type: 'image/png', sizes: '32x32' %>
10
- <%#= favicon_link_tag 'favicon-16x16.png', rel: 'icon', type: 'image/png', sizes: '16x16' %>
11
-
12
- <%= stylesheet_link_tag "dpn_swagger_engine/application" %>
13
- <%= stylesheet_link_tag "dpn_swagger_engine/reset", media: "print" %>
14
- <%= stylesheet_link_tag "dpn_swagger_engine/print", media: "print" %>
15
-
16
- <%= javascript_include_tag "dpn_swagger_engine/application" %>
17
-
18
- <%= csrf_meta_tags %>
19
-
20
- <script type="text/javascript">
21
- $(function () {
22
- var url = window.location.search.match(/url=([^&]+)/);
23
- if (url && url.length > 1) {
24
- url = decodeURIComponent(url[1]);
25
- } else {
26
- url = '<%= @swagger_json_url %>';
27
- }
28
-
29
- hljs.configure({
30
- highlightSizeThreshold: 5000
31
- });
32
-
33
- // Pre load translate...
34
- if(window.SwaggerTranslator) {
35
- window.SwaggerTranslator.translate();
36
- }
37
-
38
- window.swaggerUi = new SwaggerUi({
39
- url: url,
40
- dom_id: "swagger-ui-container",
41
- supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
42
- onComplete: function(swaggerApi, swaggerUi){
43
- if(typeof initOAuth == "function") {
44
- initOAuth({
45
- clientId: "your-client-id",
46
- clientSecret: "your-client-secret-if-required",
47
- realm: "your-realms",
48
- appName: "your-app-name",
49
- scopeSeparator: ",",
50
- additionalQueryStringParams: {}
51
- });
52
- }
53
-
54
- if(window.SwaggerTranslator) {
55
- window.SwaggerTranslator.translate();
56
- }
57
-
58
- headerTokenAuthorization();
59
- },
60
- onFailure: function(data) {
61
- log("Unable to Load SwaggerUI");
62
- },
63
- docExpansion: "none",
64
- jsonEditor: true,
65
- // apisSorter: "alpha",
66
- defaultModelRendering: 'schema',
67
- showRequestHeaders: false
68
- });
69
-
70
- // Custom code for DPN authorization token
71
- function headerTokenAuthorization(){
72
- var token = encodeURIComponent($('#input_apiKey')[0].value);
73
- if(token && token.trim() != "") {
74
- var tokenAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", "Token token=" + token, "header"));
75
- window.swaggerUi.api.clientAuthorizations.add("api_key", tokenAuth);
76
- // var tokenAuth = new ApiKeyAuthorization("Authorization", "Token token=" + token, "header"));
77
- // window.authorizations.add("api_key", tokenAuth);
78
- log("added token " + token);
79
- }
80
- }
81
-
82
- $('#input_apiKey').change(headerTokenAuthorization);
83
-
84
- // A DPN authorization token that should work in development
85
- var dpnToken = "hathi_token";
86
- $('#input_apiKey').val(dpnToken);
87
-
88
- window.swaggerUi.load();
89
-
90
- function log() {
91
- if ('console' in window) {
92
- console.log.apply(console, arguments);
93
- }
94
- }
95
- });
96
- </script>
97
- </head>
98
-
99
- <body class="swagger-section">
100
- <div id='header'>
101
- <div class="swagger-ui-wrap">
102
- <a id="logo" href="http://swagger.io">
103
- <img class="logo__img" alt="swagger" height="30" width="30" src="images/logo_small.png" />
104
- <span class="logo__title">swagger</span>
105
- </a>
106
- <form id='api_selector'>
107
- <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
108
- <!--
109
- <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
110
- <div class='input'><a id="explore" href="#" data-sw-translate>Explore</a></div>
111
- -->
112
- <div id='auth_container'></div>
113
- <div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
114
- </form>
115
- </div>
116
- </div>
117
-
118
- <div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
119
- <div id="swagger-ui-container" class="swagger-ui-wrap"></div>
120
- </body>
121
- </html>