### Home Classes Methods

### In Files

- lib/github_api/repos.rb

### Parent

Github::API

### Namespace

- CLASS Github::Repos::Collaborators
- CLASS Github::Repos::Comments
- CLASS Github::Repos::Commits
- CLASS Github::Repos::Contents
- CLASS Github::Repos::Downloads
- CLASS Github::Repos::Forks
- CLASS Github::Repos::Hooks
- CLASS Github::Repos::Keys
- CLASS Github::Repos::Merging
- CLASS Github::Repos::PubSubHubbub
- CLASS Github::Repos::Statistics
- CLASS Github::Repos::Statuses

### Methods

- #all
- #branch
- #branches
- #collaborators
- #comments
- #commits
- #contents
- #contribs
- #contributors
- #create
- #delete
- #downloads
- #edit
- #find
- #forks
- #get
- #hooks
- #keys
- #languages
- #list
- #list_branches
- #list_contributors
- #list_languages
- #list_tags
- #list_teams
- #merging
- #pubsubhubbub
- #remove
- #repo_tags
- #repo_teams
- #repository_tags
- #repository_teams
- #stats
- #statuses
- #tags
- #teams

### Class/Module Index

Quicksearch

- Github
- Github::API
- Github::Activity
- Github::Activity::Events
- Github::Activity::Notifications
- Github::Activity::Starring
- Github::Activity::Watching
- Github::ApiFactory
- Github::Arguments
- Github::Authorization
- Github::Authorizations
- Github::AutoloadHelper
- Github::Client
- Github::Configuration
- Github::Connection
- Github::Constants
- Github::CoreExt
- Github::CoreExt::OrderedHash
- Github::Descendants
- Github::Emojis
- Github::Error
- Github::Error::BadRequest
- Github::Error::ClientError
- Github::Error::Forbidden
- Github::Error::GithubError
- Github::Error::InternalServerError
- Github::Error::InvalidOptions
- Github::Error::NotAcceptable
- Github::Error::NotFound
- Github::Error::RequiredParams
- Github::Error::ServiceError
- Github::Error::ServiceUnavailable
- Github::Error::Unauthorized
- Github::Error::UnknownValue
- Github::Error::UnprocessableEntity
- Github::Error::Validations
- Github::Gists
- Github::Gists::Comments
- Github::GitData
- Github::GitData::Blobs
- Github::GitData::Commits
- Github::GitData::References
- Github::GitData::Tags
- Github::GitData::Trees
- Github::Gitignore
- Github::Issues
- Github::Issues::Assignees
- Github::Issues::Comments
- Github::Issues::Events
- Github::Issues::Labels
- Github::Issues::Milestones
- Github::Jsonable
- Github::Markdown
- Github::Meta
- Github::MimeType
- Github::Normalizer
- Github::Orgs
- Github::Orgs::Members
- Github::Orgs::Teams
- Github::PageIterator
- Github::PageLinks
- Github::PagedRequest
- Github::Pagination
- Github::ParameterFilter
- Github::ParamsHash
- Github::PullRequests
- Github::PullRequests::Comments
- Github::RateLimit
- Github::Repos
- Github::Repos::Collaborators
- Github::Repos::Comments
- Github::Repos::Commits
- Github::Repos::Contents
- Github::Repos::Downloads
- Github::Repos::Forks
- Github::Repos::Hooks
- Github::Repos::Keys
- Github::Repos::Merging
- Github::Repos::PubSubHubbub
- Github::Repos::Statistics
- Github::Repos::Statuses
- Github::Request
- Github::Request::BasicAuth
- Github::Request::Jsonize
- Github::Request::OAuth2
- Github::Resource
- Github::Response
- Github::Response::Header
- Github::Response::Jsonize
- Github::Response::Mashify
- Github::Response::RaiseError
- Github::Response::Xmlize
- Github::ResponseWrapper
- Github::S3Uploader
- Github::Say
- Github::Scopes
- Github::Search
- Github::Users
- Github::Users::Emails
- Github::Users::Followers
- Github::Users::Keys
- Github::Utils
- Github::Utils::Url
- Github::VERSION
- Github::Validations
- Github::Validations::Format
- Github::Validations::Presence
- Github::Validations::Required
- Github::Validations::Token
- Hash

No matching classes.

# Github::Repos

### Constants

DEFAULT_REPO_OPTIONS
REQUIRED_REPO_OPTIONS
VALID_REPO_OPTIONS
VALID_REPO_TYPES

### Public Instance Methods

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

Get branch

# Examples

    github = Github.new
    github.repos.branch 'user-name', 'repo-name', 'branch-name'
    github.repos.branch user: 'user-name', repo: 'repo-name', branch: 'branch-name'
    github.repos(user: 'user-name', repo: 'repo-name', branch: 'branch-name').branch

    # File lib/github_api/repos.rb, line 343
    def branch(*args)
      arguments(args, :required => [:user, :repo, :branch])
      params = arguments.params

      get_request("/repos/#{user}/#{repo}/branches/#{branch}", params)
    end

branches(*args) click to toggle source

List branches

# Examples

    github = Github.new
    github.repos.branches 'user-name', 'repo-name'
    github.repos(user: 'user-name', repo: 'repo-name').branches

    repos = Github::Repos.new
    repos.branches 'user-name', 'repo-name'

def branches(user_name, repo_name, params={})

    # File lib/github_api/repos.rb, line 324
    def branches(*args)
      arguments(args, :required => [:user, :repo])
      params = arguments.params

      response = get_request("/repos/#{user}/#{repo}/branches", arguments.params)
      return response unless block_given?
      response.each { |el| yield el }
    end

Also aliased as: list_branches
collaborators(options={}, &block) click to toggle source

Access to Repos::Collaborators API

    # File lib/github_api/repos.rb, line 48
    def collaborators(options={}, &block)
      @collaborators ||= ApiFactory.new('Repos::Collaborators', current_options.merge(options), &block)
    end

comments(options={}, &block) click to toggle source

Access to Repos::Comments API

    # File lib/github_api/repos.rb, line 53
    def comments(options={}, &block)
      @commits ||= ApiFactory.new('Repos::Comments', current_options.merge(options), &block)
    end

commits(options={}, &block) click to toggle source

Access to Repos::Commits API

    # File lib/github_api/repos.rb, line 58
    def commits(options={}, &block)
      @commits ||= ApiFactory.new('Repos::Commits', current_options.merge(options), &block)
    end

contents(options={}, &block) click to toggle source

Access to Repos::Contents API

    # File lib/github_api/repos.rb, line 63
    def contents(options={}, &block)
      @contents ||= ApiFactory.new('Repos::Contents', current_options.merge(options), &block)
    end

contribs(*args) click to toggle source
Alias for: contributors
contributors(*args) click to toggle source

List contributors

# Parameters

    <tt>:anon</tt> - Optional flag. Set to 1 or true to include anonymous contributors.

# Examples

    github = Github.new
    github.repos.contributors 'user-name','repo-name'
    github.repos.contributors 'user-name','repo-name' { |cont| ... }

    # File lib/github_api/repos.rb, line 251
    def contributors(*args)
      arguments(args, :required => [:user, :repo]) do
        sift ] anon ]
      end
      params = arguments.params

      response = get_request("/repos/#{user}/#{repo}/contributors", params)
      return response unless block_given?
      response.each { |el| yield el }
    end

Also aliased as: list_contributors, contribs, list_contributors, contribs
create(*args) click to toggle source

Create a new repository for the autheticated user.

# Parameters

    <tt>:name</tt> - Required string
    <tt>:description</tt> - Optional string
    <tt>:homepage</tt> - Optional string
    <tt>:private</tt> - Optional boolean - <tt>true</tt> to create a private repository, <tt>false</tt> to create a public one.
    <tt>:has_issues</tt> - Optional boolean - <tt>true</tt> to enable issues for this repository, <tt>false</tt> to disable them
    <tt>:has_wiki</tt> - Optional boolean - <tt>true</tt> to enable the wiki for this repository, <tt>false</tt> to disable it. Default is <tt>true</tt>
    <tt>:has_downloads</tt> Optional boolean - <tt>true</tt> to enable downloads for this repository
    <tt>:org</tt> Optional string - The organisation in which this repository will be created
    <tt>:team_id</tt> Optional number - The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization
    <tt>:auto_init</tt> Optional boolean - true to create an initial commit with empty README. Default is false.
    <tt>:gitignore_template</tt> Optional string - Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, “Haskell” Ignored if auto_init parameter is not provided.

# Examples

    github = Github.new
    github.repos.create "name": 'repo-name'
      "description": "This is your first repo",
      "homepage": "https://github.com",
      "private": false,
      "has_issues": true,
      "has_wiki": true,
      "has_downloads": true

Create a new repository in this organisation. The authenticated user must be a member of this organisation

Examples:

    github = Github.new :oauth_token => '...'
    github.repos.create :name => 'repo-name', :org => 'organisation-name'

    # File lib/github_api/repos.rb, line 208
    def create(*args)
      arguments(args) do
        sift VALID_REPO_OPTIONS + ] org ]
        assert_required ] name ]
      end
      params = arguments.params

      # Requires authenticated user
      if (org = params.delete("org"))
        post_request("/orgs/#{org}/repos", params.merge_default(DEFAULT_REPO_OPTIONS))
      else
        post_request("/user/repos", params.merge_default(DEFAULT_REPO_OPTIONS))
      end
    end

delete(*args) click to toggle source

Delete a repository

Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.

# Examples

    github = Github.new :oauth_token => '...'
    github.repos.delete 'user-name', 'repo-name'

    # File lib/github_api/repos.rb, line 232
    def delete(*args)
      arguments(args, :required => [:user, :repo])
      params = arguments.params

      delete_request("/repos/#{user}/#{repo}", params)
    end

Also aliased as: remove, remove
downloads(options={}, &block) click to toggle source

Access to Repos::Downloads API

    # File lib/github_api/repos.rb, line 68
    def downloads(options={}, &block)
      @downloads ||= ApiFactory.new('Repos::Downloads', current_options.merge(options), &block)
    end

edit(*args) click to toggle source

Edit a repository

# Parameters

- `:name` Required string

- `:description` Optional string

- `:homepage` Optional string

    <tt>:private</tt> - Optional boolean - <tt>false</tt> to create public reps, <tt>false</tt> to create a private one

- `:has_issues` Optional boolean - `true` to enable issues for this repository, `false` to disable them

- `:has_wiki` Optional boolean - `true` to enable the wiki for this repository, `false` to disable it. Default is `true`

- `:has_downloads` Optional boolean - `true` to enable downloads for this repository

- `:default_branch` Optional string - Update the default branch for this repository.

# Examples

    github = Github.new
    github.repos.edit 'user-name', 'repo-name',
      :name => 'hello-world',
      :description => 'This is your first repo',
      :homepage => "https://github.com",
      :public => true, :has_issues => true

    # File lib/github_api/repos.rb, line 285
    def edit(*args)
      arguments(args, :required => [:user, :repo]) do
        sift VALID_REPO_OPTIONS
        assert_required ] name ]
      end
      params = arguments.params

      patch_request("/repos/#{user}/#{repo}", params.merge_default(DEFAULT_REPO_OPTIONS))
    end

find(*args) click to toggle source
Alias for: get
forks(options={}, &block) click to toggle source

Access to Repos::Forks API

    # File lib/github_api/repos.rb, line 73
    def forks(options={}, &block)
      @forks ||= ApiFactory.new('Repos::Forks', current_options.merge(options), &block)
    end

get(*args) click to toggle source

Get a repository

# Examples

    github = Github.new
    github.repos.get 'user-name', 'repo-name'
    github.repos.get user: 'user-name', repo: 'repo-name'
    github.repos(user: 'user-name', repo: 'repo-name').get

    # File lib/github_api/repos.rb, line 168
    def get(*args)
      arguments(args, :required => [:user, :repo])
      params = arguments.params

      get_request("/repos/#{user}/#{repo}", params)
    end

Also aliased as: find
hooks(options={}, &block) click to toggle source

Access to Repos::Hooks API

    # File lib/github_api/repos.rb, line 78
    def hooks(options={}, &block)
      @hooks ||= ApiFactory.new('Repos::Hooks', current_options.merge(options), &block)
    end

keys(options={}, &block) click to toggle source

Access to Repos::Keys API

    # File lib/github_api/repos.rb, line 83
    def keys(options={}, &block)
      @keys ||= ApiFactory.new('Repos::Keys', current_options.merge(options), &block)
    end

languages(*args) click to toggle source

List languages

# Examples

    github = Github.new
    github.repos.languages 'user-name', 'repo-name'
    github.repos.languages 'user-name', 'repo-name' { |lang| ... }

    # File lib/github_api/repos.rb, line 381
    def languages(*args)
      arguments(args, :required => [:user, :repo])
      params = arguments.params

      response = get_request("/repos/#{user}/#{repo}/languages", params)
      return response unless block_given?
      response.each { |el| yield el }
    end

Also aliased as: list_languages
list(*args) click to toggle source

List repositories for the authenticated user

# Examples

    github = Github.new :oauth_token => '...'
    github.repos.list
    github.repos.list { |repo| ... }

List all repositories

This provides a dump of every repository, in the order that they were created.

# Parameters

- `:since` - the integer ID of the last Repository that you've seen.

# Examples

    github = Github.new
    github.repos.list :every
    github.repos.list :every { |repo| ... }

List public repositories for the specified user.

# Examples

    github = Github.new
    github.repos.list user: 'user-name'
    github.repos.list user: 'user-name', { |repo| ... }

List repositories for the specified organisation.

# Examples

    github = Github.new
    github.repos.list org: 'org-name'
    github.repos.list org: 'org-name', { |repo| ... }

    # File lib/github_api/repos.rb, line 139
    def list(*args)
      arguments(args) do
        sift ] user org type sort direction since ]
      end
      params = arguments.params

      response = if (user_name = (params.delete("user")))
        get_request("/users/#{user_name}/repos", params)
      elsif (org_name = (params.delete("org")))
        get_request("/orgs/#{org_name}/repos", params)
      elsif args.map(&:to_s).include?("every")
        get_request("/repositories", params)
      else
        # For authenticated user
        get_request("/user/repos", params)
      end
      return response unless block_given?
      response.each { |el| yield el }
    end

Also aliased as: all
list_branches(*args) click to toggle source
Alias for: branches
list_contributors(*args) click to toggle source
Alias for: contributors
list_languages(*args) click to toggle source
Alias for: languages
list_tags(*args) click to toggle source
Alias for: tags
list_teams(*args) click to toggle source
Alias for: teams
merging(options={}, &block) click to toggle source

Access to Repos::Merging API

    # File lib/github_api/repos.rb, line 88
    def merging(options={}, &block)
      @mergin ||= ApiFactory.new('Repos::Merging', current_options.merge(options), &block)
    end

pubsubhubbub(options={}, &block) click to toggle source

Access to Repos::PubSubHubbub API

    # File lib/github_api/repos.rb, line 93
    def pubsubhubbub(options={}, &block)
      @pubsubhubbub ||= ApiFactory.new('Repos::PubSubHubbub', current_options.merge(options), &block)
    end

remove(*args) click to toggle source
Alias for: delete
repo_tags(*args) click to toggle source
Alias for: tags
repo_teams(*args) click to toggle source
Alias for: teams
repository_tags(*args) click to toggle source
Alias for: tags
repository_teams(*args) click to toggle source
Alias for: teams
stats(options={}, &block) click to toggle source

Access to Repos::Statistics API

    # File lib/github_api/repos.rb, line 98
    def stats(options={}, &block)
      @stats ||= ApiFactory.new('Repos::Statistics', current_options.merge(options), &block)
    end

statuses(options={}, &block) click to toggle source

Access to Repos::Statuses API

    # File lib/github_api/repos.rb, line 103
    def statuses(options={}, &block)
      @statuses ||= ApiFactory.new('Repos::Statuses', current_options.merge(options), &block)
    end

tags(*args) click to toggle source

List tags

# Examples

    github = Github.new
    github.repos.tags 'user-name', 'repo-name'
    github.repos.tags 'user-name', 'repo-name' { |tag| ... }

    # File lib/github_api/repos.rb, line 398
    def tags(*args)
      arguments(args, :required => [:user, :repo])
      params = arguments.params

      response = get_request("/repos/#{user}/#{repo}/tags", params)
      return response unless block_given?
      response.each { |el| yield el }
    end

Also aliased as: list_tags, repo_tags, repository_tags
teams(*args) click to toggle source

List teams

## Examples

    github = Github.new
    github.repos.teams 'user-name', 'repo-name'
    github.repos.teams 'user-name', 'repo-name' { |team| ... }

    github.repos(user: 'user-name, repo: 'repo-name').teams

    # File lib/github_api/repos.rb, line 419
    def teams(*args)
      arguments(args, :required => [:user, :repo])
      params = arguments.params

      response = get_request("/repos/#{user}/#{repo}/teams", params)
      return response unless block_given?
      response.each { |el| yield el }
    end

Also aliased as: list_teams, repo_teams, repository_teams

[Validate]

Generated with the Darkfish Rdoc Generator 2.