class ThreeScaleToolbox::Commands::ServiceCommand::ShowSubcommand

Constants

FIELDS

Public Class Methods

command() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 13
def self.command
  Cri::Command.define do
    name        'show'
    usage       'show <remote> <service-id_or_system-name>'
    summary     'Show the information of a service'
    description "Show the information of a service"

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

    runner ShowSubcommand
  end
end

Public Instance Methods

run() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 28
def run
  printer.print_record service.attrs
end

Private Instance Methods

find_service() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 46
def find_service
  Entities::Service::find(remote: remote, ref: ref).tap do |svc|
    raise ThreeScaleToolbox::Error, "Service #{ref} does not exist" if svc.nil?
  end
end
printer() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 52
def printer
  options.fetch(:output, CLI::CustomTablePrinter.new(FIELDS))
end
ref() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 38
def ref
  @ref ||= arguments[:service_id_or_system_name]
end
remote() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 34
def remote
  @remote ||= threescale_client(arguments[:remote])
end
service() click to toggle source
# File lib/3scale_toolbox/commands/service_command/show_command.rb, line 42
def service
  @service ||= find_service
end