Class: Aptible::CLI::Agent
- Inherits:
-
Thor
- Object
- Thor
- Aptible::CLI::Agent
- Includes:
- Helpers::Token, Subcommands::Config, Subcommands::SSH, Thor::Actions
- Defined in:
- lib/aptible/cli/agent.rb
Instance Method Summary collapse
Methods included from Subcommands::SSH
Methods included from Subcommands::Config
Methods included from Helpers::Token
#current_token_hash, #fetch_token, #save_token, #token_file
Instance Method Details
#login ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/aptible/cli/agent.rb', line 27 def login email = ask('Email: ') 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 |