class ThreeScaleToolbox::Commands::PlansCommand::Export::ReadPlanMethods
Public Instance Methods
call()
click to toggle source
Compute unique list of methods from limits and pricingrules
# File lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb, line 9 def call methods = [ limit_methods, pricingrule_methods ] result[:plan_methods] = methods.each_with_object({}) { |elem, acc| acc.merge!(elem) } end
Private Instance Methods
filtered_limit_methods()
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb, line 28 def filtered_limit_methods result[:limits].select { |limit| limit.dig('metric', 'type') == 'method' } end
filtered_pricing_rule_methods()
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb, line 40 def filtered_pricing_rule_methods result[:pricingrules].select { |limit| limit.dig('metric', 'type') == 'method' } end
limit_methods()
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb, line 19 def limit_methods # multiple limits can reference the same method filtered_limit_methods.each_with_object({}) do |elem, acc| # find_method should not return nil. # It is assumed that metric_id refers to existing element from previous steps acc[elem['metric_id']] = find_method(elem['metric_id']).attrs end end
pricingrule_methods()
click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb, line 32 def pricingrule_methods filtered_pricing_rule_methods.each_with_object({}) do |elem, acc| # find_method should not return nil. # It is assumed that metric_id refers to existing element from previous steps acc[elem['metric_id']] = find_method(elem['metric_id']).attrs end end