swaggard 0.5.3 → 0.5.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: fc0127d02018fc6d808dd075a2efe9f2b384a258
4
- data.tar.gz: 395c2b2d482e2c7b0167f0fc1f3a87b9295122a0
3
+ metadata.gz: ecc218894a718358cb55794cbe31c0506761fcca
4
+ data.tar.gz: b45ab232037649703f9b277be8104a2c9df607de
5
5
  SHA512:
6
- metadata.gz: d3da1c11103fe8137f3db66f3b1453a4739b673965e44776f046f4e4413660ffc74971445fe2cce13e61d9cfe59fa060706f94bca5ce40f6b2ec1d37d47341a0
7
- data.tar.gz: 7b4e5171883091484020d9adf44581e357635786eb3200c38bea1aa1f90bb96921fe1d8b359ce82e8fd2321d459fc2a745e7eb7f1ccb9a4dac6b491b87c855b4
6
+ metadata.gz: 0bdc966974f63e4b95560412522ba5fe587df415a673bc94214bb3188cea43d8439748bbd5604f7b60ccd4353e949b7d569e46fb28c9c44fd15060a6e57b2301
7
+ data.tar.gz: 9b3ec08e20ff8c589ec17fe6abc9f174791acb706648c4647133828313c8f2e0e54fe3ce5af416583ed51157bebd81aacbf2d7bec88e0c5c6494bb9b20ffdfbc
data/README.md CHANGED
@@ -29,17 +29,13 @@ Install the gem with Bundler:
29
29
 
30
30
  bundle install
31
31
 
32
-
33
32
  ## Getting Started
34
33
 
35
- Place your configuration in a your rails initializers
34
+ First generate a Swaggard configuration initializer file.
36
35
 
37
- # config/initializers/swaggard.rb
36
+ rails g swaggard:install
38
37
 
39
- Swaggard.configure do |config|
40
- config.api_version = '0.1'
41
- config.api_base_path = '/api' # The base path on which the API is served, which is relative to the host. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/).
42
- end
38
+ This will install the file `swaggard.rb` to your Rails `config/initializers` directory which you can then alter the config.
43
39
 
44
40
  Mount your engine
45
41
 
@@ -0,0 +1,13 @@
1
+ module Swaggard
2
+ class InstallGenerator < Rails::Generators::Base
3
+
4
+ desc "Installs a Swaggard initializer config"
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ def create_initializer
8
+ dest = File.join("config/initializers", "swaggard.rb")
9
+ template "swaggard.rb", dest
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,96 @@
1
+ # Swaggard configuration settings and their current default values... override
2
+ # as you see fit.
3
+ #
4
+ # For more info on configuration settings see http://swagger.io/specification/
5
+
6
+ Swaggard.configure do |config|
7
+ # Set an access password.
8
+ # See https://github.com/adrian-gomez/swaggard#access-authorization for more info
9
+ # config.access_password = ""
10
+
11
+ # Set an access username. If you don't set an access_username, everyone will
12
+ # have access to Swagger documentation.
13
+ # See https://github.com/adrian-gomez/swaggard#access-authorization for more info
14
+ # config.access_username = ""
15
+
16
+ # Swaggard supports additional parameters to be sent on every request,
17
+ # either as a header or as part of the query.
18
+ # See https://github.com/adrian-gomez/swaggard#additional-parameters for more info
19
+ # config.additional_parameters = []
20
+
21
+ # The base path on which the API is served, which is relative to the host.
22
+ # If it is not included, the API is served directly under the host.
23
+ # The value MUST start with a leading slash (/).
24
+ # config.api_base_path = "/"
25
+
26
+ # Specify the API formats.
27
+ # config.api_formats = [:xml, :json]
28
+
29
+ # The version of the application API.
30
+ # config.api_version = "0.1"
31
+
32
+ # Set an API authentication key
33
+ # See https://github.com/adrian-gomez/swaggard#authentication for more details
34
+ # config.authentication_key = "api_key"
35
+
36
+ # Set the API authentication type, either header or query
37
+ # See https://github.com/adrian-gomez/swaggard#authentication for more details
38
+ # config.authentication_type = "query"
39
+
40
+ # Set the API authentication value
41
+ # See https://github.com/adrian-gomez/swaggard#authentication for more details
42
+ # config.authentication_value = ""
43
+
44
+ # The contact email for the API.
45
+ # config.contact_email = ""
46
+
47
+ # The contact email for the API.
48
+ # config.contact_name = ""
49
+
50
+ # The contact url for the API.
51
+ # config.contact_url = ""
52
+
53
+ # Specify where to look for your controllers
54
+ # config.controllers_path = "#{Rails.root}/app/controllers/**/*.rb"
55
+
56
+ # Specify a default content type for requests to use in SwaggerUI.
57
+ # See https://github.com/adrian-gomez/swaggard#default-content-type for more info
58
+ # config.default_content_type = ""
59
+
60
+ # A short description of the application.
61
+ # config.description = ""
62
+
63
+ # The host (name or ip) serving the API.
64
+ # This MUST be the host only and does not include the scheme nor sub-paths.
65
+ # config.host = ""
66
+
67
+ # The language to display SwaggerUI in.
68
+ # See https://github.com/adrian-gomez/swaggard#language for more info
69
+ # config.language = "en"
70
+
71
+ # The name of the Licence eg. MIT
72
+ # config.license_name = ""
73
+
74
+ # The URL of the Licence info
75
+ # config.license_url = ""
76
+
77
+ # Specify one or more paths to look for your model documentation
78
+ # config.models_paths = ["#{app.root}/app/serializers/**/*.rb"]
79
+
80
+ # The transfer protocol of the API.
81
+ # Values MUST be from the list: "http", "https", "ws", "wss"
82
+ # config.schemes = [:https, :http]
83
+
84
+ # Specifies the Swagger Specification version being used.
85
+ # config.swagger_version = "2.0"
86
+
87
+ # The title of the application/API.
88
+ # config.title = ""
89
+
90
+ # The Terms of Service for the API.
91
+ # config.tos = ""
92
+
93
+ # Specify whether to cache the Swagger docs or not.
94
+ # See https://github.com/adrian-gomez/swaggard#caching for more info
95
+ # config.use_cache = false
96
+ end
@@ -14,10 +14,10 @@ module Swaggard
14
14
 
15
15
  attr_accessor :controllers_path, :models_paths, :routes
16
16
 
17
- attr_writer :swagger_version, :api_base_path, :api_version, :api_path, :api_formats, :title,
17
+ attr_writer :swagger_version, :api_base_path, :api_version, :api_formats, :title,
18
18
  :description, :tos, :contact_email, :contact_name, :contact_url, :host,
19
19
  :authentication_type, :authentication_key, :authentication_value,
20
- :access_username, :access_password, :default_content_type, :use_cache, :module_name,
20
+ :access_username, :access_password, :default_content_type, :use_cache,
21
21
  :language, :additional_parameters, :schemes
22
22
 
23
23
  def swagger_version
@@ -28,10 +28,6 @@ module Swaggard
28
28
  @api_version ||= '0.1'
29
29
  end
30
30
 
31
- def api_path
32
- @api_path ||= ''
33
- end
34
-
35
31
  def api_base_path
36
32
  @api_base_path ||= '/'
37
33
  end
@@ -116,9 +112,5 @@ module Swaggard
116
112
  @use_cache ||= false
117
113
  end
118
114
 
119
- def module_name
120
- @module_name ||= ''
121
- end
122
-
123
115
  end
124
116
  end
@@ -7,11 +7,9 @@ module Swaggard
7
7
  attr_reader :controller_class
8
8
 
9
9
  def initialize(yard_object)
10
- @yard_name = yard_object.name
11
-
12
10
  controller_name = "#{yard_object.namespace}::#{yard_object.name}"
13
- controller_name.prepend("#{Swaggard.configuration.module_name}::") unless Swaggard.configuration.module_name.blank?
14
11
 
12
+ @yard_name = yard_object.name
15
13
  @controller_class = controller_name.constantize
16
14
 
17
15
  tag = yard_object.tags.find { |tag| tag.tag_name == 'tag' }
@@ -29,4 +27,4 @@ module Swaggard
29
27
 
30
28
  end
31
29
  end
32
- end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Swaggard
2
2
 
3
- VERSION = '0.5.3'
3
+ VERSION = '0.5.4'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swaggard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Gomez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2017-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -160,6 +160,8 @@ files:
160
160
  - app/views/swaggard/swagger/index.html.erb
161
161
  - config/initializers/assets.rb
162
162
  - config/routes.rb
163
+ - lib/generators/swaggard/install_generator.rb
164
+ - lib/generators/swaggard/templates/swaggard.rb
163
165
  - lib/swaggard.rb
164
166
  - lib/swaggard/api_definition.rb
165
167
  - lib/swaggard/configuration.rb