swagger_engine 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/swagger_engine/swaggers_controller.rb +22 -0
- data/app/views/swagger_engine/swaggers/index.html.erb +7 -0
- data/app/views/swagger_engine/{swagger → swaggers}/o2c.html +0 -0
- data/app/views/swagger_engine/{swagger/index.html.erb → swaggers/show.html.erb} +1 -1
- data/config/routes.rb +2 -1
- data/lib/swagger_engine/engine.rb +18 -1
- data/lib/swagger_engine/version.rb +1 -1
- metadata +34 -33
- data/app/controllers/swagger_engine/swagger_controller.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e62278d5fef89c8d26a58f3e86c29e1d5f54267
|
4
|
+
data.tar.gz: cb11cac17e103d56b2298a6b6ed0084d7c3f5f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 789b773d04c10f4a113f551b979a7a511aa88266a954a561923c3adf09e60973fb2af86866707890847e73208a4d4e7d44e2f41f1017ccec76d6468563835f1a
|
7
|
+
data.tar.gz: 136015fff2f5fdcbddb5a97bed7939f2c70d606f9ee721ba7c2f485c35aa2c3d454f20456f5ec3f237c09e52e69e19465107b7c4465b66bf8473ffd5de9d3643
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_dependency "swagger_engine/application_controller"
|
2
|
+
|
3
|
+
module SwaggerEngine
|
4
|
+
class SwaggersController < ApplicationController
|
5
|
+
layout false
|
6
|
+
|
7
|
+
before_action :load_json_files
|
8
|
+
|
9
|
+
def index
|
10
|
+
redirect_to swagger_path(@json_files.first[0]) if ( @json_files.size == 1 )
|
11
|
+
end
|
12
|
+
|
13
|
+
def show
|
14
|
+
@swagger_json_url = @json_files[params[:id].to_sym]
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def load_json_files
|
19
|
+
@json_files ||= SwaggerEngine.configuration.json_files || { default: "swagger.json" }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
data/config/routes.rb
CHANGED
@@ -7,4 +7,21 @@ module SwaggerEngine
|
|
7
7
|
end
|
8
8
|
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
|
+
class Configuration
|
12
|
+
#[{ default: "swagger.json" }]
|
13
|
+
attr_accessor :json_files
|
14
|
+
end
|
15
|
+
class << self
|
16
|
+
attr_writer :configuration
|
17
|
+
end
|
18
|
+
|
19
|
+
module_function
|
20
|
+
def configuration
|
21
|
+
@configuration ||= Configuration.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure
|
25
|
+
yield(configuration)
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagger_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- batdevis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Api docs inside your rails project.
|
14
14
|
email:
|
@@ -58,12 +58,13 @@ files:
|
|
58
58
|
- app/assets/stylesheets/swagger_engine/screen.scss
|
59
59
|
- app/assets/stylesheets/swagger_engine/typography.scss
|
60
60
|
- app/controllers/swagger_engine/application_controller.rb
|
61
|
-
- app/controllers/swagger_engine/
|
61
|
+
- app/controllers/swagger_engine/swaggers_controller.rb
|
62
62
|
- app/helpers/swagger_engine/application_helper.rb
|
63
63
|
- app/helpers/swagger_engine/swagger_helper.rb
|
64
64
|
- app/views/layouts/swagger_engine/application.html.erb
|
65
|
-
- app/views/swagger_engine/
|
66
|
-
- app/views/swagger_engine/
|
65
|
+
- app/views/swagger_engine/swaggers/index.html.erb
|
66
|
+
- app/views/swagger_engine/swaggers/o2c.html
|
67
|
+
- app/views/swagger_engine/swaggers/show.html.erb
|
67
68
|
- config/routes.rb
|
68
69
|
- lib/swagger_engine.rb
|
69
70
|
- lib/swagger_engine/engine.rb
|
@@ -129,39 +130,39 @@ signing_key:
|
|
129
130
|
specification_version: 4
|
130
131
|
summary: Mount swagger-ui as rails engine.
|
131
132
|
test_files:
|
132
|
-
- test/swagger_engine_test.rb
|
133
133
|
- test/helpers/swagger_engine/swagger_helper_test.rb
|
134
134
|
- test/test_helper.rb
|
135
|
-
- test/
|
136
|
-
- test/
|
137
|
-
- test/
|
138
|
-
- test/dummy/public/404.html
|
139
|
-
- test/dummy/README.rdoc
|
140
|
-
- test/dummy/bin/rails
|
141
|
-
- test/dummy/bin/rake
|
135
|
+
- test/integration/navigation_test.rb
|
136
|
+
- test/controllers/swagger_engine/swagger_controller_test.rb
|
137
|
+
- test/swagger_engine_test.rb
|
142
138
|
- test/dummy/bin/bundle
|
143
|
-
- test/dummy/
|
144
|
-
- test/dummy/
|
145
|
-
- test/dummy/
|
146
|
-
- test/dummy/app/assets/stylesheets/application.css
|
147
|
-
- test/dummy/app/controllers/application_controller.rb
|
148
|
-
- test/dummy/Rakefile
|
149
|
-
- test/dummy/config.ru
|
150
|
-
- test/dummy/config/boot.rb
|
151
|
-
- test/dummy/config/routes.rb
|
152
|
-
- test/dummy/config/environment.rb
|
139
|
+
- test/dummy/bin/rake
|
140
|
+
- test/dummy/bin/rails
|
141
|
+
- test/dummy/README.rdoc
|
153
142
|
- test/dummy/config/locales/en.yml
|
143
|
+
- test/dummy/config/environment.rb
|
144
|
+
- test/dummy/config/environments/test.rb
|
145
|
+
- test/dummy/config/environments/production.rb
|
146
|
+
- test/dummy/config/environments/development.rb
|
147
|
+
- test/dummy/config/application.rb
|
148
|
+
- test/dummy/config/routes.rb
|
149
|
+
- test/dummy/config/boot.rb
|
150
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
151
|
+
- test/dummy/config/initializers/session_store.rb
|
154
152
|
- test/dummy/config/initializers/inflections.rb
|
155
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
156
153
|
- test/dummy/config/initializers/secret_token.rb
|
157
|
-
- test/dummy/config/initializers/session_store.rb
|
158
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
159
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
160
154
|
- test/dummy/config/initializers/mime_types.rb
|
161
|
-
- test/dummy/config/
|
162
|
-
- test/dummy/config/
|
163
|
-
- test/dummy/config
|
164
|
-
- test/dummy/
|
165
|
-
- test/
|
166
|
-
- test/
|
155
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
156
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
157
|
+
- test/dummy/config.ru
|
158
|
+
- test/dummy/app/helpers/application_helper.rb
|
159
|
+
- test/dummy/app/views/layouts/application.html.erb
|
160
|
+
- test/dummy/app/controllers/application_controller.rb
|
161
|
+
- test/dummy/app/assets/javascripts/application.js
|
162
|
+
- test/dummy/app/assets/stylesheets/application.css
|
163
|
+
- test/dummy/public/500.html
|
164
|
+
- test/dummy/public/404.html
|
165
|
+
- test/dummy/public/422.html
|
166
|
+
- test/dummy/public/favicon.ico
|
167
|
+
- test/dummy/Rakefile
|
167
168
|
has_rdoc:
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require_dependency "swagger_engine/application_controller"
|
2
|
-
|
3
|
-
module SwaggerEngine
|
4
|
-
class SwaggerController < ApplicationController
|
5
|
-
layout false
|
6
|
-
|
7
|
-
def index
|
8
|
-
@swagger_json_url = ENV['SWAGGER_JSON_URL'] ||
|
9
|
-
ActionController::Base.helpers.asset_path("swagger_engine/swagger.json") ||
|
10
|
-
"http://petstore.swagger.io/v2/swagger.json"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|