class ThreeScaleToolbox::Commands::BackendCommand::CopyCommand::CopyMetricsTask

Public Instance Methods

run() click to toggle source

entrypoint

# File lib/3scale_toolbox/commands/backend_command/copy_command/copy_metrics_task.rb, line 9
def run
  missing_metrics.each(&method(:create_metric))
  logger.info "created #{missing_metrics.size} missing metrics"
  report['missing_metrics_created'] = missing_metrics.size
end

Private Instance Methods

create_metric(metric) click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/copy_metrics_task.rb, line 17
def create_metric(metric)
  Entities::BackendMetric.create(backend: target_backend, attrs: metric.attrs)
end
missing_metrics() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/copy_metrics_task.rb, line 21
def missing_metrics
  @missing_metrics ||= ThreeScaleToolbox::Helper.array_difference(source_backend.metrics, target_backend.metrics) do |s_m, t_m|
    s_m.system_name == t_m.system_name
  end
end