Class: FIS::CLI::Commands::Whoami

Inherits:
FIS::Command show all
Defined in:
lib/fis/cli/commands/whoami.rb

Overview

‘auth whoami` - Requests details about the authenitcated user

Instance Method Summary collapse

Methods inherited from FIS::Command

#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fis/cli/commands/whoami.rb', line 8

def execute
  user = FIS.client.user.me

  FIS.ui.newline
  
  FIS.ui.ok 'Account Information:'
  FIS.ui.newline
  FIS.ui.print_table([
    ['Name:', user.full_name],
    ['Email:', user.email],
    ['Username:', user.username],
    ['Flatiron UUID:', user.learn_uuid],
    ['GitHub User ID:', user.github_uid.to_s] # .to_s for appropriate formatting
  ])

  FIS.ui.newline

  FIS.ui.ok 'Account Status:'
  FIS.ui.newline
  FIS.ui.print_table([
    ['Verified?', user.learn_verified_user],
    ['Can Start Working?', user.can_start_working]
  ])
end