lib/gitlab/client/repositories.rb
# Get the contents of a file
#
# @example
#   Gitlab.file_contents(42, 'Gemfile')
#   Gitlab.repo_file_contents(3, 'Gemfile', 'ed899a2f4b50b4370feeea94676502b42383c746')
#
# @param  [Integer] project The ID of a project.
# @param  [String] filepath The relative path of the file in the repository
# @param  [String] ref The name of a repository branch or tag or if not given the default branch.
# @return [String]
Get the contents of a file
Get the contents of a file
def file_contents(project, filepath, ref = 'master')
      get "/projects/#{project}/repository/blobs/#{ref}?filepath=#{filepath}",
        format: nil,
        headers: { Accept: 'text/plain' },
        parser: ::Gitlab::Request::Parser
    end
def file_contents ( project , filepath , ref = 'master' ) get "/projects/#{project}/repository/blobs/#{ref}?filepath=#{filepath}" , format : nil , headers : { Accept : 'text/plain' } , parser : :: Gitlab :: Request :: Parser end
Get the contents of a file
Get the contents of a file
None
String
project
<not_specific>
filepath
<not_specific>
ref
<not_specific>
<not_specific>
ref The name of a repository branch or tag or if not given the default branch.
ref The name of a repository branch or tag or if not given the default branch .
example
None