Module: ThreeScaleToolbox::Commands::PlansCommand::Export::Step

Included in:
ReadAppPlanStep, ReadPlanFeaturesStep, ReadPlanLimitsStep, ReadPlanMethods, ReadPlanMetrics, ReadPlanPricingRulesStep, WriteArtifactsStep
Defined in:
lib/3scale_toolbox/commands/plans_command/export/step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 12

def context
  @context
end

Instance Method Details

#fileObject



22
23
24
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 22

def file
  context[:file]
end

#initialize(context) ⇒ Object



14
15
16
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 14

def initialize(context)
  @context = context
end

#metric_info(elem, elem_name) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 48

def metric_info(elem, elem_name)
  if (method = find_method(elem.metric_id))
    { 'type' => 'method', 'system_name' => method.system_name }
  elsif (metric = find_metric(elem.metric_id))
    { 'type' => 'metric', 'system_name' => metric.system_name }
  else
    raise ThreeScaleToolbox::Error, "Unexpected error. #{elem_name} #{elem.id} " \
      "referencing to metric id #{elem.metric_id} which has not been found"
  end
end

#planObject



44
45
46
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 44

def plan
  context[:plan] ||= find_plan
end

#plan_system_nameObject

can be id or system_name



36
37
38
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 36

def plan_system_name
  context[:plan_system_name]
end

#resultObject



40
41
42
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 40

def result
  context[:result] ||= {}
end

#serviceObject



18
19
20
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 18

def service
  context[:service] ||= find_service
end

#service_system_nameObject

can be id or system_name



31
32
33
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 31

def service_system_name
  context[:service_system_name]
end

#threescale_clientObject



26
27
28
# File 'lib/3scale_toolbox/commands/plans_command/export/step.rb', line 26

def threescale_client
  context[:threescale_client]
end