Module: Octokit::Client::Repositories

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

Instance Method Summary collapse

Instance Method Details

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

Add collaborator to repo

Requires authenticated client.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • collaborator (String)

    Collaborator GitHub username to add.

Returns:

  • (Boolean)

    True if collaborator added, false otherwise.

See Also:



261
262
263
# File 'lib/octokit/client/repositories.rb', line 261

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

#add_deploy_key(repo, title, key, options = {}) ⇒ Hashie::Mash

Add deploy key to a repo

Requires authenticated client.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • title (String)

    Title reference for the deploy key.

  • key (String)

    Public key.

Returns:

  • (Hashie::Mash)

    Hash representing newly added key.

See Also:



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

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

#all_repositories(options = {}) ⇒ Array

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)

    List of repositories.

See Also:



77
78
79
# File 'lib/octokit/client/repositories.rb', line 77

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

#branch(repo, branch, options = {}) ⇒ Branch Also known as: get_branch

Get a single branch from a repository

Examples:

Get branch ‘master` from pengwynn/octokit

Octokit.issue("pengwynn/octokit", "master")

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • branch (String)

    Branch name

Returns:

  • (Branch)

    The branch requested, if it exists

See Also:



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

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

#branches(repo, options = {}) ⇒ Array<Hashie::Mash>

List branches

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing branches.

See Also:



422
423
424
# File 'lib/octokit/client/repositories.rb', line 422

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

#collaborators(repo, options = {}) ⇒ Array<Hashie::Mash> Also known as: collabs

List collaborators

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing collaborating users.

See Also:



243
244
245
# File 'lib/octokit/client/repositories.rb', line 243

def collaborators(repo, options={})
  get "repos/#{Repository.new repo}/collaborators", options
end

#contributors(repo, anon = false, options = {}) ⇒ Array<Hashie::Mash> Also known as: contribs

List contributors to a repo

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • anon (Boolean) (defaults to: false)

    Set true to include annonymous contributors.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing users.

See Also:



319
320
321
# File 'lib/octokit/client/repositories.rb', line 319

def contributors(repo, anon=false, options={})
  get "repos/#{Repository.new repo}/contributors", options.merge(:anon => anon)
end

#create_hook(repo, name, config, options = {}) ⇒ Object

Create a hook

Requires authenticated client.

Examples:

@client.create_hook(
  'pengwynn/octokit',
  'web',
  {
    :url => 'http://something.com/webhook',
    :content_type => 'json'
  },
  {
    :events => ['push', 'pull_request'],
    :active => true
  }
)

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • name (String)

    The name of the service that is being called. See Hooks for the possible names.

  • config (Hash)

    A Hash containing key/value pairs to provide settings for this hook. These settings vary between the services and are defined in the github-services repo.

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

    a customizable set of options

Options Hash (options):

  • :events (Array<String>) — default: '["push"]'

    Determines what events the hook is triggered for.

  • :active (Boolean)

    Determines whether the hook is actually triggered on pushes.

See Also:



499
500
501
502
# File 'lib/octokit/client/repositories.rb', line 499

def create_hook(repo, name, config, options={})
  options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
  post "repos/#{Repository.new repo}/hooks", options
end

#create_repository(name, options = {}) ⇒ Hashie::Mash 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:

  • (Hashie::Mash)

    Repository info for the new repository

See Also:



138
139
140
141
142
143
144
145
146
147
# File 'lib/octokit/client/repositories.rb', line 138

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

  if organization.nil?
    post 'user/repos', options
  else
    post "orgs/#{organization}/repos", options
  end
end

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

Delete repository

Note: If OAuth is used, ‘delete_repo’ scope is required

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    ‘true` if repository was deleted

See Also:



158
159
160
# File 'lib/octokit/client/repositories.rb', line 158

def delete_repository(repo, options={})
  boolean_from_response(:delete, "repos/#{Repository.new repo}", options)
end

#delete_subscription(repo, options = {}) ⇒ Boolean

Delete a repository subscription

Examples:

@client.delete_subscription("pengwynn/octokit")

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Boolean)

    True if subscription deleted, false otherwise.

See Also:



667
668
669
# File 'lib/octokit/client/repositories.rb', line 667

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

#deploy_keys(repo, options = {}) ⇒ Array<Hashie::Mash> Also known as: list_deploy_keys

Get deploy keys on a repo

Requires authenticated client.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing deploy keys.

See Also:



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

def deploy_keys(repo, options={})
  get "repos/#{Repository.new repo}/keys", options
end

#edit_hook(repo, id, name, config, options = {}) ⇒ Object

Edit a hook

Requires authenticated client.

Examples:

@client.edit_hook(
  'pengwynn/octokit',
  'web',
  {
    :url => 'http://something.com/webhook',
    :content_type => 'json'
  },
  {
    :add_events => ['status'],
    :remove_events => ['pull_request'],
    :active => true
  }
)

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Id of the hook being updated.

  • name (String)

    The name of the service that is being called. See Hooks for the possible names.

  • config (Hash)

    A Hash containing key/value pairs to provide settings for this hook. These settings vary between the services and are defined in the github-services repo.

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

    a customizable set of options

Options Hash (options):

  • :events (Array<String>) — default: '["push"]'

    Determines what events the hook is triggered for.

  • :add_events (Array<String>)

    Determines a list of events to be added to the list of events that the Hook triggers for.

  • :remove_events (Array<String>)

    Determines a list of events to be removed from the list of events that the Hook triggers for.

  • :active (Boolean)

    Determines whether the hook is actually triggered on pushes.

See Also:



541
542
543
544
# File 'lib/octokit/client/repositories.rb', line 541

def edit_hook(repo, id, name, config, options={})
  options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
  patch "repos/#{Repository.new repo}/hooks/#{id}", options
end

#edit_repository(repo, options = {}) ⇒ Hashie::Mash 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:

  • (Hashie::Mash)

    Repository information

See Also:



39
40
41
# File 'lib/octokit/client/repositories.rb', line 39

def edit_repository(repo, options={})
  patch "repos/#{Repository.new repo}", options
end

#fork(repo, options = {}) ⇒ Hashie::Mash

Fork a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Hashie::Mash)

    Repository info for the new fork



119
120
121
# File 'lib/octokit/client/repositories.rb', line 119

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

#forks(repo, options = {}) ⇒ Array<Hashie::Mash> Also known as: network

List forks

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing repos.

See Also:



373
374
375
# File 'lib/octokit/client/repositories.rb', line 373

def forks(repo, options={})
  get "repos/#{Repository.new repo}/forks", options
end

#hook(repo, id, options = {}) ⇒ Hashie::Mash

Get single hook

Requires authenticated client.

Examples:

@client.hook('pengwynn/octokit', 100000)

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Id of the hook to get.

Returns:

  • (Hashie::Mash)

    Hash representing hook.

See Also:



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

def hook(repo, id, options={})
  get "repos/#{Repository.new repo}/hooks/#{id}", options
end

#hooks(repo, options = {}) ⇒ Array<Hashie::Mash>

List repo hooks

Requires authenticated client.

Examples:

@client.hooks('pengwynn/octokit')

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing hooks.

See Also:



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

def hooks(repo, options={})
  get "repos/#{Repository.new repo}/hooks", options
end

#languages(repo, options = {}) ⇒ Array<Hashie::Mash>

List languages of code in the repo.

Requires authenticated client for private repos.

Examples:

Octokit.langauges('pengwynn/octokit')
@client.languages('pengwynn/octokit')

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of Hashes representing languages.

See Also:



390
391
392
# File 'lib/octokit/client/repositories.rb', line 390

def languages(repo, options={})
  get "repos/#{Repository.new repo}/languages", options
end

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

Remove collaborator from repo.

Requires authenticated client.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • collaborator (String)

    Collaborator GitHub username to remove.

Returns:

  • (Boolean)

    True if collaborator removed, false otherwise.

See Also:



279
280
281
# File 'lib/octokit/client/repositories.rb', line 279

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

#remove_deploy_key(repo, id, options = {}) ⇒ Boolean

Remove deploy key from a repo

Requires authenticated client.

Examples:

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

Parameters:

  • repo (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:



225
226
227
# File 'lib/octokit/client/repositories.rb', line 225

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

#remove_hook(repo, id, options = {}) ⇒ Boolean

Delete hook

Requires authenticated client.

Examples:

@client.remove_hook('pengwynn/octokit', 1000000)

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Id of the hook to remove.

Returns:

  • (Boolean)

    True if hook removed, false otherwise.

See Also:



557
558
559
# File 'lib/octokit/client/repositories.rb', line 557

def remove_hook(repo, id, options={})
  boolean_from_response(:delete, "repos/#{Repository.new repo}/hooks/#{id}", options)
end

#repositories(username = nil, options = {}) ⇒ Array<Hashie::Mash> Also known as: list_repositories, list_repos, repos

List repositories

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

Parameters:

  • username (String) (defaults to: nil)

    Optional username for which to list repos

Returns:

  • (Array<Hashie::Mash>)

    List of repositories

See Also:



54
55
56
57
58
59
60
# File 'lib/octokit/client/repositories.rb', line 54

def repositories(username=nil, options={})
  if username.nil?
    get 'user/repos', options
  else
    get "users/#{username}/repos", options
  end
end

#repository(repo, options = {}) ⇒ Hashie::Mash Also known as: repo

Get a single repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Hashie::Mash)

    Repository information

See Also:



20
21
22
# File 'lib/octokit/client/repositories.rb', line 20

def repository(repo, options={})
  get "repos/#{Repository.new repo}", options
end

#repository_assignees(repo, options = {}) ⇒ Array<Hashie::Mash> Also known as: repo_assignees

List users available for assigning to issues.

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing users.

See Also:



603
604
605
# File 'lib/octokit/client/repositories.rb', line 603

def repository_assignees(repo, options={})
  get "repos/#{Repository.new repo}/assignees", options
end

#repository_issue_events(repo, options = {}) ⇒ Array Also known as: repo_issue_events

Get all Issue Events for a given Repository

Examples:

Get all Issue Events for Octokit

Octokit.repository_issue_events("pengwynn/octokit")

Parameters:

  • repo (String, Repository, Hash)

    A GitHub repository

Returns:

  • (Array)

    Array of all Issue Events for this Repository

See Also:



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

def repository_issue_events(repo, options={})
  get "repos/#{Repository.new repo}/issues/events", options
end

#repository_teams(repo, options = {}) ⇒ Array<Hashie::Mash> 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 (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing teams.

See Also:



298
299
300
# File 'lib/octokit/client/repositories.rb', line 298

def repository_teams(repo, options={})
  get "repos/#{Repository.new repo}/teams", options
end

#search_repositories(q, options = {}) ⇒ Array<Hashie::Mash> Also known as: search_repos

Legacy repository search

Parameters:

  • q (String)

    Search keyword

Returns:

  • (Array<Hashie::Mash>)

    List of repositories found

See Also:



10
11
12
# File 'lib/octokit/client/repositories.rb', line 10

def search_repositories(q, options={})
  get("legacy/repos/search/#{q}", options)['repositories']
end

#set_private(repo, options = {}) ⇒ Hashie::Mash

Hide a public repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Hashie::Mash)

    Updated repository info



167
168
169
170
# File 'lib/octokit/client/repositories.rb', line 167

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

#set_public(repo, options = {}) ⇒ Hashie::Mash

Unhide a private repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Hashie::Mash)

    Updated repository info



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

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

#star(repo, options = {}) ⇒ Boolean

Star a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    ‘true` if successfully starred



85
86
87
# File 'lib/octokit/client/repositories.rb', line 85

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

#stargazers(repo, options = {}) ⇒ Array<Hashie::Mash>

List stargazers of a repo

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing users.

See Also:



336
337
338
# File 'lib/octokit/client/repositories.rb', line 336

def stargazers(repo, options={})
  get "repos/#{Repository.new repo}/stargazers", options
end

#subscribers(repo, options = {}) ⇒ Array

List watchers subscribing to notifications for a repo

Examples:

@client.subscribers("pengwynn/octokit")

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array)

    Array of users watching.

See Also:



618
619
620
# File 'lib/octokit/client/repositories.rb', line 618

def subscribers(repo, options={})
  get("repos/#{Repository.new repo}/subscribers", options)
end

#subscription(repo, options = {}) ⇒ Hashie::Mash

Get a repository subscription

Examples:

@client.subscription("pengwynn/octokit")

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Hashie::Mash)

    Repository subscription.

See Also:



632
633
634
# File 'lib/octokit/client/repositories.rb', line 632

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

#tags(repo, options = {}) ⇒ Array<Hashie::Mash>

List tags

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing tags.

See Also:



406
407
408
# File 'lib/octokit/client/repositories.rb', line 406

def tags(repo, options={})
  get "repos/#{Repository.new repo}/tags", options
end

#test_hook(repo, id, options = {}) ⇒ nil

Test hook

Requires authenticated client.

Examples:

@client.test_hook('pengwynn/octokit', 1000000)

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

  • id (Integer)

    Id of the hook to test.

Returns:

  • (nil)

See Also:



572
573
574
# File 'lib/octokit/client/repositories.rb', line 572

def test_hook(repo, id, options={})
  boolean_from_response(:post, "repos/#{Repository.new repo}/hooks/#{id}/tests", options)
end

#unstar(repo, options = {}) ⇒ Boolean

Unstar a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    ‘true` if successfully unstarred



93
94
95
# File 'lib/octokit/client/repositories.rb', line 93

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

#unwatch(repo, options = {}) ⇒ Boolean

Deprecated.

Use #unstar instead

Unwatch a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    ‘true` if successfully unwatched



111
112
113
# File 'lib/octokit/client/repositories.rb', line 111

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

#update_subscription(repo, options = {}) ⇒ Hashie::Mash

Update repository subscription

Examples:

Subscribe to notifications for a repository

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

Parameters:

  • repo (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:

  • (Hashie::Mash)

    Updated repository subscription.

See Also:



653
654
655
# File 'lib/octokit/client/repositories.rb', line 653

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

#watch(repo, options = {}) ⇒ Boolean

Deprecated.

Use #star instead

Watch a repository

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository

Returns:

  • (Boolean)

    ‘true` if successfully watched



102
103
104
# File 'lib/octokit/client/repositories.rb', line 102

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

#watchers(repo, options = {}) ⇒ Array<Hashie::Mash>

Deprecated.

Use #stargazers instead

List watchers of repo.

Requires authenticated client for private repos.

Examples:

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

Parameters:

  • repo (String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing users.

See Also:



355
356
357
# File 'lib/octokit/client/repositories.rb', line 355

def watchers(repo, options={})
  get "repos/#{Repository.new repo}/watchers", options
end