Module: Octokit::Client::Repositories

Included in:
Octokit::Client
Defined in:
lib/octokit/client/repositories.rb

Overview

Methods for the Repositories API

See Also:

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) add_collaborator(repo, collaborator, options = {}) Also known as: add_collab

Add collaborator to repo

This can also be used to update the permission of an existing collaborator

Requires authenticated client.

Examples:

@client.add_collaborator('octokit/octokit.rb', 'holman')
@client.add_collab('octokit/octokit.rb', 'holman')

Add a collaborator with admin permissions

@client.add_collaborator('octokit/octokit.rb', 'holman', permission: 'admin')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • collaborator (String)

    Collaborator GitHub username to add.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :permission (String)

    The permission to grant the collaborator. Only valid on organization-owned repositories. Can be one of: pull, push, or admin. If not specified, defaults to push

Returns:

  • (Boolean)

    True if collaborator added, false otherwise.

See Also:



313
314
315
# File 'lib/octokit/client/repositories.rb', line 313

def add_collaborator(repo, collaborator, options = {})
  boolean_from_response :put, "#{Repository.path repo}/collaborators/#{collaborator}", options
end

- (Sawyer::Resource) add_deploy_key(repo, title, key, options = {})

Add deploy key to a repo

Requires authenticated client.

Examples:

@client.add_deploy_key('octokit/octokit.rb', 'Staging server', 'ssh-rsa AAA...')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • title (String)

    Title reference for the deploy key.

  • key (String)

    Public key.

Returns:

  • (Sawyer::Resource)

    Hash representing newly added key.

See Also:



237
238
239
# File 'lib/octokit/client/repositories.rb', line 237

def add_deploy_key(repo, title, key, options = {})
  post "#{Repository.path repo}/keys", options.merge(:title => title, :key => key)
end

- (Array<Sawyer::Resource>) all_repositories(options = {})

List all repositories

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

Parameters:

  • options (Hash) (defaults to: {})

    Optional options

Options Hash (options):

  • :since (Integer)

    The integer ID of the last Repository that you’ve seen.

Returns:

  • (Array<Sawyer::Resource>)

    List of repositories.

See Also:



88
89
90
# File 'lib/octokit/client/repositories.rb', line 88

def all_repositories(options = {})
  paginate 'repositories', options
end

- (Sawyer::Resource) branch(repo, branch, options = {}) Also known as: get_branch

Get a single branch from a repository

Examples:

Get branch 'master` from octokit/octokit.rb

Octokit.branch("octokit/octokit.rb", "master")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • branch (String)

    Branch name

Returns:

  • (Sawyer::Resource)

    The branch requested, if it exists

See Also:



491
492
493
# File 'lib/octokit/client/repositories.rb', line 491

def branch(repo, branch, options = {})
  get "#{Repository.path repo}/branches/#{branch}", options
end

- (Sawyer::Resource?) branch_protection(repo, branch, options = {})

Get branch protection summary

Examples:

@client.branch_protection('octokit/octokit.rb', 'master')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • branch (String)

    Branch name

Returns:

  • (Sawyer::Resource, nil)

    Branch protection summary or nil if the branch is not protected

See Also:



524
525
526
527
528
529
530
531
# File 'lib/octokit/client/repositories.rb', line 524

def branch_protection(repo, branch, options = {})
  opts = ensure_api_media_type(:branch_protection, options)
  begin
    get "#{Repository.path repo}/branches/#{branch}/protection", opts
  rescue Octokit::BranchNotProtected
    nil
  end
end

- (Array<Sawyer::Resource>) branches(repo, options = {})

List branches

Requires authenticated client for private repos.

Examples:

Octokit.branches('octokit/octokit.rb')
@client.branches('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing branches.

See Also:



479
480
481
# File 'lib/octokit/client/repositories.rb', line 479

def branches(repo, options = {})
  paginate "#{Repository.path repo}/branches", options
end

- (Boolean) check_assignee(repo, assignee, options = {})

Check to see if a particular user is an assignee for a repository.

Examples:

Octokit.check_assignee('octokit/octokit.rb', 'andrew')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • assignee (String)

    User login to check

Returns:

  • (Boolean)

    True if assignable on project, false otherwise.

See Also:



574
575
576
# File 'lib/octokit/client/repositories.rb', line 574

def check_assignee(repo, assignee, options = {})
  boolean_from_response :get, "#{Repository.path repo}/assignees/#{assignee}", options
end

- (Boolean) collaborator?(repo, collaborator, options = {})

Checks if a user is a collaborator for a repo.

Requires authenticated client.

Examples:

@client.collaborator?('octokit/octokit.rb', 'holman')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • collaborator (String)

    Collaborator GitHub username to check.

Returns:

  • (Boolean)

    True if user is a collaborator, false otherwise.

See Also:



345
346
347
# File 'lib/octokit/client/repositories.rb', line 345

def collaborator?(repo, collaborator, options={})
  boolean_from_response :get, "#{Repository.path repo}/collaborators/#{collaborator}", options
end

- (Array<Sawyer::Resource>) collaborators(repo, options = {}) Also known as: collabs

List collaborators

Requires authenticated client for private repos.

Examples:

Octokit.collaborators('octokit/octokit.rb')
Octokit.collabs('octokit/octokit.rb')
@client.collabs('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing collaborating users.

See Also:



288
289
290
# File 'lib/octokit/client/repositories.rb', line 288

def collaborators(repo, options = {})
  paginate "#{Repository.path repo}/collaborators", options
end

- (Array<Sawyer::Resource>) contributors(repo, anon = nil, options = {}) Also known as: contribs

List contributors to a repo

Requires authenticated client for private repos.

Examples:

Octokit.contributors('octokit/octokit.rb', true)
Octokit.contribs('octokit/octokit.rb')
@client.contribs('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • anon (Boolean) (defaults to: nil)

    Set true to include anonymous contributors.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing users.

See Also:



382
383
384
385
# File 'lib/octokit/client/repositories.rb', line 382

def contributors(repo, anon = nil, options = {})
  options[:anon] = 1 if anon.to_s[/1|true/]
  paginate "#{Repository.path repo}/contributors", options
end

- (Sawyer::Resource) create_repository(name, options = {}) Also known as: create_repo, create

Create a repository for a user or organization

Parameters:

  • name (String)

    Name of the new repo

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :description (String)

    Description of the repo

  • :homepage (String)

    Home page of the repo

  • :private (String)

    true makes the repository private, and false makes it public.

  • :has_issues (String)

    true enables issues for this repo, false disables issues.

  • :has_wiki (String)

    true enables wiki for this repo, false disables wiki.

  • :has_downloads (String)

    true enables downloads for this repo, false disables downloads.

  • :organization (String)

    Short name for the org under which to create the repo.

  • :team_id (Integer)

    The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.

  • :auto_init (Boolean)

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

  • :gitignore_template (String)

    Desired language or platform .gitignore template to apply. Ignored if auto_init parameter is not provided.

Returns:

  • (Sawyer::Resource)

    Repository info for the new repository

See Also:



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/octokit/client/repositories.rb', line 154

def create_repository(name, options = {})
  opts = options.dup
  organization = opts.delete :organization
  opts.merge! :name => name

  if organization.nil?
    post 'user/repos', opts
  else
    post "#{Organization.path organization}/repos", opts
  end
end

- (Boolean) delete_repository(repo, options = {}) Also known as: delete_repo

Delete repository

Note: If OAuth is used, 'delete_repo' scope is required

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    true if repository was deleted

See Also:



175
176
177
# File 'lib/octokit/client/repositories.rb', line 175

def delete_repository(repo, options = {})
  boolean_from_response :delete, Repository.path(repo), options
end

- (Boolean) delete_subscription(repo, options = {})

Delete a repository subscription

Examples:

@client.delete_subscription("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Boolean)

    True if subscription deleted, false otherwise.

See Also:



625
626
627
# File 'lib/octokit/client/repositories.rb', line 625

def delete_subscription(repo, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/subscription", options
end

- (Sawyer::Resource) deploy_key(repo, id, options = {})

Get a single deploy key for a repo

Examples:

@client.deploy_key('octokit/octokit.rb', 8675309)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Deploy key ID.

Returns:

  • (Sawyer::Resource)

    Deploy key.

See Also:



222
223
224
# File 'lib/octokit/client/repositories.rb', line 222

def deploy_key(repo, id, options={})
  get "#{Repository.path repo}/keys/#{id}", options
end

- (Array<Sawyer::Resource>) deploy_keys(repo, options = {}) Also known as: list_deploy_keys

Get deploy keys on a repo

Requires authenticated client.

Examples:

@client.deploy_keys('octokit/octokit.rb')
@client.list_deploy_keys('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing deploy keys.

See Also:



209
210
211
# File 'lib/octokit/client/repositories.rb', line 209

def deploy_keys(repo, options = {})
  paginate "#{Repository.path repo}/keys", options
end

- (Sawyer::Resource) edit_deploy_key(repo, id, options) Also known as: update_deploy_key

Deprecated.

This method is no longer supported in the API

Edit a deploy key

Examples:

Update the key for a deploy key.

@client.edit_deploy_key('octokit/octokit.rb', 8675309, :key => 'ssh-rsa BBB...')
@client.update_deploy_key('octokit/octokit.rb', 8675309, :title => 'Uber', :key => 'ssh-rsa BBB...'))

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Deploy key ID.

  • options (Hash)

    Attributes to edit.

  • title (Hash)

    a customizable set of options

  • key (Hash)

    a customizable set of options

Returns:

  • (Sawyer::Resource)

    Updated deploy key.

See Also:



256
257
258
# File 'lib/octokit/client/repositories.rb', line 256

def edit_deploy_key(repo, id, options)
  patch "#{Repository.path repo}/keys/#{id}", options
end

- (Sawyer::Resource) edit_repository(repo, options = {}) Also known as: edit, update_repository, update

Edit a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

  • options (Hash) (defaults to: {})

    Repository information to update

Options Hash (options):

  • :name (String)

    Name of the repo

  • :description (String)

    Description of the repo

  • :homepage (String)

    Home page of the repo

  • :private (String)

    true makes the repository private, and false makes it public.

  • :has_issues (String)

    true enables issues for this repo, false disables issues.

  • :has_wiki (String)

    true enables wiki for this repo, false disables wiki.

  • :has_downloads (String)

    true enables downloads for this repo, false disables downloads.

  • :default_branch (String)

    Update the default branch for this repository.

Returns:

  • (Sawyer::Resource)

    Repository information

See Also:



47
48
49
50
51
# File 'lib/octokit/client/repositories.rb', line 47

def edit_repository(repo, options = {})
  repo = Repository.new(repo)
  options[:name] ||= repo.name
  patch "repos/#{repo}", options
end

- (Sawyer::Resource) fork(repo, options = {})

Fork a repository

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    Repository info for the new fork

See Also:



135
136
137
# File 'lib/octokit/client/repositories.rb', line 135

def fork(repo, options = {})
  post "#{Repository.path repo}/forks", options
end

- (Array<Sawyer::Resource>) forks(repo, options = {}) Also known as: network

List forks

Requires authenticated client for private repos.

Examples:

Octokit.forks('octokit/octokit.rb')
Octokit.network('octokit/octokit.rb')
@client.forks('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing repos.

See Also:



433
434
435
# File 'lib/octokit/client/repositories.rb', line 433

def forks(repo, options = {})
  paginate "#{Repository.path repo}/forks", options
end

- (Array<Sawyer::Resource>) languages(repo, options = {})

List languages of code in the repo.

Requires authenticated client for private repos.

Examples:

Octokit.languages('octokit/octokit.rb')
@client.languages('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of Hashes representing languages.

See Also:



449
450
451
# File 'lib/octokit/client/repositories.rb', line 449

def languages(repo, options = {})
  paginate "#{Repository.path repo}/languages", options
end

- (Sawyer::Resource) protect_branch(repo, branch, required_status_checks = {}, options = {})

Lock a single branch from a repository

Requires authenticated client

Examples:

@client.protect_branch('octokit/octokit.rb', 'master', foo)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • branch (String)

    Branch name

  • required_status_checks (Hash) (defaults to: {})

Returns:

  • (Sawyer::Resource)

    The protected branch

See Also:



507
508
509
510
511
512
513
# File 'lib/octokit/client/repositories.rb', line 507

def protect_branch(repo, branch, required_status_checks = {}, options = {})
  required_status_checks[:restrictions] ||= nil
  required_status_checks[:required_status_checks] ||= nil

  options = ensure_api_media_type(:branch_protection, options.merge(required_status_checks))
  put "#{Repository.path repo}/branches/#{branch}/protection", options
end

- (Boolean) remove_collaborator(repo, collaborator, options = {}) Also known as: remove_collab

Remove collaborator from repo.

Requires authenticated client.

Examples:

@client.remove_collaborator('octokit/octokit.rb', 'holman')
@client.remove_collab('octokit/octokit.rb', 'holman')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • collaborator (String)

    Collaborator GitHub username to remove.

Returns:

  • (Boolean)

    True if collaborator removed, false otherwise.

See Also:



330
331
332
# File 'lib/octokit/client/repositories.rb', line 330

def remove_collaborator(repo, collaborator, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/collaborators/#{collaborator}", options
end

- (Boolean) remove_deploy_key(repo, id, options = {})

Remove deploy key from a repo

Requires authenticated client.

Examples:

@client.remove_deploy_key('octokit/octokit.rb', 100000)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Id of the deploy key to remove.

Returns:

  • (Boolean)

    True if key removed, false otherwise.

See Also:



271
272
273
# File 'lib/octokit/client/repositories.rb', line 271

def remove_deploy_key(repo, id, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/keys/#{id}", options
end

- (Array<Sawyer::Resource>) repositories(user = nil, options = {}) Also known as: list_repositories, list_repos, repos

Note:

If the user provided is a GitHub organization, only the organization's public repositories will be listed. For retrieving organization repositories the Organizations#organization_repositories method should be used instead.

List user repositories

If user is not supplied, repositories for the current authenticated user are returned.

Parameters:

  • user (Integer, String) (defaults to: nil)

    Optional GitHub user login or id for which to list repos.

Returns:

  • (Array<Sawyer::Resource>)

    List of repositories

See Also:



70
71
72
# File 'lib/octokit/client/repositories.rb', line 70

def repositories(user=nil, options = {})
  paginate "#{User.path user}/repos", options
end

- (Sawyer::Resource) repository(repo, options = {}) Also known as: repo

Get a single repository

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    Repository information

See Also:



28
29
30
# File 'lib/octokit/client/repositories.rb', line 28

def repository(repo, options = {})
  get Repository.path(repo), options
end

- (Sawyer::Resource) repository?(repo, options = {})

Check if a repository exists

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    if a repository exists, false otherwise

See Also:



14
15
16
17
18
19
20
# File 'lib/octokit/client/repositories.rb', line 14

def repository?(repo, options = {})
  !!repository(repo, options)
rescue Octokit::InvalidRepository
  false
rescue Octokit::NotFound
  false
end

- (Array<Sawyer::Resource>) repository_assignees(repo, options = {}) Also known as: repo_assignees

List users available for assigning to issues.

Requires authenticated client for private repos.

Examples:

Octokit.repository_assignees('octokit/octokit.rb')
Octokit.repo_assignees('octokit/octokit.rb')
@client.repository_assignees('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing users.

See Also:



561
562
563
# File 'lib/octokit/client/repositories.rb', line 561

def repository_assignees(repo, options = {})
  paginate "#{Repository.path repo}/assignees", options
end

- (Array<Sawyer::Resource>) repository_teams(repo, options = {}) Also known as: repo_teams, teams

List teams for a repo

Requires authenticated client that is an owner or collaborator of the repo.

Examples:

@client.repository_teams('octokit/pengwynn')
@client.repo_teams('octokit/pengwynn')
@client.teams('octokit/pengwynn')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing teams.

See Also:



362
363
364
# File 'lib/octokit/client/repositories.rb', line 362

def repository_teams(repo, options = {})
  paginate "#{Repository.path repo}/teams", options
end

- (Sawyer::Resource) set_private(repo, options = {})

Hide a public repository

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    Updated repository info



184
185
186
187
# File 'lib/octokit/client/repositories.rb', line 184

def set_private(repo, options = {})
  # GitHub Api for setting private updated to use private attr, rather than public
  update_repository repo, options.merge({ :private => true })
end

- (Sawyer::Resource) set_public(repo, options = {})

Unhide a private repository

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    Updated repository info



193
194
195
196
# File 'lib/octokit/client/repositories.rb', line 193

def set_public(repo, options = {})
  # GitHub Api for setting private updated to use private attr, rather than public
  update_repository repo, options.merge({ :private => false })
end

- (Boolean) star(repo, options = {})

Star a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    true if successfully starred

See Also:



97
98
99
# File 'lib/octokit/client/repositories.rb', line 97

def star(repo, options = {})
  boolean_from_response :put, "user/starred/#{Repository.new(repo)}", options
end

- (Array<Sawyer::Resource>) stargazers(repo, options = {})

List stargazers of a repo

Requires authenticated client for private repos.

Examples:

Octokit.stargazers('octokit/octokit.rb')
@client.stargazers('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing users.

See Also:



399
400
401
# File 'lib/octokit/client/repositories.rb', line 399

def stargazers(repo, options = {})
  paginate "#{Repository.path repo}/stargazers", options
end

- (Array<Sawyer::Resource>) subscribers(repo, options = {})

List watchers subscribing to notifications for a repo

Examples:

@client.subscribers("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of users watching.

See Also:



585
586
587
# File 'lib/octokit/client/repositories.rb', line 585

def subscribers(repo, options = {})
  paginate "#{Repository.path repo}/subscribers", options
end

- (Sawyer::Resource) subscription(repo, options = {})

Get a repository subscription

Examples:

@client.subscription("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Sawyer::Resource)

    Repository subscription.

See Also:



596
597
598
# File 'lib/octokit/client/repositories.rb', line 596

def subscription(repo, options = {})
  get "#{Repository.path repo}/subscription", options
end

- (Array<Sawyer::Resource>) tags(repo, options = {})

List tags

Requires authenticated client for private repos.

Examples:

Octokit.tags('octokit/octokit.rb')
@client.tags('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing tags.

See Also:



464
465
466
# File 'lib/octokit/client/repositories.rb', line 464

def tags(repo, options = {})
  paginate "#{Repository.path repo}/tags", options
end

- (Sawyer::Resource) unprotect_branch(repo, branch, options = {})

Unlock a single branch from a repository

Requires authenticated client

Examples:

@client.unprotect_branch('octokit/octokit.rb', 'master')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • branch (String)

    Branch name

Returns:

  • (Sawyer::Resource)

    The unprotected branch

See Also:



543
544
545
546
# File 'lib/octokit/client/repositories.rb', line 543

def unprotect_branch(repo, branch, options = {})
  options = ensure_api_media_type(:branch_protection, options)
  delete "#{Repository.path repo}/branches/#{branch}/protection", options
end

- (Boolean) unstar(repo, options = {})

Unstar a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    true if successfully unstarred

See Also:



106
107
108
# File 'lib/octokit/client/repositories.rb', line 106

def unstar(repo, options = {})
  boolean_from_response :delete, "user/starred/#{Repository.new(repo)}", options
end

- (Boolean) unwatch(repo, options = {})

Deprecated.

Use #unstar instead

Unwatch a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    true if successfully unwatched

See Also:



126
127
128
# File 'lib/octokit/client/repositories.rb', line 126

def unwatch(repo, options = {})
  boolean_from_response :delete, "user/watched/#{Repository.new(repo)}", options
end

- (Sawyer::Resource) update_subscription(repo, options = {})

Update repository subscription

Examples:

Subscribe to notifications for a repository

@client.update_subscription("octokit/octokit.rb", {subscribed: true})

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :subscribed (Boolean)

    Determines if notifications should be received from this repository.

  • :ignored (Boolean)

    Deterimines if all notifications should be blocked from this repository.

Returns:

  • (Sawyer::Resource)

    Updated repository subscription.

See Also:



613
614
615
# File 'lib/octokit/client/repositories.rb', line 613

def update_subscription(repo, options = {})
  put "#{Repository.path repo}/subscription", options
end

- (Boolean) watch(repo, options = {})

Deprecated.

Use #star instead

Watch a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    true if successfully watched

See Also:



116
117
118
# File 'lib/octokit/client/repositories.rb', line 116

def watch(repo, options = {})
  boolean_from_response :put, "user/watched/#{Repository.new(repo)}", options
end

- (Array<Sawyer::Resource>) watchers(repo, options = {})

Deprecated.

Use #stargazers instead

List watchers of repo.

Requires authenticated client for private repos.

Examples:

Octokit.watchers('octokit/octokit.rb')
@client.watchers('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing users.

See Also:



416
417
418
# File 'lib/octokit/client/repositories.rb', line 416

def watchers(repo, options = {})
  paginate "#{Repository.path repo}/watchers", options
end