Module: ThreeScaleToolbox::Commands::BackendCommand::CopyCommand::Task

Included in:
CopyMappingRulesTask, CopyMethodsTask, CopyMetricsTask, CreateOrUpdateTargetBackendTask
Defined in:
lib/3scale_toolbox/commands/backend_command/copy_command/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



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

def context
  @context
end

Instance Method Details

#callObject



12
13
14
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 12

def call
  run
end

#initialize(context) ⇒ Object



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

def initialize(context)
  @context = context
end

#invalidate_target_methodsObject



53
54
55
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 53

def invalidate_target_methods
  context[:target_methods] = nil
end

#invalidate_target_metricsObject



57
58
59
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 57

def invalidate_target_metrics
  context[:target_metrics] = nil
end

#option_target_system_nameObject



74
75
76
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 74

def option_target_system_name
  context[:option_target_system_name]
end

#source_backendObject



25
26
27
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 25

def source_backend
  context[:source_backend] ||= find_source_backend
end

#source_backend_refObject



69
70
71
72
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 69

def source_backend_ref
  context[:source_backend_ref] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'source_backend_ref not found'
end

#source_hitsObject



33
34
35
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 33

def source_hits
  context[:source_hits] ||= source_backend.hits
end

#source_methodsObject



29
30
31
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 29

def source_methods
  context[:source_methods] ||= source_backend.methods(source_hits)
end

#source_metricsObject



37
38
39
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 37

def source_metrics
  context[:source_metrics] ||= source_backend.metrics
end

#source_remoteObject



61
62
63
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 61

def source_remote
  context[:source_remote]
end

#target_backendObject



20
21
22
23
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 20

def target_backend
  context[:target_backend] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'Target backend should have been created or updated'
end

#target_backend=(target) ⇒ Object



16
17
18
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 16

def target_backend=(target)
  context[:target_backend] = target
end

#target_hitsObject



45
46
47
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 45

def target_hits
  context[:target_hits] ||= target_backend.hits
end

#target_methodsObject



49
50
51
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 49

def target_methods
  context[:target_methods] ||= target_backend.methods(target_hits)
end

#target_metricsObject



41
42
43
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 41

def target_metrics
  context[:target_metrics] ||= target_backend.metrics
end

#target_remoteObject



65
66
67
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 65

def target_remote
  context[:target_remote]
end