Class: Blockspring::CLI::Command::Auth
- Defined in:
- lib/blockspring/cli/command/auth.rb
Overview
authentication (login, logout)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#index ⇒ Object
auth.
-
#login ⇒ Object
auth:login.
-
#logout ⇒ Object
auth:logout.
Methods inherited from Base
Methods included from Helpers
#display, #error, error_with_failure, error_with_failure=, #format_with_bang, #home_directory, #longest, #output_with_bang, #running_on_a_mac?, #running_on_windows?
Constructor Details
This class inherits a constructor from Blockspring::CLI::Command::Base
Instance Method Details
#index ⇒ Object
auth
Authenticate, display current user
10 11 12 13 14 15 |
# File 'lib/blockspring/cli/command/auth.rb', line 10 def index user, _key = Blockspring::CLI::Auth.get_credentials if user puts "You are logged in as #{user}" end end |
#login ⇒ Object
auth:login
log in with your blockspring credentials
Example:
$ blockspring auth:login Enter your Blockspring credentials: Username or email: [email protected] Password (typing will be hidden): You are logged in as example
29 30 31 32 33 34 |
# File 'lib/blockspring/cli/command/auth.rb', line 29 def login user, _key = Blockspring::CLI::Auth. if user puts "You are logged in as #{user}" end end |
#logout ⇒ Object
auth:logout
clear your blockspring credentials
Example:
$ blockspring auth:logout
44 45 46 47 |
# File 'lib/blockspring/cli/command/auth.rb', line 44 def logout Blockspring::CLI::Auth.delete_credentials puts "You have been logged out" end |