module ThreeScaleToolbox::Commands::ImportCommand::OpenAPI::MappingRule

Public Instance Methods

delta() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 35
def delta
  1
end
http_method() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 15
def http_method
  operation[:verb].upcase
end
mapping_rule() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 6
def mapping_rule
  {
    'pattern' => pattern,
    'http_method' => http_method,
    'delta' => delta,
    'metric_id' => metric_id
  }
end
metric_id() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 39
def metric_id
  operation[:metric_id]
end
pattern() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 19
def pattern
  res = "#{raw_pattern}"
  res = "#{res}$" if !operation[:prefix_matching] # apply strict matching
  res
end
public_base_path() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 30
def public_base_path
  # remove the last slash of the basePath
  operation[:public_base_path].gsub(%r{/$}, '')
end
raw_pattern() click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb, line 25
def raw_pattern
  # According OAS 2.0: path MUST begin with a slash
  "#{public_base_path}#{operation[:path]}"
end