Sha256: 6c877accdb243469992668c0573271ba1b83e47a56b56be03853fb4dd5039f38

Contents?: true

Size: 1.76 KB

Versions: 14

Compression:

Stored size: 1.76 KB

Contents

# encoding: utf-8

module GithubCLI
  class Commands::Downloads < Command

    namespace :download

    desc 'list <user> <repo>', 'Lists downloads'
    def list(user, repo)
      Download.all user, repo, options[:params], options[:format]
    end

    desc 'get <user> <repo> <id>', 'Get a download'
    def get(user, repo, id)
      Download.get user, repo, id, options[:params], options[:format]
    end

    desc 'create <user> <repo>', 'Create a new download resource'
    long_desc <<-DESC
      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. \n
        size - Required number - size of file in bytes. \n
        description - Optional string \n
        content_type - Optional string \n
    DESC
    def create(user, repo)
      Download.create user, repo, options[:params], options[:format]
    end

    desc 'upload <resource> <filename>', 'Upload resource to s3'
    long_desc <<-DESC
      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. \n
        filename - Required filename, a path to a file location. \n
    DESC
    def upload(resource, filename)
      Download.upload resource, filename, options[:format]
    end

    desc 'delete <user> <repo> <id>', 'Delete a download'
    def delete(user, repo, id)
      Download.delete user, repo, id, options[:params], options[:format]
    end

  end # Downloads
end # GithubCLI

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
github_cli-0.5.9 lib/github_cli/commands/downloads.rb
github_cli-0.5.8 lib/github_cli/commands/downloads.rb
github_cli-0.5.7 lib/github_cli/commands/downloads.rb
github_cli-0.5.6 lib/github_cli/commands/downloads.rb
github_cli-0.5.5 lib/github_cli/commands/downloads.rb
github_cli-0.5.4 lib/github_cli/commands/downloads.rb
github_cli-0.5.3 lib/github_cli/commands/downloads.rb
github_cli-0.5.2 lib/github_cli/commands/downloads.rb
github_cli-0.5.1 lib/github_cli/commands/downloads.rb
github_cli-0.5.0 lib/github_cli/commands/downloads.rb
github_cli-0.4.4 lib/github_cli/commands/downloads.rb
github_cli-0.4.3 lib/github_cli/commands/downloads.rb
github_cli-0.4.2 lib/github_cli/commands/downloads.rb
github_cli-0.4.1 lib/github_cli/commands/downloads.rb