class ThreeScaleToolbox::Commands::PlansCommand::Export::ExportSubcommand

Public Class Methods

command() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export_command.rb, line 17
def self.command
  Cri::Command.define do
    name        'export'
    usage       'export [opts] <remote> <service_system_name> <plan_system_name>'
    summary     'export application plan'
    description 'Export application plan, limits, pricing rules and features'

    option      :f, :file, 'Write to file instead of stdout', argument: :required
    param       :remote
    param       :service_system_name
    param       :plan_system_name

    runner ExportSubcommand
  end
end

Public Instance Methods

run() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export_command.rb, line 33
def run
  tasks = []
  tasks << ReadAppPlanStep.new(context)
  tasks << ReadPlanLimitsStep.new(context)
  tasks << ReadPlanPricingRulesStep.new(context)
  tasks << ReadPlanFeaturesStep.new(context)
  tasks << ReadPlanMethods.new(context)
  tasks << ReadPlanMetrics.new(context)
  tasks << WriteArtifactsStep.new(context)

  # run tasks
  tasks.each(&:call)
end

Private Instance Methods

context() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export_command.rb, line 49
def context
  @context ||= create_context
end
create_context() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/export_command.rb, line 53
def create_context
  {
    file: options[:file],
    threescale_client: threescale_client(arguments[:remote]),
    service_system_name: arguments[:service_system_name],
    plan_system_name: arguments[:plan_system_name],
  }
end