Class: Aptible::CLI::Agent
Instance Method Summary
collapse
included
included
included
included
included
included
included
#current_token_hash, #fetch_token, #save_token, #token_file
Instance Method Details
#login ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/aptible/cli/agent.rb', line 40
def login
email = options[:email] || ask('Email: ')
password = options[: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
|
#version ⇒ Object
33
34
35
|
# File 'lib/aptible/cli/agent.rb', line 33
def version
puts "aptible-cli v#{Aptible::CLI::VERSION}"
end
|