Class: Raygun::GitlabClient

Inherits:
Object
  • Object
show all
Defined in:
lib/raygun/gitlab_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint) ⇒ GitlabClient

Returns a new instance of GitlabClient.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/raygun/gitlab_client.rb', line 7

def initialize(endpoint)
  @endpoint = URI.parse(endpoint)
  @token = ENV['GITLAB_API_PRIVATE_TOKEN']
  unless `which security`.empty?
    cmd = "security 2>&1 >/dev/null find-generic-password -g -l#{@endpoint.host}-private-token"
    @token ||= `#{cmd}`.gsub(/password: *"([^"]+)"\n/, '\1')
  end
  Gitlab.configure do |config|
    config.endpoint       = endpoint
    config.private_token  = @token
  end
end

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



6
7
8
# File 'lib/raygun/gitlab_client.rb', line 6

def endpoint
  @endpoint
end

#tokenObject

Returns the value of attribute token.



6
7
8
# File 'lib/raygun/gitlab_client.rb', line 6

def token
  @token
end

#uriObject

Returns the value of attribute uri.



6
7
8
# File 'lib/raygun/gitlab_client.rb', line 6

def uri
  @uri
end

Instance Method Details

#domainObject



20
21
22
# File 'lib/raygun/gitlab_client.rb', line 20

def domain
  endpoint.host
end