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

.operation_to_method(operation) ⇒ Object

Convert ruby_aem spec’s operation (consistent with Swagger spec’s operationId) into swagger_aem’s generated method name.

Parameters:

  • operation

    operation ID

Returns:

  • swagger_aem 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.

Parameters:

  • path

    path name

Returns:

  • sanitised path name



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.

Parameters:

  • property

    property name

Returns:

  • swagger_aem parameter name



37
38
39
# File 'lib/ruby_aem/swagger.rb', line 37

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