Module: ThreeScaleToolbox::Commands::ImportCommand::OpenAPI::MappingRule
- Included in:
- Operation
- Defined in:
- lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb
Instance Method Summary collapse
- #delta ⇒ Object
- #http_method ⇒ Object
- #mapping_rule ⇒ Object
- #metric_id ⇒ Object
- #pattern ⇒ Object
- #public_base_path ⇒ Object
- #raw_pattern ⇒ Object
Instance Method Details
#delta ⇒ Object
35 36 37 |
# File 'lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb', line 35 def delta 1 end |
#http_method ⇒ Object
15 16 17 |
# File 'lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb', line 15 def http_method operation[:verb].upcase end |
#mapping_rule ⇒ Object
6 7 8 9 10 11 12 13 |
# 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 ⇒ Object
39 40 41 |
# File 'lib/3scale_toolbox/commands/import_command/openapi/mapping_rule.rb', line 39 def metric_id operation[:metric_id] end |
#pattern ⇒ Object
19 20 21 22 23 |
# 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 ⇒ Object
30 31 32 33 |
# 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 ⇒ Object
25 26 27 28 |
# 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 |