Sha256: 9d49937748c2f04eabceed6b19a159cb701484501e49f66c20f618c7d1b75267
Contents?: true
Size: 768 Bytes
Versions: 92
Compression:
Stored size: 768 Bytes
Contents
require 'flydata/command/base' module Flydata module Command class Login < Base LOGIN_TRIAL_TIMES=3 def run ret = login(LOGIN_TRIAL_TIMES) raise "Login failed #{LOGIN_TRIAL_TIMES} times." unless ret ret end private def login(times=3) 1.upto(times) do |i| begin return true if login_once rescue Exception => e puts e end end false end def login_once email = ask("FlyData Email: ") password = ask("FlyData password: ") {|q| q.echo = false} flydata.post('/users/sign_in', {:user => email, :password =>password}) puts 'Thank you for logging in' true end end end end
Version data entries
92 entries across 92 versions & 1 rubygems