Class: EYCli::Controller::Accounts
- Inherits:
-
Object
- Object
- EYCli::Controller::Accounts
- Defined in:
- lib/ey_cli/controllers/accounts.rb
Instance Method Summary collapse
Instance Method Details
#fetch_account(name = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ey_cli/controllers/accounts.rb', line 4 def fetch_account(name = nil) accounts = fetch_accounts if name EYCli::Model::Account.find_by_name(name, accounts) else return accounts.first if accounts.empty? || accounts.size == 1 name = EYCli.term.choose_resource(accounts, "I don't know which account you want to use.", 'Please, select an account:') EYCli::Model::Account.find_by_name(name, accounts) end end |