Class: ThreeScaleToolbox::Commands::PlansCommand::Export::ReadPlanPricingRulesStep

Inherits:
Object
  • Object
show all
Includes:
Step
Defined in:
lib/3scale_toolbox/commands/plans_command/export/read_plan_pricing_rules_step.rb

Instance Attribute Summary

Attributes included from Step

#context

Instance Method Summary collapse

Methods included from Step

#file, #initialize, #metric_info, #plan, #plan_system_name, #result, #service, #service_methods, #service_metrics, #service_system_name, #threescale_client

Instance Method Details

#callObject

Reads Application Plan pricing rules add metric system_name out of metric_id



10
11
12
13
14
15
# File 'lib/3scale_toolbox/commands/plans_command/export/read_plan_pricing_rules_step.rb', line 10

def call
  result[:pricingrules] = plan.pricing_rules.map do |pr|
    pr.merge('metric' => metric_info(pr, 'PricingRule'),
             'cost_per_unit' => pr.fetch('cost_per_unit').to_f)
  end
end