Module: Gitlab::Client::RepositoryFiles
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/repository_files.rb
Overview
Defines methods related to repository files.
Instance Method Summary collapse
-
#create_file(project, path, branch, content, commit_message) ⇒ Gitlab::ObjectifiedHash
Creates a new repository file.
-
#edit_file(project, path, branch, content, commit_message) ⇒ Gitlab::ObjectifiedHash
Edits an existing repository file.
-
#remove_file(project, path, branch, commit_message) ⇒ Gitlab::ObjectifiedHash
Removes an existing repository file.
Instance Method Details
#create_file(project, path, branch, content, commit_message) ⇒ Gitlab::ObjectifiedHash
Creates a new repository file.
18 19 20 21 22 23 24 |
# File 'lib/gitlab/client/repository_files.rb', line 18 def create_file(project, path, branch, content, ) post("/projects/#{project}/repository/files", body: { file_path: path, branch_name: branch, commit_message: , }.merge(encoded_content_attributes(content))) end |
#edit_file(project, path, branch, content, commit_message) ⇒ Gitlab::ObjectifiedHash
Edits an existing repository file.
37 38 39 40 41 42 43 |
# File 'lib/gitlab/client/repository_files.rb', line 37 def edit_file(project, path, branch, content, ) put("/projects/#{project}/repository/files", body: { file_path: path, branch_name: branch, commit_message: , }.merge(encoded_content_attributes(content))) end |
#remove_file(project, path, branch, commit_message) ⇒ Gitlab::ObjectifiedHash
Removes an existing repository file.
55 56 57 58 59 60 61 |
# File 'lib/gitlab/client/repository_files.rb', line 55 def remove_file(project, path, branch, ) delete("/projects/#{project}/repository/files", body: { file_path: path, branch_name: branch, commit_message: , }) end |