class ThreeScaleToolbox::Commands::PlansCommand::List::ListSubcommand

Constants

FIELDS

Public Class Methods

command() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 10
def self.command
  Cri::Command.define do
    name        'list'
    usage       'list [opts] <remote> <service>'
    summary     'list application plans'
    description 'List application plans'

    ThreeScaleToolbox::CLI.output_flag(self)
    param       :remote
    param       :service_ref

    runner ListSubcommand
  end
end

Public Instance Methods

run() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 25
def run
  printer.print_collection service.plans.map(&:attrs)
end

Private Instance Methods

find_service() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 35
def find_service
  Entities::Service.find(remote: remote,
                         ref: service_ref).tap do |svc|
    raise ThreeScaleToolbox::Error, "Service #{service_ref} does not exist" if svc.nil?
  end
end
printer() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 50
def printer
  # keep backwards compatibility
  options.fetch(:output, CLI::CustomTablePrinter.new(FIELDS))
end
remote() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 42
def remote
  @remote ||= threescale_client(arguments[:remote])
end
service() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 31
def service
  @service ||= find_service
end
service_ref() click to toggle source
# File lib/3scale_toolbox/commands/plans_command/list_command.rb, line 46
def service_ref
  arguments[:service_ref]
end