Class: Strobe::Account
- Inherits:
-
Object
- Object
- Strobe::Account
- Defined in:
- lib/strobe/account.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Account
constructor
we don’t need the account for anything yet, so leave it.
Constructor Details
#initialize(json) ⇒ Account
we don’t need the account for anything yet, so leave it
45 46 |
# File 'lib/strobe/account.rb', line 45 def initialize(json) end |
Class Method Details
.login ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/strobe/account.rb', line 35 def self.login email, pass = ask_for_login response = HTTP.new.login(email, pass) persist_details(*response) Strobe.ui.info "You are now logged in as #{email}" end |
.signup ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/strobe/account.rb', line 20 def self.signup while true email, pass = ask_for_login passc = Strobe.ui.password "Repeat Password: " break if pass == passc Strobe.ui.info "The password and confirmation do not match. Please try again." end response = HTTP.new.signup(email, pass) persist_details(*response) Strobe.ui.info "Your account was created successfully." end |
.signup_or_login ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/strobe/account.rb', line 6 def self.signup_or_login Strobe.ui.info "You aren't logged in with a Strobe user on this machine" Strobe.ui.info " 1. Create a new Strobe user" Strobe.ui.info " 2. Log in with an existing Strobe user" option = Strobe.ui.ask "Please select an option: " case option when "1" signup when "2" login end end |