Class: ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::DestroyMappingRulesTask

Inherits:
Object
  • Object
show all
Defined in:
lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ DestroyMappingRulesTask

Returns a new instance of DestroyMappingRulesTask.



8
9
10
# File 'lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb', line 8

def initialize(context)
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb', line 6

def context
  @context
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
# File 'lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb', line 12

def call
  return unless delete_mapping_rules

  puts 'destroying all mapping rules'
  target.mapping_rules.each do |mapping_rule|
    target.delete_mapping_rule mapping_rule['id']
  end
end