class Github::Repos::Downloads
def create(*args)
"content_type" => "text/plain"
"description" => "Latest release",
"size" => 114034,
"name" => "new_file.jpg",
github.repos.downloads.create 'user-name', 'repo-name',
github = Github.new
= Examples
* :content_type - Optional string
* :description - Optional string
* :size - Required number - size of file in bytes.
* :name - Required string - name of the file that is being created.
= Inputs
Response from this method is to be used in #upload method.
You must first create a new download resource using this method.
Creating a new download is a two step process.
def create(*args) arguments(args, :required => [:user, :repo]) do sift VALID_DOWNLOAD_PARAM_NAMES assert_required REQUIRED_PARAMS end params = arguments.params post_request("/repos/#{user}/#{repo}/downloads", params) end
def delete(*args)
github.repos.downloads.delete 'user-name', 'repo-name', 'download-id'
github = Github.new
= Examples
Delete download from a repository
def delete(*args) arguments(args, :required => [:user, :repo, :download_id]) params = arguments.params delete_request("/repos/#{user}/#{repo}/downloads/#{download_id}", params) end
def get(*args)
github.repos.downloads.get 'user-name', 'repo-name', 'download-id'
github = Github.new
= Examples
Get a single download
def get(*args) arguments(args, :required => [:user, :repo, :download_id]) params = arguments.params get_request("/repos/#{user}/#{repo}/downloads/#{download_id}", params) end
def list(*args)
github.repos.downloads.list 'user-name', 'repo-name' { |downl| ... }
github.repos.downloads.list 'user-name', 'repo-name'
github = Github.new
= Examples
List downloads for a repository
def list(*args) arguments(args, :required => [:user, :repo]) response = get_request("/repos/#{user}/#{repo}/downloads", arguments.params) return response unless block_given? response.each { |el| yield el } end
def upload(*args)
github.repos.downloads.upload resource, '/users/octokit/image.jpg'
resource = github.repos.downloads.create 'user-name', 'repo-name'
= Examples
* :filename - Required filename, a path to a file location.
* resource - Required resource of the create_download call.
= Parameters
the response object as an argument to upload method.
Github::Repos::Downloads#create_download. This can be done by passing
Upload a file to Amazon, using the reponse instance from
def upload(*args) arguments(args, :required => [:resource, :filename]) response = Github::S3Uploader.new(resource, filename).send response.body end