lib/gitlab/client/repository_files.rb in gitlab-3.5.0 vs lib/gitlab/client/repository_files.rb in gitlab-3.6.0
- old
+ new
@@ -13,13 +13,13 @@
# @param [String] file_path The full path of the file.
# @param [String] ref The name of branch, tag or commit.
# @return [Gitlab::ObjectifiedHash]
def get_file(project, file_path, ref)
get("/projects/#{project}/repository/files", query: {
- file_path: file_path,
- ref: ref,
- })
+ file_path: file_path,
+ ref: ref
+ })
end
# Creates a new repository file.
#
# @example
@@ -33,11 +33,11 @@
# @return [Gitlab::ObjectifiedHash]
def create_file(project, path, branch, content, commit_message)
post("/projects/#{project}/repository/files", body: {
file_path: path,
branch_name: branch,
- commit_message: commit_message,
+ commit_message: commit_message
}.merge(encoded_content_attributes(content)))
end
# Edits an existing repository file.
#
@@ -52,11 +52,11 @@
# @return [Gitlab::ObjectifiedHash]
def edit_file(project, path, branch, content, commit_message)
put("/projects/#{project}/repository/files", body: {
file_path: path,
branch_name: branch,
- commit_message: commit_message,
+ commit_message: commit_message
}.merge(encoded_content_attributes(content)))
end
# Removes an existing repository file.
#
@@ -68,21 +68,21 @@
# @param [String] the name of the branch.
# @param [String] commit message.
# @return [Gitlab::ObjectifiedHash]
def remove_file(project, path, branch, commit_message)
delete("/projects/#{project}/repository/files", body: {
- file_path: path,
- branch_name: branch,
- commit_message: commit_message,
- })
+ file_path: path,
+ branch_name: branch,
+ commit_message: commit_message
+ })
end
private
def encoded_content_attributes(content)
{
encoding: 'base64',
- content: Base64.encode64(content),
+ content: Base64.encode64(content)
}
end
end
end