class Tanuki::Universe::GitlabClient

Constants

GITLAB_API_VERSION

Attributes

projects[R]

Public Class Methods

new(options) click to toggle source
# File lib/tanuki/universe/gitlab_client.rb, line 11
def initialize(options)
  parse_options(options)
  endpoint = "#{@opt_url}api/#{GITLAB_API_VERSION}"
  @client = Gitlab.client(endpoint: endpoint, private_token: @opt_private_token)
end

Public Instance Methods

get_git_tags(project_id) click to toggle source
# File lib/tanuki/universe/gitlab_client.rb, line 31
def get_git_tags(project_id)
  @client.tags(project_id)
end
get_groups() click to toggle source
# File lib/tanuki/universe/gitlab_client.rb, line 23
def get_groups
  @opt_groups = @client.group_search(@opt_group)
end
get_metadata(project_id, ref) click to toggle source
# File lib/tanuki/universe/gitlab_client.rb, line 35
def get_metadata(project_id, ref)
  @client.file_contents(project_id, 'metadata.rb', ref)
end
get_projects(group_id) click to toggle source
# File lib/tanuki/universe/gitlab_client.rb, line 27
def get_projects(group_id)
   @projects = @client.group(group_id)
end
parse_options(options) click to toggle source
# File lib/tanuki/universe/gitlab_client.rb, line 17
def parse_options(options)
  @opt_group = ENV['GITLAB_COOKBOOKS_GROUP'] || options['group']
  @opt_private_token = ENV['GITLAB_API_PRIVATE_TOKEN'] || options['private_token']
  @opt_url = ENV['GITLAB_API_ENDPOINT'] || options['url']
end