Module: RubyAem::Swagger
- Defined in:
- lib/ruby_aem/swagger.rb
Overview
Swagger module contains logic related to swagger_aem.
Class Method Summary collapse
-
.config_node_name_to_config_name(config_node_name) ⇒ Object
Given a config node name, return the corresponding OSGI config name.
-
.operation_to_method(operation) ⇒ Object
Convert ruby_aem spec’s operation (consistent with Swagger spec’s operationId) into swagger_aem’s generated method name.
-
.path(path) ⇒ Object
Sanitise path value by removing leading and trailing slashes swagger_aem accepts paths without those slashes.
-
.property_to_parameter(property) ⇒ Object
Convert ruby_aem spec’s property name (by replacing dots with underscores) into swagger_aem’s generated parameter name.
Class Method Details
.config_node_name_to_config_name(config_node_name) ⇒ Object
Given a config node name, return the corresponding OSGI config name. OSGI config name are available from AEM Web Console’s Config Manager page.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ruby_aem/swagger.rb', line 59 def Swagger.config_node_name_to_config_name(config_node_name) case config_node_name when 'org.apache.felix.http' 'Apache Felix Jetty Based HTTP Service' when 'org.apache.sling.servlets.get.DefaultGetServlet' 'Apache Sling GET Servlet' when 'org.apache.sling.security.impl.ReferrerFilter' 'Apache Sling Referrer Filter' when 'org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet' 'Apache Sling DavEx Servlet' when 'com.shinesolutions.aem.passwordreset.Activator' 'AEM Password Reset Activator' when 'com.shinesolutions.healthcheck.hc.impl.ActiveBundleHealthCheck' 'AEM Health Check Servlet' else nil end end |
.operation_to_method(operation) ⇒ Object
Convert ruby_aem spec’s operation (consistent with Swagger spec’s operationId) into swagger_aem’s generated method name.
26 27 28 29 30 |
# File 'lib/ruby_aem/swagger.rb', line 26 def Swagger.operation_to_method(operation) operation.gsub(/[A-Z]/) { |char| '_' + char.downcase } end |
.path(path) ⇒ Object
Sanitise path value by removing leading and trailing slashes swagger_aem accepts paths without those slashes.
50 51 52 |
# File 'lib/ruby_aem/swagger.rb', line 50 def Swagger.path(path) path.gsub(/^\//, '').gsub(/\/$/, '') end |
.property_to_parameter(property) ⇒ Object
Convert ruby_aem spec’s property name (by replacing dots with underscores) into swagger_aem’s generated parameter name.
37 38 39 40 41 42 43 |
# File 'lib/ruby_aem/swagger.rb', line 37 def Swagger.property_to_parameter(property) if (['alias'].include? property) "_#{property}" else property.gsub(/\./, '_').gsub(/-/, '_') end end |