module ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::Task

Attributes

context[R]

Public Class Methods

new(context) click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 8
def initialize(context)
  @context = context
end

Public Instance Methods

activedocs_report() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 74
def activedocs_report
  report['activedocs'] ||= {}
end
delete_mapping_rules() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 31
def delete_mapping_rules
  context.fetch(:delete_mapping_rules, false)
end
find_source_service() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 16
def find_source_service
  Entities::Service.find(remote: source_remote, ref: source_service_ref).tap do |svc|
    raise ThreeScaleToolbox::Error, "Service #{source_service_ref} does not exist" if svc.nil?
  end
end
force_delete_mapping_rules() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 35
def force_delete_mapping_rules
  context[:delete_mapping_rules] = true
end
logger() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 64
def logger
  context[:logger] ||= Logger.new($stdout).tap do |logger|
    logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
  end
end
option_target_system_name() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 60
def option_target_system_name
  context[:option_target_system_name]
end
plans_report() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 70
def plans_report
  report['application_plans'] ||= {}
end
report() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 78
def report
  context[:report] ||= {}
end
source() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 12
def source
  context[:source] ||= find_source_service
end
source_metrics_and_methods() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 39
def source_metrics_and_methods
  source.metrics + source.methods
end
source_remote() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 47
def source_remote
  context[:source_remote]
end
source_service_ref() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 55
def source_service_ref
  context[:source_service_ref] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'source_service_ref not found'
end
target() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 22
def target
  context[:target] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'Target service should have been created or updated'
end
target=(target) click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 27
def target=(target)
  context[:target] = target
end
target_metrics_and_methods() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 43
def target_metrics_and_methods
  target.metrics + target.methods
end
target_remote() click to toggle source
# File lib/3scale_toolbox/commands/service_command/copy_command/task.rb, line 51
def target_remote
  context[:target_remote]
end