class Github::Repos::Contents
def archive(user_name, repo_name, params={})
"ref" => "master"
"archive_format" => "tarball",
github.repos.contents.archive 'user-name', 'repo-name',
github = Github.new
= Examples
* :ref - Optional string - valid Git reference, defaults to master
* :archive_format - Required string - either tarball or zipball
= Parameters
Note: For private repositories, these links are temporary and expire quickly.
a second GET request.
to follow redirects or you will need to use the Location header to make
archive for a repository. Please make sure your HTTP framework is configured
This method will return a 302 to a URL to download a tarball or zipball
Get archive link
def archive(user_name, repo_name, params={}) set :user => user_name, :repo => repo_name normalize! params archive_format = params.delete('archive_format') || 'zipball' ref = params.delete('ref') || 'master' get_request("/repos/#{user_name}/#{repo_name}/#{archive_format}/#{ref}", params) end
def get(user_name, repo_name, path, params={})
github.repos.contents.get 'user-name', 'repo-name', 'path'
github = Github.new
= Examples
* :ref - Optional string - valid Git reference, defaults to master
= Parameters
This method returns the contents of any file or directory in a repository.
Get contents
def get(user_name, repo_name, path, params={}) set :user => user_name, :repo => repo_name normalize! params get_request("/repos/#{user_name}/#{repo_name}/contents/#{path}", params) end
def readme(user_name, repo_name, params={})
github.repos.contents.readme 'user-name', 'repo-name'
github = Github.new
= Examples
This method returns the preferred README for a repository.
Get the README
def readme(user_name, repo_name, params={}) set :user => user_name, :repo => repo_name normalize! params get_request("/repos/#{user_name}/#{repo_name}/readme", params) end