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, String)

    The ID or name of a project.

  • file_path (String)

    The full path of the file.

  • ref (String)

    The name of branch, tag or commit.

Returns:

[View source]

53
54
55
56
57
# File 'lib/gitlab/client/repository_files.rb', line 53

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