Module: Gitlab::Client::Repositories
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/repositories.rb
Overview
Defines methods related to repositories.
Instance Method Summary collapse
-
#compare(project, from, to) ⇒ Gitlab::ObjectifiedHash
(also: #repo_compare)
Compares branches, tags or commits.
-
#repo_archive(project, ref = 'master') ⇒ Gitlab::FileResponse
Get project repository archive.
-
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash
(also: #repo_tree)
Get file tree project (root level).
Instance Method Details
#compare(project, from, to) ⇒ Gitlab::ObjectifiedHash Also known as: repo_compare
Compares branches, tags or commits.
54 55 56 |
# File 'lib/gitlab/client/repositories.rb', line 54 def compare(project, from, to) get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to }) end |
#repo_archive(project, ref = 'master') ⇒ Gitlab::FileResponse
Get project repository archive
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/client/repositories.rb', line 30 def repo_archive(project, ref = 'master') get("/projects/#{url_encode project}/repository/archive", format: nil, headers: { Accept: 'application/octet-stream' }, query: { sha: ref }, parser: proc { |body, _| if body.encoding == Encoding::ASCII_8BIT # binary response ::Gitlab::FileResponse.new StringIO.new(body, 'rb+') else # error with json response ::Gitlab::Request.parse(body) end }) end |
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_tree
Get file tree project (root level).
16 17 18 |
# File 'lib/gitlab/client/repositories.rb', line 16 def tree(project, ={}) get("/projects/#{url_encode project}/repository/tree", query: ) end |