2014-12-31 08:07:48 -05:00
|
|
|
module Gitlab
|
2015-02-02 17:26:29 -05:00
|
|
|
module GithubImport
|
2014-12-31 08:07:48 -05:00
|
|
|
class Client
|
|
|
|
attr_reader :client
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
@client = ::OAuth2::Client.new(
|
|
|
|
config.app_id,
|
|
|
|
config.app_secret,
|
|
|
|
github_options
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def config
|
2015-02-02 20:01:07 -05:00
|
|
|
Gitlab.config.omniauth.providers.find{|provider| provider.name == "github"}
|
2014-12-31 08:07:48 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def github_options
|
|
|
|
{
|
2015-01-13 14:44:17 -05:00
|
|
|
site: 'https://api.github.com',
|
|
|
|
authorize_url: 'https://github.com/login/oauth/authorize',
|
|
|
|
token_url: 'https://github.com/login/oauth/access_token'
|
2014-12-31 08:07:48 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|