Class: Unixoid::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/unixoid/github.rb

Constant Summary collapse

GITHUB_URL =
'https://api.github.com/user/repos'
REPO_NAME =
'unixoid_submission'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGithub

Returns a new instance of Github.



11
12
13
# File 'lib/unixoid/github.rb', line 11

def initialize
  @runner = Runner.new
end

Class Method Details

.create_repoObject



15
16
17
# File 'lib/unixoid/github.rb', line 15

def self.create_repo
  new.create_repo
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/unixoid/github.rb', line 32

def authenticated?
  @response && @response['message'] != "Bad credentials"
end

#create_repoObject



19
20
21
22
# File 'lib/unixoid/github.rb', line 19

def create_repo
  parse @runner.run(command, params: {username: username, password: password})
  self
end

#passwordObject



28
29
30
# File 'lib/unixoid/github.rb', line 28

def password
  @password ||= ask_for_password
end

#usernameObject



24
25
26
# File 'lib/unixoid/github.rb', line 24

def username
  @username ||= ask_for_username
end