Class: Octopolo::Scripts::GithubAuth

Inherits:
Object
  • Object
show all
Includes:
CLIWrapper, UserConfigWrapper
Defined in:
lib/octopolo/scripts/github_auth.rb

Instance Attribute Summary collapse

Attributes included from UserConfigWrapper

#user_config

Attributes included from CLIWrapper

#cli

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_responseObject

Returns the value of attribute auth_response.



13
14
15
# File 'lib/octopolo/scripts/github_auth.rb', line 13

def auth_response
  @auth_response
end

#passwordObject

Returns the value of attribute password.



12
13
14
# File 'lib/octopolo/scripts/github_auth.rb', line 12

def password
  @password
end

#user_defined_tokenObject

Returns the value of attribute user_defined_token.



14
15
16
# File 'lib/octopolo/scripts/github_auth.rb', line 14

def user_defined_token
  @user_defined_token
end

#usernameObject

Returns the value of attribute username.



11
12
13
# File 'lib/octopolo/scripts/github_auth.rb', line 11

def username
  @username
end

Class Method Details

.executeObject



16
17
18
# File 'lib/octopolo/scripts/github_auth.rb', line 16

def self.execute
  new.execute
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/octopolo/scripts/github_auth.rb', line 20

def execute
  case ask_auth_method
  when "Generate an API token with my credentials"
    ask_credentials
    request_token
  when "I'll enter an access token manually"
    ask_token
    verify_token
  end
  store_token
rescue GitHub::BadCredentials => e
  cli.say e.message
end