Method: Gitlab::Client::RepositoryFiles#get_file

Defined in:
lib/gitlab/client/repository_files.rb

#get_file(project, file_path, ref) ⇒ Gitlab::ObjectifiedHash

Gets a repository file.

Examples:

Gitlab.get_file(42, "README.md", "master")

Parameters:

  • project (Integer)

    The ID of a project.

  • file_path (String)

    The full path of the file.

  • ref (String)

    The name of branch, tag or commit.

Returns:



16
17
18
19
20
21
# File 'lib/gitlab/client/repository_files.rb', line 16

def get_file(project, file_path, ref)
  get("/projects/#{project}/repository/files", query: {
    file_path: file_path,
    ref: ref,
  })
end