module LogCabin::Modules::GitlabApi
Provide an api method for modules to query GitLab
Public Instance Methods
gitlab_api()
click to toggle source
# File lib/prospectus/helpers/gitlab_api.rb, line 9 def gitlab_api @gitlab_api ||= Gitlab.client( endpoint: gitlab_endpoint + '/api/v4', private_token: gitlab_token ) end
Private Instance Methods
endpoint(value)
click to toggle source
# File lib/prospectus/helpers/gitlab_api.rb, line 39 def endpoint(value) @gitlab_endpoint = value end
gitlab_endpoint()
click to toggle source
# File lib/prospectus/helpers/gitlab_api.rb, line 31 def gitlab_endpoint @gitlab_endpoint ||= 'https://gitlab.com' end
gitlab_token()
click to toggle source
# File lib/prospectus/helpers/gitlab_api.rb, line 18 def gitlab_token @gitlab_token ||= token_from_file @gitlab_token ||= Keylime.new( server: gitlab_endpoint, account: 'prospectus' ).get!("GitLab API token (#{gitlab_endpoint}/profile/account)").password end
repo(value)
click to toggle source
# File lib/prospectus/helpers/gitlab_api.rb, line 35 def repo(value) @repo = value end
token_from_file()
click to toggle source
# File lib/prospectus/helpers/gitlab_api.rb, line 26 def token_from_file return unless File.exist? File.expand_path('~/.gitlab_api') File.read('~/.gitlab_api').strip end