class ThreeScaleToolbox::Commands::PlansCommand::Import::ImportMetricsStep
Public Instance Methods
call()
click to toggle source
Writes Plan metrics and methods
# File lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb, line 9 def call missing_metrics.each(&method(:create_metric)) missing_methods.each(&method(:create_method)) end
Private Instance Methods
create_method(method_attrs)
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb, line 33 def create_method(method_attrs) method = ThreeScaleToolbox::Entities::Method.create(service: service, attrs: method_attrs) puts "Created method: #{method.attrs['system_name']}" end
create_metric(metric_attrs)
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb, line 28 def create_metric(metric_attrs) metric = ThreeScaleToolbox::Entities::Metric.create(service: service, attrs: metric_attrs) puts "Created metric: #{metric.attrs['system_name']}" end
missing_methods()
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb, line 22 def missing_methods ThreeScaleToolbox::Helper.array_difference(resource_methods, service.methods) do |a, b| a['system_name'] == b.system_name end end
missing_metrics()
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb, line 16 def missing_metrics ThreeScaleToolbox::Helper.array_difference(resource_metrics, service.metrics) do |a, b| a['system_name'] == b.system_name end end