Module: ThreeScaleToolbox::Command

Included in:
ThreeScaleToolbox::Commands::AccountCommand, ThreeScaleToolbox::Commands::AccountCommand::Find::FindSubcommand, ThreeScaleToolbox::Commands::ActiveDocsCommand, ThreeScaleToolbox::Commands::ActiveDocsCommand::Apply::ApplySubcommand, ThreeScaleToolbox::Commands::ActiveDocsCommand::Create::CreateSubcommand, ThreeScaleToolbox::Commands::ActiveDocsCommand::Delete::DeleteSubcommand, ThreeScaleToolbox::Commands::ActiveDocsCommand::List::ListSubcommand, ThreeScaleToolbox::Commands::ApplicationCommand, ThreeScaleToolbox::Commands::ApplicationCommand::Apply::ApplySubcommand, ThreeScaleToolbox::Commands::ApplicationCommand::Create::CreateSubcommand, ThreeScaleToolbox::Commands::ApplicationCommand::Delete::DeleteSubcommand, ThreeScaleToolbox::Commands::ApplicationCommand::List::ListSubcommand, ThreeScaleToolbox::Commands::ApplicationCommand::Show::ShowSubcommand, ThreeScaleToolbox::Commands::BackendCommand, ThreeScaleToolbox::Commands::BackendCommand::CopySubcommand, ThreeScaleToolbox::Commands::CopyCommand, ThreeScaleToolbox::Commands::CopyCommand::ServiceSubcommand, ThreeScaleToolbox::Commands::HelpCommand, ThreeScaleToolbox::Commands::ImportCommand, ThreeScaleToolbox::Commands::ImportCommand::ImportCsvSubcommand, ThreeScaleToolbox::Commands::ImportCommand::OpenAPI::OpenAPISubcommand, ThreeScaleToolbox::Commands::MethodsCommand, ThreeScaleToolbox::Commands::MethodsCommand::Apply::ApplySubcommand, ThreeScaleToolbox::Commands::MethodsCommand::Create::CreateSubcommand, ThreeScaleToolbox::Commands::MethodsCommand::Delete::DeleteSubcommand, ThreeScaleToolbox::Commands::MethodsCommand::List::ListSubcommand, ThreeScaleToolbox::Commands::MetricsCommand, ThreeScaleToolbox::Commands::MetricsCommand::Apply::ApplySubcommand, ThreeScaleToolbox::Commands::MetricsCommand::Create::CreateSubcommand, ThreeScaleToolbox::Commands::MetricsCommand::Delete::DeleteSubcommand, ThreeScaleToolbox::Commands::MetricsCommand::List::ListSubcommand, ThreeScaleToolbox::Commands::PlansCommand, ThreeScaleToolbox::Commands::PlansCommand::Apply::ApplySubcommand, ThreeScaleToolbox::Commands::PlansCommand::Create::CreateSubcommand, ThreeScaleToolbox::Commands::PlansCommand::Delete::DeleteSubcommand, ThreeScaleToolbox::Commands::PlansCommand::Export::ExportSubcommand, ThreeScaleToolbox::Commands::PlansCommand::Import::ImportSubcommand, ThreeScaleToolbox::Commands::PlansCommand::List::ListSubcommand, ThreeScaleToolbox::Commands::PlansCommand::Show::ShowSubcommand, ThreeScaleToolbox::Commands::PolicyRegistryCommand, ThreeScaleToolbox::Commands::PolicyRegistryCommand::Copy::CopySubcommand, ThreeScaleToolbox::Commands::ProductCommand, ThreeScaleToolbox::Commands::ProductCommand::CopySubcommand, ThreeScaleToolbox::Commands::ProxyConfigCommand, ThreeScaleToolbox::Commands::ProxyConfigCommand::Export::ExportSubcommand, ThreeScaleToolbox::Commands::ProxyConfigCommand::List::ListSubcommand, ThreeScaleToolbox::Commands::ProxyConfigCommand::Promote::PromoteSubcommand, ThreeScaleToolbox::Commands::ProxyConfigCommand::Show::ShowSubcommand, ThreeScaleToolbox::Commands::RemoteCommand::RemoteAddSubcommand, ThreeScaleToolbox::Commands::RemoteCommand::RemoteCommand, ThreeScaleToolbox::Commands::RemoteCommand::RemoteListSubcommand, ThreeScaleToolbox::Commands::RemoteCommand::RemoteRemoveSubcommand, ThreeScaleToolbox::Commands::RemoteCommand::RemoteRenameSubcommand, ThreeScaleToolbox::Commands::ServiceCommand, ThreeScaleToolbox::Commands::ServiceCommand::ApplySubcommand, ThreeScaleToolbox::Commands::ServiceCommand::CopySubcommand, ThreeScaleToolbox::Commands::ServiceCommand::CreateSubcommand, ThreeScaleToolbox::Commands::ServiceCommand::DeleteSubcommand, ThreeScaleToolbox::Commands::ServiceCommand::ListSubcommand, ThreeScaleToolbox::Commands::ServiceCommand::ShowSubcommand, ThreeScaleToolbox::Commands::ThreeScaleCommand, ThreeScaleToolbox::Commands::UpdateCommand, ThreeScaleToolbox::Commands::UpdateCommand::ServiceSubcommand
Defined in:
lib/3scale_toolbox/base_command.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/3scale_toolbox/base_command.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#configObject



33
34
35
# File 'lib/3scale_toolbox/base_command.rb', line 33

def config
  @config ||= ThreeScaleToolbox::Configuration.new(config_file)
end

#config_fileObject



37
38
39
# File 'lib/3scale_toolbox/base_command.rb', line 37

def config_file
  options[:'config-file']
end

#exit_with_message(message) ⇒ Object



61
62
63
# File 'lib/3scale_toolbox/base_command.rb', line 61

def exit_with_message(message)
  raise ThreeScaleToolbox::Error, message
end

#fetch_required_option(key) ⇒ Object



65
66
67
# File 'lib/3scale_toolbox/base_command.rb', line 65

def fetch_required_option(key)
  options.fetch(key) { exit_with_message "error: Missing argument #{key}" }
end

#remotesObject



41
42
43
# File 'lib/3scale_toolbox/base_command.rb', line 41

def remotes
  @remotes ||= Remotes.new(config)
end

#threescale_client(str) ⇒ Object

Input param can be endpoint url or remote name



48
49
50
# File 'lib/3scale_toolbox/base_command.rb', line 48

def threescale_client(str)
  ThreeScaleClientFactory.get(remotes, str, verify_ssl, verbose)
end

#verboseObject



57
58
59
# File 'lib/3scale_toolbox/base_command.rb', line 57

def verbose
  options[:verbose]
end

#verify_sslObject



52
53
54
55
# File 'lib/3scale_toolbox/base_command.rb', line 52

def verify_ssl
  # this is flag. It is either true or false. Cannot be nil
  !options[:insecure]
end