Module: Birdy::Authentication

Included in:
Base
Defined in:
lib/birdy/authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/birdy/authentication.rb', line 4

def authenticate
  @config = Config.new
  @auth = @config.read

  @twitter = Twitter::Client.new

  while @twitter.authenticate?(@auth[:login], @auth[:password]) == false
    @config.delete

    hl = HighLine.new
     = hl.ask("login: ") {|q| q.readline = true }
    password = hl.ask("password: ") {|q| q.echo = '*'}
    @config.write(, password)

    @auth = @config.read
  end
   
  Twitter::Client.new(:login => @auth[:login], :password => @auth[:password])
end