Method: GitlabApi::ApiClient#initialize
- Defined in:
- lib/git/gitlab/apiclient.rb
#initialize ⇒ ApiClient
Returns a new instance of ApiClient.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/git/gitlab/apiclient.rb', line 13 def initialize @repository = Grit::Repo.new(`git rev-parse --show-toplevel`.chomp) config = @repository.config url = config["gitlab.url"] if url == nil raise "Plase set 'git config gitlab.url ${Gitlab URL}'" end token = config["gitlab.token"] if token == nil raise "Please set 'git config gitlab.token ${Gitlab Token}'" end Gitlab.configure do |config| config.endpoint = "#{url}/api/#{API_VERSION}" config.private_token = token config.user_agent = USER_AGENT end @client = Gitlab.client end |