swagger_autogenerate 1.0.3 → 1.0.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
  SHA256:
3
- metadata.gz: b3f7b9b67269b270dff6c7ec738c7b4ef8cafa149494c41e74671b0a193bc9d1
4
- data.tar.gz: dadf1b845cb96e70f375a245d606b0b4a487b6a945e8ea2508bb102d9e0fbca3
3
+ metadata.gz: 9156a7957bb459cdcea51aa4aaac537911daeefa44cb6cbceb6756666a924048
4
+ data.tar.gz: 7505182c0f2e8875ecef5a19bdc1fa63f5af1586896c5d3d9c6fcd8607f4e416
5
5
  SHA512:
6
- metadata.gz: 261b31e5e7c4d02f72c3a60c0262d7034210685e690d66babc899c006886bcf4887380e8d0e58904eafa433552fc56f7ee4ac0ffe7c58c2654c2c9c216c2a3ac
7
- data.tar.gz: 28034a707e1568ecf04a668427b186729ea92a9709e847d4db6a29d59a02fd866fd394ed6f10e3fa26e34b51d2438309fa4047f0acbf6b86a5e36cdb9aad7821
6
+ metadata.gz: 723c04173492313fe145364f36a0237b6c0ac490d82ef6bdc57ddd9949180a51319a77af17af6cef65b037811f1771eaa92fab052353ded4751de335e22ef07d
7
+ data.tar.gz: b1f5897b9e943f27a607575867b3f1fc229888947cffa8ee9ac37e23d76ebc442d6656527216d974bbb2ea9fb8333549833c1e95f6eac538d0c9fc3f75e734d5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  ## [0.1.1] - 2024-05-27
4
4
  ## [1.0.2] - 2024-05-31
5
- ## [1.0.3] - 2024-05-31
5
+ ## [1.0.4] - 2024-06-01
6
6
 
7
7
  - Initial release
data/README.md CHANGED
@@ -37,28 +37,21 @@ To configure the swagger_autogenerate gem in your Rails application, follow thes
37
37
  2) Inside the class ApplicationController block.
38
38
  3) Add the following code:
39
39
  ```
40
- include SwaggerAutogenerate if Rails.env.test? && ENV['SWAGGER'].present?
40
+ include SwaggerAutogenerate if Rails.env.test?
41
41
  ```
42
- in the #Example-step you will set the ENV['SWAGGER'],
43
-
44
- By setting the ENV['SWAGGER'] environment variable, you can specify the path to the new file,
45
- whether it's a specific file (e.g., ../myfile.yaml) or a directory (e.g., ../docs).
46
- This flexibility ensures that the documentation can be easily integrated into your project's structure and workflow.
47
42
 
48
43
  ### Step 2 (optional)
49
44
  1) Create a file called swagger_autogenerate.rb in the ./config/initializers
50
- 2) Open the ./config/initializers/swagger/swagger_autogenerate.rb
45
+ 2) Open the ./config/initializers/swagger_autogenerate.rb
51
46
  3) Add the following code to the swagger_autogenerate.rb
52
47
  ```
53
- module SwaggerAutogenerate
54
- class SwaggerTrace
55
- WITH_CONFIG = true
56
- WITH_MULTIPLE_EXAMPLES = true
57
- WITH_EXAMPLE_DESCRIPTION = true
58
- WITH_RESPONSE_DESCRIPTION = true
59
- SWAGGER_ENVIRONMENT_VARIABLE = 'SWAGGER'
60
- end
48
+ SwaggerAutogenerate.configure do |config|
49
+ config.with_config = true
50
+ config.with_example_description = true
51
+ config.with_multiple_examples = true
52
+ config.with_response_description = true
61
53
  end
54
+
62
55
  ```
63
56
  $ This file is optional and allows you to customize the behavior of the gem by providing additional options.
64
57
 
@@ -1,5 +1,19 @@
1
1
  module SwaggerAutogenerate
2
- module SwaggerPublicMethods
2
+ class Configuration
3
+ attr_accessor :with_config, :with_multiple_examples, :with_example_description,
4
+ :with_response_description, :swagger_environment_variable
5
+
6
+ def initialize
7
+ @with_config = true
8
+ @with_multiple_examples = true
9
+ @with_example_description = true
10
+ @with_response_description = true
11
+ @swagger_environment_variable = 'SWAGGER'
12
+ @security = security
13
+ @swagger_config = swagger_config
14
+ @response_status = response_status
15
+ end
16
+
3
17
  def response_status
4
18
  {
5
19
  100 => 'The initial part of the request has been received, and the client should proceed with sending the remainder of the request',
@@ -46,5 +60,20 @@ module SwaggerAutogenerate
46
60
  }
47
61
  }
48
62
  end
63
+
64
+ def security
65
+ [
66
+ { 'org_slug' => [] },
67
+ { 'locale' => [] }
68
+ ]
69
+ end
70
+ end
71
+
72
+ def self.configuration
73
+ @configuration ||= Configuration.new
74
+ end
75
+
76
+ def self.configure
77
+ yield(configuration)
49
78
  end
50
79
  end
@@ -1,15 +1,15 @@
1
- require_relative 'swagger_public_methods'
2
1
  require_relative 'configuration'
3
2
 
4
3
  module SwaggerAutogenerate
5
4
  class SwaggerTrace
6
- include SwaggerPublicMethods
7
-
8
5
  def initialize(request, response)
9
6
  @with_config = ::SwaggerAutogenerate.configuration.with_config
10
7
  @with_multiple_examples = ::SwaggerAutogenerate.configuration.with_multiple_examples
11
8
  @with_example_description = ::SwaggerAutogenerate.configuration.with_example_description
12
9
  @with_response_description = ::SwaggerAutogenerate.configuration.with_response_description
10
+ @security = ::SwaggerAutogenerate.configuration.security
11
+ @swagger_config = ::SwaggerAutogenerate.configuration.swagger_config
12
+ @response_status = ::SwaggerAutogenerate.configuration.response_status
13
13
  @request = request
14
14
  @response = response
15
15
  @@paths = {}
@@ -34,7 +34,7 @@ module SwaggerAutogenerate
34
34
 
35
35
  attr_reader :request, :response, :current_path, :yaml_file, :configuration,
36
36
  :with_config, :with_multiple_examples, :with_example_description,
37
- :with_response_description
37
+ :with_response_description, :security, :response_status
38
38
 
39
39
  # main methods
40
40
 
@@ -310,13 +310,6 @@ module SwaggerAutogenerate
310
310
  @@paths ||= {}
311
311
  end
312
312
 
313
- def security
314
- [
315
- 'org_slug' => [],
316
- 'locale' => []
317
- ]
318
- end
319
-
320
313
  def controller_name
321
314
  request.params['controller'].split('/').last.to_s
322
315
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwaggerAutogenerate
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_autogenerate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - MohammedBuraiah
@@ -25,13 +25,14 @@ files:
25
25
  - Rakefile
26
26
  - lib/config/initializers/swagger_autogenerate.rb
27
27
  - lib/swagger_autogenerate.rb
28
- - lib/swagger_autogenerate/swagger_public_methods.rb
28
+ - lib/swagger_autogenerate/configuration.rb
29
29
  - lib/swagger_autogenerate/swagger_trace.rb
30
30
  - lib/swagger_autogenerate/version.rb
31
31
  - sig/swagger_autogenerate.rbs
32
32
  - swagger_autogenerate-0.1.0.gem
33
33
  - swagger_autogenerate-0.1.1.gem
34
34
  - swagger_autogenerate-1.0.2.gem
35
+ - swagger_autogenerate-1.0.3.gem
35
36
  - swagger_autogenerate.gemspec
36
37
  homepage: https://github.com/MohammedBuraiah/swagger_autogenerate
37
38
  licenses: