Class: Aptible::CLI::Agent
- Inherits:
-
Thor
- Object
- Thor
- Aptible::CLI::Agent
- Includes:
- Helpers::Token, Subcommands::Apps, Subcommands::Config, Subcommands::DB, Subcommands::Rebuild, Subcommands::Restart, Subcommands::SSH, Thor::Actions
- Defined in:
- lib/aptible/cli/agent.rb
Instance Method Summary collapse
Methods included from Subcommands::SSH
Methods included from Subcommands::Restart
Methods included from Subcommands::Rebuild
Methods included from Subcommands::DB
Methods included from Subcommands::Config
Methods included from Subcommands::Apps
Methods included from Helpers::Token
#current_token_hash, #fetch_token, #save_token, #token_file
Instance Method Details
#login ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/aptible/cli/agent.rb', line 38 def login email = [:email] || ask('Email: ') password = [:password] || ask('Password: ', echo: false) puts '' begin token = Aptible::Auth::Token.create(email: email, password: password) rescue OAuth2::Error raise Thor::Error, 'Could not authenticate with given credentials' end save_token(token.access_token) puts "Token written to #{token_file}" end |