Class: Raygun::GitlabClient
- Inherits:
-
Object
- Object
- Raygun::GitlabClient
- Defined in:
- lib/raygun/gitlab_client.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#token ⇒ Object
Returns the value of attribute token.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #domain ⇒ Object
-
#initialize(endpoint) ⇒ GitlabClient
constructor
A new instance of GitlabClient.
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
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/raygun/gitlab_client.rb', line 6 def endpoint @endpoint end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/raygun/gitlab_client.rb', line 6 def token @token end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/raygun/gitlab_client.rb', line 6 def uri @uri end |
Instance Method Details
#domain ⇒ Object
20 21 22 |
# File 'lib/raygun/gitlab_client.rb', line 20 def domain endpoint.host end |