Class: Grape::API
- Inherits:
-
Object
- Object
- Grape::API
- Defined in:
- lib/grape-swagger.rb
Class Attribute Summary collapse
-
.combined_namespace_identifiers ⇒ Object
Returns the value of attribute combined_namespace_identifiers.
-
.combined_namespace_routes ⇒ Object
Returns the value of attribute combined_namespace_routes.
-
.combined_namespaces ⇒ Object
Returns the value of attribute combined_namespaces.
-
.combined_routes ⇒ Object
Returns the value of attribute combined_routes.
Class Method Summary collapse
Class Attribute Details
.combined_namespace_identifiers ⇒ Object
Returns the value of attribute combined_namespace_identifiers.
24 25 26 |
# File 'lib/grape-swagger.rb', line 24 def combined_namespace_identifiers @combined_namespace_identifiers end |
.combined_namespace_routes ⇒ Object
Returns the value of attribute combined_namespace_routes.
24 25 26 |
# File 'lib/grape-swagger.rb', line 24 def combined_namespace_routes @combined_namespace_routes end |
.combined_namespaces ⇒ Object
Returns the value of attribute combined_namespaces.
24 25 26 |
# File 'lib/grape-swagger.rb', line 24 def combined_namespaces @combined_namespaces end |
.combined_routes ⇒ Object
Returns the value of attribute combined_routes.
24 25 26 |
# File 'lib/grape-swagger.rb', line 24 def combined_routes @combined_routes end |
Class Method Details
.add_swagger_documentation(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/grape-swagger.rb', line 26 def add_swagger_documentation( = {}) documentation_class = create_documentation_class version_for() = { target_class: self }.merge() @target_class = [:target_class] auth_wrapper = [:endpoint_auth_wrapper] || Class.new use auth_wrapper if auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper) documentation_class.setup() mount(documentation_class) @target_class.combined_routes = {} combine_routes(@target_class, documentation_class) @target_class.combined_namespaces = {} combine_namespaces(@target_class) @target_class.combined_namespace_routes = {} @target_class.combined_namespace_identifiers = {} combine_namespace_routes(@target_class.combined_namespaces) exclusive_route_keys = @target_class.combined_routes.keys - @target_class.combined_namespaces.keys exclusive_route_keys.each do |key| @target_class.combined_namespace_routes[key] = @target_class.combined_routes[key] end documentation_class end |