Class: LearnConfig::CLI
- Inherits:
-
Object
- Object
- LearnConfig::CLI
- Defined in:
- lib/learn_config/cli.rb
Instance Attribute Summary collapse
-
#github_username ⇒ Object
readonly
Returns the value of attribute github_username.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #ask_for_oauth_token(short_text: false, retries_remaining: 5) ⇒ Object
-
#initialize(github_username) ⇒ CLI
constructor
A new instance of CLI.
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_username ⇒ Object (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 |
#token ⇒ Object
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" |