class ThreeScaleToolbox::Commands::AccountCommand::Find::FindSubcommand

Public Class Methods

command() click to toggle source
# 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

Public Instance Methods

run() click to toggle source
# 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