class ThreeScaleToolbox::Commands::ApplicationCommand::Show::ShowSubcommand

Constants

FIELDS_TO_SHOW

Public Class Methods

command() click to toggle source
# File lib/3scale_toolbox/commands/application_command/show_command.rb, line 11
          def self.command
            Cri::Command.define do
              name        'show'
              usage       'show [opts] <remote> <application>'
              summary     'show application attributes'
              description <<-HEREDOC
              Show application attributes
              \n Application param allows:
              \n * User_key (API key)
              \n * App_id (from app_id/app_key pair) or Client ID (for OAuth and OpenID Connect authentication modes)
              \n * Application internal id
              HEREDOC

              ThreeScaleToolbox::CLI.output_flag(self)

              param       :remote
              param       :application

              runner ShowSubcommand
            end
          end

Public Instance Methods

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

Private Instance Methods

application() click to toggle source
# File lib/3scale_toolbox/commands/application_command/show_command.rb, line 39
def application
  @application ||= find_application
end
application_ref() click to toggle source
# File lib/3scale_toolbox/commands/application_command/show_command.rb, line 49
def application_ref
  arguments[:application]
end
find_application() click to toggle source
# File lib/3scale_toolbox/commands/application_command/show_command.rb, line 43
def find_application
  Entities::Application.find(remote: remote, ref: application_ref).tap do |app|
    raise ThreeScaleToolbox::Error, "Application #{application_ref} does not exist" if app.nil?
  end
end
printer() click to toggle source
# File lib/3scale_toolbox/commands/application_command/show_command.rb, line 57
def printer
  # keep backwards compatibility
  options.fetch(:output, CLI::CustomTablePrinter.new(FIELDS_TO_SHOW))
end
remote() click to toggle source
# File lib/3scale_toolbox/commands/application_command/show_command.rb, line 53
def remote
  @remote ||= threescale_client(arguments[:remote])
end