Module: Hoot::Keychain

Defined in:
lib/hoot/keychain.rb

Class Method Summary collapse

Class Method Details

.authenticated?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
# File 'lib/hoot/keychain.rb', line 10

def self.authenticated?
  , password = @n['hedwig.herokuapp.com']

  if (.nil? ||  == 0) || (password.nil? || password == 0)
    return false
  end
  return true
end

.credentialsObject



19
20
21
22
23
24
# File 'lib/hoot/keychain.rb', line 19

def self.credentials
  if authenticated?
    return @n['hedwig.herokuapp.com']
  end
  nil
end

.destroyObject



31
32
33
34
35
# File 'lib/hoot/keychain.rb', line 31

def self.destroy
  @n['hedwig.herokuapp.com'] = 0, 0
  @n.save
  abort('You were logged out.')
end

.save(credentials) ⇒ Object



26
27
28
29
# File 'lib/hoot/keychain.rb', line 26

def self.save(credentials)
  @n['hedwig.herokuapp.com'] = credentials[0], credentials[1]
  @n.save
end