Module: RubyAem::Swagger

Defined in:
lib/ruby_aem/swagger.rb

Overview

Swagger module contains logic related to swagger_aem.

Class Method Summary collapse

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.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ruby_aem/swagger.rb', line 55

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'
  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.



46
47
48
# File 'lib/ruby_aem/swagger.rb', line 46

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
# File 'lib/ruby_aem/swagger.rb', line 37

def Swagger.property_to_parameter(property)
  property.gsub(/\./, '_')
end