Module: Uffizzi::AuthHelper

Defined in:
lib/uffizzi/auth_helper.rb

Class Method Summary collapse

Class Method Details

.check_login(project_option = nil) ⇒ Object

Raises:



19
20
21
22
# File 'lib/uffizzi/auth_helper.rb', line 19

def (project_option = nil)
  raise Uffizzi::Error.new('You are not logged in. Run `uffizzi login`.') unless signed_in?
  raise Uffizzi::Error.new('This command needs project to be set in config file') unless project_set?(project_option)
end

.sign_outObject



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

def sign_out
  return unless Uffizzi::ConfigFile.exists?

  Uffizzi::ConfigFile.unset_option(:cookie)
  Uffizzi::ConfigFile.unset_option(:account)
  Uffizzi::ConfigFile.unset_option(:project)
  Uffizzi::Token.delete if Uffizzi::Token.exists?
end

.signed_in?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/uffizzi/auth_helper.rb', line 6

def signed_in?
  config_data_exists? && authorized?
end