Class: ThreeScaleToolbox::Commands::AccountCommand::Find::FindSubcommand
- Inherits:
-
Cri::CommandRunner
- Object
- Cri::CommandRunner
- ThreeScaleToolbox::Commands::AccountCommand::Find::FindSubcommand
show all
- Includes:
- ThreeScaleToolbox::Command
- Defined in:
- lib/3scale_toolbox/commands/account_command/find_command.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl
Class Method Details
.command ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/3scale_toolbox/commands/account_command/find_command.rb', line 11
def self.command
Cri::Command.define do
name 'find'
usage 'find [opts] <remote> <text>'
summary 'find account'
description 'Find account by email, provider key or service token'
option :a, :'print-all', 'Print all the account info', argument: :forbidden
param :remote
param :text
runner FindSubcommand
end
end
|
Instance Method Details
#run ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/3scale_toolbox/commands/account_command/find_command.rb', line 26
def run
client = threescale_client(arguments[:remote])
account = ThreeScaleToolbox::Entities::Account.find_by_text(arguments[:text], client)
if account.nil?
puts 'Account not found'
return
end
account.verbose = options[:'print-all']
puts account
end
|