Method: WePredict::CLI::User#delete

Defined in:
lib/wepredict/cli/user.rb

#delete(email) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/wepredict/cli/user.rb', line 43

def delete(email)
  confirm = yes?("Are you sure you want to close your account? This is non-reversable (y/n):")

  if !confirm
    say "Phew, almost lost you there!" 
    exit
  end

  begin
    password = capture_password
    WePredict::User.delete(:email => email, :password => password)
  rescue WePredict::Errors::AccessDenied => e
    say e.message, :red
    retry
  end
  
  say "Sucessfully closed your WePredict account", :green
end