Class: Tanuki::Universe::GitlabClient
- Inherits:
-
Object
- Object
- Tanuki::Universe::GitlabClient
- Defined in:
- lib/tanuki/universe/gitlab_client.rb
Constant Summary collapse
- GITLAB_API_VERSION =
'v4'
Instance Attribute Summary collapse
-
#projects ⇒ Object
readonly
Returns the value of attribute projects.
Instance Method Summary collapse
- #get_git_tags(project_id) ⇒ Object
- #get_groups ⇒ Object
- #get_metadata(project_id, ref) ⇒ Object
- #get_projects(group_id) ⇒ Object
-
#initialize(options) ⇒ GitlabClient
constructor
A new instance of GitlabClient.
- #parse_options(options) ⇒ Object
Constructor Details
#initialize(options) ⇒ GitlabClient
Returns a new instance of GitlabClient.
11 12 13 14 15 |
# File 'lib/tanuki/universe/gitlab_client.rb', line 11 def initialize() () endpoint = "#{@opt_url}api/#{GITLAB_API_VERSION}" @client = Gitlab.client(endpoint: endpoint, private_token: @opt_private_token) end |
Instance Attribute Details
#projects ⇒ Object (readonly)
Returns the value of attribute projects.
9 10 11 |
# File 'lib/tanuki/universe/gitlab_client.rb', line 9 def projects @projects end |
Instance Method Details
#get_git_tags(project_id) ⇒ Object
31 32 33 |
# File 'lib/tanuki/universe/gitlab_client.rb', line 31 def (project_id) @client.(project_id) end |
#get_groups ⇒ Object
23 24 25 |
# 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) ⇒ Object
35 36 37 |
# File 'lib/tanuki/universe/gitlab_client.rb', line 35 def (project_id, ref) @client.file_contents(project_id, 'metadata.rb', ref) end |
#get_projects(group_id) ⇒ Object
27 28 29 |
# File 'lib/tanuki/universe/gitlab_client.rb', line 27 def get_projects(group_id) @projects = @client.group(group_id) end |
#parse_options(options) ⇒ Object
17 18 19 20 21 |
# File 'lib/tanuki/universe/gitlab_client.rb', line 17 def () @opt_group = ENV['GITLAB_COOKBOOKS_GROUP'] || ['group'] @opt_private_token = ENV['GITLAB_API_PRIVATE_TOKEN'] || ['private_token'] @opt_url = ENV['GITLAB_API_ENDPOINT'] || ['url'] end |