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.
-
#file_contents(project, filepath, ref = 'master') ⇒ String
(also: #repo_file_contents)
Get the contents of a file.
-
#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.
50 51 52 |
# File 'lib/gitlab/client/repositories.rb', line 50 def compare(project, from, to) get("/projects/#{project}/repository/compare", query: { from: from, to: to }) end |
#file_contents(project, filepath, ref = 'master') ⇒ String Also known as: repo_file_contents
Get the contents of a file
15 16 17 18 19 20 21 |
# File 'lib/gitlab/client/repositories.rb', line 15 def file_contents(project, filepath, ref='master') ref = URI.encode(ref, /\W/) get "/projects/#{project}/repository/blobs/#{ref}?filepath=#{filepath}", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser end |
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_tree
Get file tree project (root level).
35 36 37 |
# File 'lib/gitlab/client/repositories.rb', line 35 def tree(project, ={}) get("/projects/#{project}/repository/tree", query: ) end |