swagger_ui_engine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +15 -0
- data/app/controllers/swagger_ui_engine/docs_controller.rb +7 -0
- data/app/views/swagger_ui_engine/docs/index.html.erb +108 -0
- data/config/routes.rb +3 -0
- data/lib/swagger_ui_engine.rb +4 -0
- data/lib/swagger_ui_engine/engine.rb +26 -0
- data/lib/swagger_ui_engine/version.rb +3 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a29be68ba946ae7ded7569d2efccc05e7d9740c5
|
4
|
+
data.tar.gz: fc6f9444c192d29477a5e18d33481307899ba7fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f42e9af67f694da26156a934420a9a8b755b7f062ffe187032c10004eaf419e964ea59c83e0a93d6c074864a2635d8feecfc7e64fdfe492f4e6a4af98d7a4f53
|
7
|
+
data.tar.gz: 8bc31d62302e1a1a9d6f09cafe6ce1f068a409ebb94329dec2181168d2143033185c53a45cc3da204e7c8f4aad383894c074df5e73cd1afdf30184e2d57214e5
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Zuzanna Stolińska
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'SwaggerUiEngine'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta http-equiv="x-ua-compatible" content="IE=edge">
|
6
|
+
<title>Swagger UI</title>
|
7
|
+
<link rel="icon" type="image/png" href="/swagger_ui_engine/images/favicon-32x32.png" sizes="32x32" />
|
8
|
+
<link rel="icon" type="image/png" href="/swagger_ui_engine/images/favicon-16x16.png" sizes="16x16" />
|
9
|
+
<link href='/swagger_ui_engine/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
|
10
|
+
<link href='/swagger_ui_engine/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
|
11
|
+
<link href='/swagger_ui_engine/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
12
|
+
<link href='/swagger_ui_engine/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
|
13
|
+
<link href='/swagger_ui_engine/css/print.css' media='print' rel='stylesheet' type='text/css'/>
|
14
|
+
|
15
|
+
<script src='/swagger_ui_engine/lib/object-assign-pollyfill.js' type='text/javascript'></script>
|
16
|
+
<script src='/swagger_ui_engine/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
17
|
+
<script src='/swagger_ui_engine/lib/jquery.slideto.min.js' type='text/javascript'></script>
|
18
|
+
<script src='/swagger_ui_engine/lib/jquery.wiggle.min.js' type='text/javascript'></script>
|
19
|
+
<script src='/swagger_ui_engine/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
|
20
|
+
<script src='/swagger_ui_engine/lib/handlebars-4.0.5.js' type='text/javascript'></script>
|
21
|
+
<script src='/swagger_ui_engine/lib/lodash.min.js' type='text/javascript'></script>
|
22
|
+
<script src='/swagger_ui_engine/lib/backbone-min.js' type='text/javascript'></script>
|
23
|
+
<script src='/swagger_ui_engine/swagger-ui.js' type='text/javascript'></script>
|
24
|
+
<script src='/swagger_ui_engine/lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
|
25
|
+
<script src='/swagger_ui_engine/lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
|
26
|
+
<script src='/swagger_ui_engine/lib/jsoneditor.min.js' type='text/javascript'></script>
|
27
|
+
<script src='/swagger_ui_engine/lib/marked.js' type='text/javascript'></script>
|
28
|
+
<script src='/swagger_ui_engine/lib/swagger-oauth.js' type='text/javascript'></script>
|
29
|
+
|
30
|
+
<!-- Some basic translations -->
|
31
|
+
<!-- <script src='lang/translator.js' type='text/javascript'></script> -->
|
32
|
+
<!-- <script src='lang/ru.js' type='text/javascript'></script> -->
|
33
|
+
<!-- <script src='lang/en.js' type='text/javascript'></script> -->
|
34
|
+
|
35
|
+
<script type="text/javascript">
|
36
|
+
$(function () {
|
37
|
+
var url = window.location.search.match(/url=([^&]+)/);
|
38
|
+
if (url && url.length > 1) {
|
39
|
+
url = decodeURIComponent(url[1]);
|
40
|
+
} else {
|
41
|
+
url = "<%= @swagger_url %>";
|
42
|
+
}
|
43
|
+
|
44
|
+
hljs.configure({
|
45
|
+
highlightSizeThreshold: 5000
|
46
|
+
});
|
47
|
+
|
48
|
+
// Pre load translate...
|
49
|
+
if(window.SwaggerTranslator) {
|
50
|
+
window.SwaggerTranslator.translate();
|
51
|
+
}
|
52
|
+
window.swaggerUi = new SwaggerUi({
|
53
|
+
url: url,
|
54
|
+
dom_id: "swagger-ui-container",
|
55
|
+
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
56
|
+
onComplete: function(swaggerApi, swaggerUi){
|
57
|
+
if(typeof initOAuth == "function") {
|
58
|
+
initOAuth({
|
59
|
+
clientId: "your-client-id",
|
60
|
+
clientSecret: "your-client-secret-if-required",
|
61
|
+
realm: "your-realms",
|
62
|
+
appName: "your-app-name",
|
63
|
+
scopeSeparator: " ",
|
64
|
+
additionalQueryStringParams: {}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
if(window.SwaggerTranslator) {
|
69
|
+
window.SwaggerTranslator.translate();
|
70
|
+
}
|
71
|
+
},
|
72
|
+
onFailure: function(data) {
|
73
|
+
log("Unable to Load SwaggerUI");
|
74
|
+
},
|
75
|
+
docExpansion: "none",
|
76
|
+
jsonEditor: false,
|
77
|
+
defaultModelRendering: 'schema',
|
78
|
+
showRequestHeaders: false,
|
79
|
+
showOperationIds: false
|
80
|
+
});
|
81
|
+
|
82
|
+
window.swaggerUi.load();
|
83
|
+
|
84
|
+
function log() {
|
85
|
+
if ('console' in window) {
|
86
|
+
console.log.apply(console, arguments);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
});
|
90
|
+
</script>
|
91
|
+
</head>
|
92
|
+
|
93
|
+
<body class="swagger-section">
|
94
|
+
<div id='header'>
|
95
|
+
<div class="swagger-ui-wrap">
|
96
|
+
<a id="logo" href="http://swagger.io"><img class="logo__img" alt="swagger" height="30" width="30" src="/swagger_ui_engine/images/logo_small.png" /><span class="logo__title">swagger</span></a>
|
97
|
+
<form id='api_selector'>
|
98
|
+
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
|
99
|
+
<div id='auth_container'></div>
|
100
|
+
<div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
|
101
|
+
</form>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
|
106
|
+
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
107
|
+
</body>
|
108
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module SwaggerUiEngine
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace SwaggerUiEngine
|
4
|
+
|
5
|
+
# Initializer to combine this engines static assets with the static assets of the hosting site.
|
6
|
+
initializer 'static assets' do |app|
|
7
|
+
app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Configuration
|
12
|
+
attr_accessor :swagger_url
|
13
|
+
end
|
14
|
+
class << self
|
15
|
+
attr_writer :configuration
|
16
|
+
end
|
17
|
+
|
18
|
+
module_function
|
19
|
+
def configuration
|
20
|
+
@configuration ||= Configuration.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def configure
|
24
|
+
yield(configuration)
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: swagger_ui_engine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ZuzannaSt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Api docs inside your rails project.
|
14
|
+
email:
|
15
|
+
- zuzannast@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- MIT-LICENSE
|
21
|
+
- Rakefile
|
22
|
+
- app/controllers/swagger_ui_engine/docs_controller.rb
|
23
|
+
- app/views/swagger_ui_engine/docs/index.html.erb
|
24
|
+
- config/routes.rb
|
25
|
+
- lib/swagger_ui_engine.rb
|
26
|
+
- lib/swagger_ui_engine/engine.rb
|
27
|
+
- lib/swagger_ui_engine/version.rb
|
28
|
+
homepage: https://github.com/ZuzannaSt/swagger_ui_engine
|
29
|
+
licenses:
|
30
|
+
- MIT
|
31
|
+
metadata: {}
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubyforge_project:
|
48
|
+
rubygems_version: 2.4.5
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: Mount swagger-ui as rails engine.
|
52
|
+
test_files: []
|