Sha256: 1f28e1fe97f1b8e1c734c23eed89b3e4b32a32427f1db65dedcfc308fbeeed41

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

module ThreeScaleToolbox
  module Commands
    module ServiceCommand
      module CopyCommand
        class DestroyMappingRulesTask
          attr_reader :context

          def initialize(context)
            @context = context
          end

          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

          private

          def delete_mapping_rules
            context.fetch(:delete_mapping_rules, false)
          end

          def target
            context[:target]
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
3scale_toolbox-0.17.1 lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb
3scale_toolbox-0.17.0 lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb
3scale_toolbox-0.16.0 lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb