Parent

Class/Module Index [+]

Quicksearch

Github::Repos::Downloads

Public Instance Methods

all(*args) click to toggle source
Alias for: list
create(*args) click to toggle source

Creating a new download is a two step process. You must first create a new download resource using this method. Response from this method is to be used in upload method.

Inputs

  • :name - Required string - name of the file that is being created.

  • :size - Required number - size of file in bytes.

  • :description - Optional string

  • :content_type - Optional string

Examples

github = Github.new
github.repos.downloads.create 'user-name', 'repo-name',
  "name" =>  "new_file.jpg",
  "size" => 114034,
  "description" => "Latest release",
  "content_type" => "text/plain"
# File lib/github_api/repos/downloads.rb, line 78
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
delete(*args) click to toggle source

Delete download from a repository

Examples

github = Github.new
github.repos.downloads.delete 'user-name', 'repo-name', 'download-id'
# File lib/github_api/repos/downloads.rb, line 52
def delete(*args)
  arguments(args, :required => [:user, :repo, :download_id])
  params = arguments.params

  delete_request("/repos/#{user}/#{repo}/downloads/#{download_id}", params)
end
Also aliased as: remove
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a single download

Examples

github = Github.new
github.repos.downloads.get 'user-name', 'repo-name', 'download-id'
# File lib/github_api/repos/downloads.rb, line 38
def get(*args)
  arguments(args, :required => [:user, :repo, :download_id])
  params = arguments.params

  get_request("/repos/#{user}/#{repo}/downloads/#{download_id}", params)
end
Also aliased as: find
list(*args) click to toggle source

List downloads for a repository

Examples

github = Github.new
github.repos.downloads.list 'user-name', 'repo-name'
github.repos.downloads.list 'user-name', 'repo-name' { |downl| ... }
# File lib/github_api/repos/downloads.rb, line 23
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
Also aliased as: all
remove(*args) click to toggle source
Alias for: delete
upload(*args) click to toggle source

Upload a file to Amazon, using the reponse instance from Github::Repos::Downloads#create_download. This can be done by passing the response object as an argument to upload method.

Parameters

  • resource - Required resource of the create_download call.

  • :filename - Required filename, a path to a file location.

Examples

resource = github.repos.downloads.create 'user-name', 'repo-name'

github.repos.downloads.upload resource, '/users/octokit/image.jpg'
# File lib/github_api/repos/downloads.rb, line 101
def upload(*args)
  arguments(args, :required => [:resource, :filename])

  response = Github::S3Uploader.new(resource, filename).send
  response.body
end
Also aliased as: upload_to_s3, upload_to_amazon
upload_to_amazon(*args) click to toggle source
Alias for: upload
upload_to_s3(*args) click to toggle source
Alias for: upload

[Validate]

Generated with the Darkfish Rdoc Generator 2.