Class: LearnConfig::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/learn_config/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github_username) ⇒ CLI



6
7
8
# File 'lib/learn_config/cli.rb', line 6

def initialize(github_username)
  @github_username = github_username
end

Instance Attribute Details

#github_usernameObject (readonly)

Returns the value of attribute github_username.



3
4
5
# File 'lib/learn_config/cli.rb', line 3

def github_username
  @github_username
end

#tokenObject

Returns the value of attribute token.



4
5
6
# File 'lib/learn_config/cli.rb', line 4

def token
  @token
end

Instance Method Details

#ask_for_oauth_token(short_text: false, retries_remaining: 5) ⇒ Object



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

def ask_for_oauth_token(short_text: false, retries_remaining: 5)
  if !short_text
    puts "In order to receive credit for your work, you will need to configure\nthe Learn gem with an OAuth token. You can find yours in Base at:\n  https://base.flatironschool.com/account/manage\n\n    LONG\n\n    print 'Once you have it, please come back here and paste it in: '\n  elsif retries_remaining > 0\n    print \"Hmm...that token doesn't seem to be correct. Please try again: \"\n  else\n    puts \"Sorry, you've tried too many times. Please check your token and try again later.\"\n    exit\n  end\n\n  self.token = gets.chomp\n\n  verify_token_or_ask_again!(retries_remaining: retries_remaining)\nend\n"