client.rb 627 Bytes
Newer Older
Valery Sizov's avatar
Valery Sizov committed
1
module Gitlab
2
  module GithubImport
Valery Sizov's avatar
Valery Sizov committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    class Client
      attr_reader :client

      def initialize
        @client = ::OAuth2::Client.new(
          config.app_id,
          config.app_secret,
          github_options
        )
      end

      private

      def config
        Gitlab.config.omniauth.providers.select{|provider| provider.name == "github"}.first
      end

      def github_options
        {
22
23
24
          site: 'https://api.github.com',
          authorize_url: 'https://github.com/login/oauth/authorize',
          token_url: 'https://github.com/login/oauth/access_token'
Valery Sizov's avatar
Valery Sizov committed
25
26
27
28
29
        }
      end
    end
  end
end