Class: Qtc::Cli::Platform::User

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/qtc/cli/platform/user.rb

Instance Method Summary collapse

Methods included from Common

#base_url, #client, #extract_app_in_dir, #ini_filename, #inifile, #instance_info, #platform_base_url, #platform_client

Instance Method Details

#loginObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/qtc/cli/platform/user.rb', line 8

def 
  pass = password("Personal Access Token (copy from https://console.qtcloudservices.com/#/user/profile):")
  inifile['platform']['token'] = pass

  response = platform_client(pass).get('/user/accounts', {}) rescue nil
  if response
    inifile.save(filename: ini_filename)
  else
    print color('Invalid Personal Access Token', :red)
  end
end

#logoutObject



20
21
22
23
# File 'lib/qtc/cli/platform/user.rb', line 20

def logout
  inifile['platform'].delete('token')
  inifile.save(filename: ini_filename)
end