Sha256: 5df11a7c7945c827af3192bf212424c8bed462af72479067cf46828826d743cf

Contents?: true

Size: 773 Bytes

Versions: 12

Compression:

Stored size: 773 Bytes

Contents

module ThreeScaleToolbox
  module Tasks
    module Helper
      def metrics_mapping(source_metrics, target_metrics)
        target_metrics.map do |target|
          source = source_metrics.find do |m|
            ThreeScaleToolbox::Helper.compare_hashes(m, target, ['system_name'])
          end || {}

          [source['id'], target['id']]
        end.to_h
      end

      def application_plan_mapping(source_app_plans, target_app_plans)
        mapping = target_app_plans.map do |target|
          source = source_app_plans.find do |app_plan|
            ThreeScaleToolbox::Helper.compare_hashes(app_plan, target, ['system_name'])
          end || {}
          [source['id'], target]
        end
        mapping.reject { |key, _| key.nil? }
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
3scale_toolbox-0.15.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.14.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.13.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.12.4 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.12.3 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.12.2 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.11.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.10.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.9.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.8.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.7.0 lib/3scale_toolbox/tasks/helper_task.rb
3scale_toolbox-0.6.0 lib/3scale_toolbox/tasks/helper_task.rb