Sha256: c9b831510475ce2feb14e20a48768f5ca1d20582b1018871720e858faac98e9a
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
module ThreeScaleToolbox module Commands module PlansCommand module Import class ImportMetricsStep include Step ## # Writes Plan metrics and methods def call missing_metrics.each(&method(:create_metric)) missing_methods.each(&method(:create_method)) end private def missing_metrics ThreeScaleToolbox::Helper.array_difference(resource_metrics, service.metrics) do |a, b| a['system_name'] == b.system_name end end def missing_methods ThreeScaleToolbox::Helper.array_difference(resource_methods, service.methods) do |a, b| a['system_name'] == b.system_name end end def create_metric(metric_attrs) metric = ThreeScaleToolbox::Entities::Metric.create(service: service, attrs: metric_attrs) puts "Created metric: #{metric.attrs['system_name']}" end def create_method(method_attrs) method = ThreeScaleToolbox::Entities::Method.create(service: service, attrs: method_attrs) puts "Created method: #{method.attrs['system_name']}" end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems