Module: Octokit::Client::Downloads
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/downloads.rb
Instance Method Summary collapse
-
#create_download(repo, name, options = {}) ⇒ Download
deprecated
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
-
#delete_download(repo, id) ⇒ Boolean
deprecated
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
-
#download(repo, id, options = {}) ⇒ Download
deprecated
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
-
#downloads(repo, options = {}) ⇒ Array
(also: #list_downloads)
deprecated
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
Instance Method Details
#create_download(repo, name, options = {}) ⇒ Download
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
Create a download in a repository
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/octokit/client/downloads.rb', line 42 def create_download(repo, name, ={}) [:content_type] ||= 'text/plain' file = Faraday::UploadIO.new(name, [:content_type]) resource = create_download_resource(repo, file.original_filename, File.size(name), ) resource_hash = { 'key' => resource.path, 'acl' => resource.acl, 'success_action_status' => 201, 'Filename' => resource.name, 'AWSAccessKeyId' => resource.accesskeyid, 'Policy' => resource.policy, 'Signature' => resource.signature, 'Content-Type' => resource.mime_type, 'file' => file } conn = Faraday.new(resource.s3_url) do |builder| builder.request :multipart builder.request :url_encoded builder.adapter :net_http end response = conn.post '/', resource_hash response.status == 201 end |
#delete_download(repo, id) ⇒ Boolean
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
Delete a single download for a repository
78 79 80 |
# File 'lib/octokit/client/downloads.rb', line 78 def delete_download(repo, id) boolean_from_response(:delete, "repos/#{Repository.new(repo)}/downloads/#{id}") end |
#download(repo, id, options = {}) ⇒ Download
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
Get single download for a repository
27 28 29 |
# File 'lib/octokit/client/downloads.rb', line 27 def download(repo, id, ={}) get("repos/#{Repository.new(repo)}/downloads/#{id}", ) end |
#downloads(repo, options = {}) ⇒ Array Also known as: list_downloads
Deprecated.
As of December 11th, 2012: github.com/blog/1302-goodbye-uploads
List available downloads for a repository
13 14 15 |
# File 'lib/octokit/client/downloads.rb', line 13 def downloads(repo, ={}) get("repos/#{Repository.new(repo)}/downloads", ) end |