class ThreeScaleToolbox::Commands::ImportCommand::OpenAPI::CreateMethodsStep
Public Instance Methods
call()
click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/create_method_step.rb, line 8 def call missing_operations.each do |op| method = Entities::Method.create(service: service, attrs: op.method) op.set(:metric_id, method.id) end existing_operations.each do |op| method_attrs = methods_index.fetch(op.method['system_name']).attrs method = Entities::Method.new(id: method_attrs.fetch('id'), service: service) method.update(op.method) op.set(:metric_id, method.id) end end
Private Instance Methods
existing_operations()
click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/create_method_step.rb, line 34 def existing_operations operations.select { |op| methods_index.key? op.method['system_name'] } end
methods_index()
click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/create_method_step.rb, line 24 def methods_index @methods_index ||= service.methods.each_with_object({}) do |method, acc| acc[method.system_name] = method end end
missing_operations()
click to toggle source
# File lib/3scale_toolbox/commands/import_command/openapi/create_method_step.rb, line 30 def missing_operations operations.reject { |op| methods_index.key? op.method['system_name'] } end