Parent

Class/Module Index [+]

Quicksearch

Github::Client::Repos

Public Instance Methods

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

Get branch

@example

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

@api public

# File lib/github_api/client/repos.rb, line 362
def branch(*args)
  arguments(args, required: [:user, :repo, :branch])

  get_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}", arguments.params)
end
branches(*args) click to toggle source

List branches

@example

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

@example

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

@api public

# File lib/github_api/client/repos.rb, line 345
def branches(*args)
  arguments(args, required: [:user, :repo])

  response = get_request("/repos/#{arguments.user}/#{arguments.repo}/branches", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: list_branches
contribs(*args) click to toggle source
Alias for: contributors
contributors(*args) click to toggle source

List contributors

@param [Hash] params @option params [Boolean] :anon

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| ... }

@api public

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

  response = get_request("/repos/#{arguments.user}/#{arguments.repo}/contributors", arguments.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.

@param [Hash] params @option params [String] :name

Required string

@option params [String] :description

Optional string

@option params [String] :homepage

Optional string

@option params [Boolean] :private

Optional boolean - true to create a private  repository,
                   false to create a public one.

@option params [Boolean] :has_issues

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

@option params [Boolean] :has_wiki

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

@option params [Boolean] :has_downloads

Optional boolean - true to enable downloads for this repository

@option params [String] :org

Optional string - The organisation in which this
repository will be created

@option params [Numeric] :team_id

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

@option params [Boolean] :auto_init

Optional boolean - true to create an initial commit with
empty README. Default is false.

@option params [String] :gitignore_template

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.

@example

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

@example

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

@example

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

  # Requires authenticated user
  if (org = params.delete('org') || 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.

@example

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

@api public

# File lib/github_api/client/repos.rb, line 244
def delete(*args)
  arguments(args, required: [:user, :repo])

  delete_request("/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
end
Also aliased as: remove, remove
edit(*args) click to toggle source

Edit a repository

@param [Hash] params @option params [String] :name

Required string

@option params [String] :description

Optional string

@option params [String] :homepage

Optional string

@option params [Boolean] :private

Optional boolean, false to create public repos, false to create a private one

@option params [Boolean] :has_issues

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

@option params [Boolean] :has_wiki

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

@option params [Boolean] :has_downloads

Optional boolean - true to enable downloads for this repository

@option params [String] :default_branch

Optional string - Update the default branch for this repository.

@example

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/client/repos.rb, line 306
def edit(*args)
  arguments(args, required: [:user, :repo]) do
    permit VALID_REPO_OPTIONS
    assert_required ] name ]
  end

  patch_request("/repos/#{arguments.user}/#{arguments.repo}", arguments.params.merge_default(DEFAULT_REPO_OPTIONS))
end
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a repository

@example

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/client/repos.rb, line 158
def get(*args)
  arguments(args, required: [:user, :repo])

  get_request("/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
end
Also aliased as: find
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| ... }

@api public

# File lib/github_api/client/repos.rb, line 400
def languages(*args)
  arguments(args, required: [:user, :repo])

  response = get_request("/repos/#{arguments.user}/#{arguments.repo}/languages", arguments.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

@example

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.

@param [Hash] params @option params [Integer] :since

the integer ID of the last Repository that you've seen.

@example

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

List public repositories for the specified user.

@example

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

List repositories for the specified organisation.

@example

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

@api public

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

  response = if (user_name = params.delete('user') || user)
    get_request("/users/#{user_name}/repos", params)
  elsif (org_name = params.delete('org') || 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
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
tags(*args) click to toggle source

List tags

@example

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

@api public

# File lib/github_api/client/repos.rb, line 417
def tags(*args)
  arguments(args, required: [:user, :repo])

  response = get_request("/repos/#{arguments.user}/#{arguments.repo}/tags", arguments.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

@example

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

@example

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

@api public

# File lib/github_api/client/repos.rb, line 439
def teams(*args)
  arguments(args, required: [:user, :repo])

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.