Module: Octokit::Client::Repositories
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/repositories.rb
Instance Method Summary (collapse)
-
- (Boolean) add_collaborator(repo, collaborator, options = {})
(also: #add_collab)
Add collaborator to repo.
-
- (Hashie::Mash) add_deploy_key(repo, title, key, options = {})
Add deploy key to a repo.
-
- (Array) all_repositories(options = {})
List all repositories.
-
- (Branch) branch(repo, branch, options = {})
(also: #get_branch)
Get a single branch from a repository.
-
- (Array<Hashie::Mash>) branches(repo, options = {})
List branches.
-
- (Boolean) check_assignee(repo, assignee, options = {})
Check to see if a particular user is an assignee for a repository.
-
- (Array<Hashie::Mash>) collaborators(repo, options = {})
(also: #collabs)
List collaborators.
-
- (Array<Hashie::Mash>) contributors(repo, anon = false, options = {})
(also: #contribs)
List contributors to a repo.
-
- (Object) create_hook(repo, name, config, options = {})
Create a hook.
-
- (Hashie::Mash) create_repository(name, options = {})
(also: #create_repo, #create)
Create a repository for a user or organization.
-
- (Boolean) delete_repository(repo, options = {})
(also: #delete_repo)
Delete repository.
-
- (Boolean) delete_subscription(repo, options = {})
Delete a repository subscription.
-
- (Array<Hashie::Mash>) deploy_keys(repo, options = {})
(also: #list_deploy_keys)
Get deploy keys on a repo.
-
- (Object) edit_hook(repo, id, name, config, options = {})
Edit a hook.
-
- (Hashie::Mash) edit_repository(repo, options = {})
(also: #edit, #update_repository, #update)
Edit a repository.
-
- (Hashie::Mash) fork(repo, options = {})
Fork a repository.
-
- (Array<Hashie::Mash>) forks(repo, options = {})
(also: #network)
List forks.
-
- (Hashie::Mash) hook(repo, id, options = {})
Get single hook.
-
- (Array<Hashie::Mash>) hooks(repo, options = {})
List repo hooks.
-
- (Array<Hashie::Mash>) languages(repo, options = {})
List languages of code in the repo.
-
- (Boolean) remove_collaborator(repo, collaborator, options = {})
(also: #remove_collab)
Remove collaborator from repo.
-
- (Boolean) remove_deploy_key(repo, id, options = {})
Remove deploy key from a repo.
-
- (Boolean) remove_hook(repo, id, options = {})
Delete hook.
-
- (Array<Hashie::Mash>) repositories(username = nil, options = {})
(also: #list_repositories, #list_repos, #repos)
List repositories.
-
- (Hashie::Mash) repository(repo, options = {})
(also: #repo)
Get a single repository.
-
- (Array<Hashie::Mash>) repository_assignees(repo, options = {})
(also: #repo_assignees)
List users available for assigning to issues.
-
- (Array) repository_issue_events(repo, options = {})
(also: #repo_issue_events)
Get all Issue Events for a given Repository.
-
- (Array<Hashie::Mash>) repository_teams(repo, options = {})
(also: #repo_teams, #teams)
List teams for a repo.
-
- (Array<Hashie::Mash>) search_repositories(q, options = {})
(also: #search_repos)
Legacy repository search.
-
- (Hashie::Mash) set_private(repo, options = {})
Hide a public repository.
-
- (Hashie::Mash) set_public(repo, options = {})
Unhide a private repository.
-
- (Boolean) star(repo, options = {})
Star a repository.
-
- (Array<Hashie::Mash>) stargazers(repo, options = {})
List stargazers of a repo.
-
- (Array) subscribers(repo, options = {})
List watchers subscribing to notifications for a repo.
-
- (Hashie::Mash) subscription(repo, options = {})
Get a repository subscription.
-
- (Array<Hashie::Mash>) tags(repo, options = {})
List tags.
-
- (nil) test_hook(repo, id, options = {})
Test hook.
-
- (Boolean) unstar(repo, options = {})
Unstar a repository.
-
- (Boolean) unwatch(repo, options = {})
deprecated
Deprecated.
Use #unstar instead
-
- (Hashie::Mash) update_subscription(repo, options = {})
Update repository subscription.
-
- (Boolean) watch(repo, options = {})
deprecated
Deprecated.
Use #star instead
-
- (Array<Hashie::Mash>) watchers(repo, options = {})
deprecated
Deprecated.
Use #stargazers instead
Instance Method Details
- (Boolean) add_collaborator(repo, collaborator, options = {}) Also known as: add_collab
Add collaborator to repo
Requires authenticated client.
261 262 263 |
# File 'lib/octokit/client/repositories.rb', line 261 def add_collaborator(repo, collaborator, ={}) boolean_from_response(:put, "repos/#{Repository.new repo}/collaborators/#{collaborator}", ) end |
- (Hashie::Mash) add_deploy_key(repo, title, key, options = {})
Add deploy key to a repo
Requires authenticated client.
210 211 212 |
# File 'lib/octokit/client/repositories.rb', line 210 def add_deploy_key(repo, title, key, ={}) post "repos/#{Repository.new repo}/keys", .merge(:title => title, :key => key) end |
- (Array) all_repositories(options = {})
List all repositories
This provides a dump of every repository, in the order that they were created.
77 78 79 |
# File 'lib/octokit/client/repositories.rb', line 77 def all_repositories(={}) get '/repositories', end |
- (Branch) branch(repo, branch, options = {}) Also known as: get_branch
Get a single branch from a repository
434 435 436 |
# File 'lib/octokit/client/repositories.rb', line 434 def branch(repo, branch, ={}) get "repos/#{Repository.new repo}/branches/#{branch}", end |
- (Array<Hashie::Mash>) branches(repo, options = {})
List branches
Requires authenticated client for private repos.
422 423 424 |
# File 'lib/octokit/client/repositories.rb', line 422 def branches(repo, ={}) get "repos/#{Repository.new repo}/branches", end |
- (Boolean) check_assignee(repo, assignee, options = {})
Check to see if a particular user is an assignee for a repository.
617 618 619 |
# File 'lib/octokit/client/repositories.rb', line 617 def check_assignee(repo, assignee, ={}) boolean_from_response(:get, "repos/#{Repository.new repo}/assignees/#{assignee}", ) end |
- (Array<Hashie::Mash>) collaborators(repo, options = {}) Also known as: collabs
List collaborators
Requires authenticated client for private repos.
243 244 245 |
# File 'lib/octokit/client/repositories.rb', line 243 def collaborators(repo, ={}) get "repos/#{Repository.new repo}/collaborators", end |
- (Array<Hashie::Mash>) contributors(repo, anon = false, options = {}) Also known as: contribs
List contributors to a repo
Requires authenticated client for private repos.
319 320 321 |
# File 'lib/octokit/client/repositories.rb', line 319 def contributors(repo, anon=false, ={}) get "repos/#{Repository.new repo}/contributors", .merge(:anon => anon) end |
- (Object) create_hook(repo, name, config, options = {})
Create a hook
Requires authenticated client.
499 500 501 502 |
# File 'lib/octokit/client/repositories.rb', line 499 def create_hook(repo, name, config, ={}) = {:name => name, :config => config, :events => ["push"], :active => true}.merge() post "repos/#{Repository.new repo}/hooks", end |
- (Hashie::Mash) create_repository(name, options = {}) Also known as: create_repo, create
Create a repository for a user or organization
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/octokit/client/repositories.rb', line 138 def create_repository(name, ={}) organization = .delete :organization .merge! :name => name if organization.nil? post 'user/repos', else post "orgs/#{organization}/repos", end end |
- (Boolean) delete_repository(repo, options = {}) Also known as: delete_repo
Delete repository
Note: If OAuth is used, 'delete_repo' scope is required
158 159 160 |
# File 'lib/octokit/client/repositories.rb', line 158 def delete_repository(repo, ={}) boolean_from_response(:delete, "repos/#{Repository.new repo}", ) end |
- (Boolean) delete_subscription(repo, options = {})
Delete a repository subscription
680 681 682 |
# File 'lib/octokit/client/repositories.rb', line 680 def delete_subscription(repo, ={}) boolean_from_response(:delete, "repos/#{Repository.new repo}/subscription", ) end |
- (Array<Hashie::Mash>) deploy_keys(repo, options = {}) Also known as: list_deploy_keys
Get deploy keys on a repo
Requires authenticated client.
193 194 195 |
# File 'lib/octokit/client/repositories.rb', line 193 def deploy_keys(repo, ={}) get "repos/#{Repository.new repo}/keys", end |
- (Object) edit_hook(repo, id, name, config, options = {})
Edit a hook
Requires authenticated client.
541 542 543 544 |
# File 'lib/octokit/client/repositories.rb', line 541 def edit_hook(repo, id, name, config, ={}) = {:name => name, :config => config, :events => ["push"], :active => true}.merge() patch "repos/#{Repository.new repo}/hooks/#{id}", end |
- (Hashie::Mash) edit_repository(repo, options = {}) Also known as: edit, update_repository, update
Edit a repository
39 40 41 |
# File 'lib/octokit/client/repositories.rb', line 39 def edit_repository(repo, ={}) patch "repos/#{Repository.new repo}", end |
- (Hashie::Mash) fork(repo, options = {})
Fork a repository
119 120 121 |
# File 'lib/octokit/client/repositories.rb', line 119 def fork(repo, ={}) post "repos/#{Repository.new repo}/forks", end |
- (Array<Hashie::Mash>) forks(repo, options = {}) Also known as: network
List forks
Requires authenticated client for private repos.
373 374 375 |
# File 'lib/octokit/client/repositories.rb', line 373 def forks(repo, ={}) get "repos/#{Repository.new repo}/forks", end |
- (Hashie::Mash) hook(repo, id, options = {})
Get single hook
Requires authenticated client.
464 465 466 |
# File 'lib/octokit/client/repositories.rb', line 464 def hook(repo, id, ={}) get "repos/#{Repository.new repo}/hooks/#{id}", end |
- (Array<Hashie::Mash>) hooks(repo, options = {})
List repo hooks
Requires authenticated client.
449 450 451 |
# File 'lib/octokit/client/repositories.rb', line 449 def hooks(repo, ={}) get "repos/#{Repository.new repo}/hooks", end |
- (Array<Hashie::Mash>) languages(repo, options = {})
List languages of code in the repo.
Requires authenticated client for private repos.
390 391 392 |
# File 'lib/octokit/client/repositories.rb', line 390 def languages(repo, ={}) get "repos/#{Repository.new repo}/languages", end |
- (Boolean) remove_collaborator(repo, collaborator, options = {}) Also known as: remove_collab
Remove collaborator from repo.
Requires authenticated client.
279 280 281 |
# File 'lib/octokit/client/repositories.rb', line 279 def remove_collaborator(repo, collaborator, ={}) boolean_from_response(:delete, "repos/#{Repository.new repo}/collaborators/#{collaborator}", ) end |
- (Boolean) remove_deploy_key(repo, id, options = {})
Remove deploy key from a repo
Requires authenticated client.
225 226 227 |
# File 'lib/octokit/client/repositories.rb', line 225 def remove_deploy_key(repo, id, ={}) boolean_from_response(:delete, "repos/#{Repository.new repo}/keys/#{id}", ) end |
- (Boolean) remove_hook(repo, id, options = {})
Delete hook
Requires authenticated client.
557 558 559 |
# File 'lib/octokit/client/repositories.rb', line 557 def remove_hook(repo, id, ={}) boolean_from_response(:delete, "repos/#{Repository.new repo}/hooks/#{id}", ) end |
- (Array<Hashie::Mash>) repositories(username = nil, options = {}) Also known as: list_repositories, list_repos, repos
List repositories
If username is not supplied, repositories for the current authenticated user are returned
54 55 56 57 58 59 60 |
# File 'lib/octokit/client/repositories.rb', line 54 def repositories(username=nil, ={}) if username.nil? get 'user/repos', else get "users/#{username}/repos", end end |
- (Hashie::Mash) repository(repo, options = {}) Also known as: repo
Get a single repository
20 21 22 |
# File 'lib/octokit/client/repositories.rb', line 20 def repository(repo, ={}) get "repos/#{Repository.new repo}", end |
- (Array<Hashie::Mash>) repository_assignees(repo, options = {}) Also known as: repo_assignees
List users available for assigning to issues.
Requires authenticated client for private repos.
603 604 605 |
# File 'lib/octokit/client/repositories.rb', line 603 def repository_assignees(repo, ={}) get "repos/#{Repository.new repo}/assignees", end |
- (Array) repository_issue_events(repo, options = {}) Also known as: repo_issue_events
Get all Issue Events for a given Repository
584 585 586 |
# File 'lib/octokit/client/repositories.rb', line 584 def repository_issue_events(repo, ={}) get "repos/#{Repository.new repo}/issues/events", end |
- (Array<Hashie::Mash>) 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.
298 299 300 |
# File 'lib/octokit/client/repositories.rb', line 298 def repository_teams(repo, ={}) get "repos/#{Repository.new repo}/teams", end |
- (Array<Hashie::Mash>) search_repositories(q, options = {}) Also known as: search_repos
Legacy repository search
10 11 12 |
# File 'lib/octokit/client/repositories.rb', line 10 def search_repositories(q, ={}) get("legacy/repos/search/#{q}", )['repositories'] end |
- (Hashie::Mash) set_private(repo, options = {})
Hide a public repository
167 168 169 170 |
# File 'lib/octokit/client/repositories.rb', line 167 def set_private(repo, ={}) # GitHub Api for setting private updated to use private attr, rather than public update_repository repo, .merge({ :private => true }) end |
- (Hashie::Mash) set_public(repo, options = {})
Unhide a private repository
176 177 178 179 |
# File 'lib/octokit/client/repositories.rb', line 176 def set_public(repo, ={}) # GitHub Api for setting private updated to use private attr, rather than public update_repository repo, .merge({ :private => false }) end |
- (Boolean) star(repo, options = {})
Star a repository
85 86 87 |
# File 'lib/octokit/client/repositories.rb', line 85 def star(repo, ={}) boolean_from_response(:put, "user/starred/#{Repository.new repo}", ) end |
- (Array<Hashie::Mash>) stargazers(repo, options = {})
List stargazers of a repo
Requires authenticated client for private repos.
336 337 338 |
# File 'lib/octokit/client/repositories.rb', line 336 def stargazers(repo, ={}) get "repos/#{Repository.new repo}/stargazers", end |
- (Array) subscribers(repo, options = {})
List watchers subscribing to notifications for a repo
631 632 633 |
# File 'lib/octokit/client/repositories.rb', line 631 def subscribers(repo, ={}) get("repos/#{Repository.new repo}/subscribers", ) end |
- (Hashie::Mash) subscription(repo, options = {})
Get a repository subscription
645 646 647 |
# File 'lib/octokit/client/repositories.rb', line 645 def subscription(repo, ={}) get("repos/#{Repository.new repo}/subscription", ) end |
- (Array<Hashie::Mash>) tags(repo, options = {})
List tags
Requires authenticated client for private repos.
406 407 408 |
# File 'lib/octokit/client/repositories.rb', line 406 def (repo, ={}) get "repos/#{Repository.new repo}/tags", end |
- (nil) test_hook(repo, id, options = {})
Test hook
Requires authenticated client.
572 573 574 |
# File 'lib/octokit/client/repositories.rb', line 572 def test_hook(repo, id, ={}) boolean_from_response(:post, "repos/#{Repository.new repo}/hooks/#{id}/tests", ) end |
- (Boolean) unstar(repo, options = {})
Unstar a repository
93 94 95 |
# File 'lib/octokit/client/repositories.rb', line 93 def unstar(repo, ={}) boolean_from_response(:delete, "user/starred/#{Repository.new repo}", ) end |
- (Boolean) unwatch(repo, options = {})
Use #unstar instead
Unwatch a repository
111 112 113 |
# File 'lib/octokit/client/repositories.rb', line 111 def unwatch(repo, ={}) boolean_from_response(:delete, "user/watched/#{Repository.new repo}", ) end |
- (Hashie::Mash) update_subscription(repo, options = {})
Update repository subscription
666 667 668 |
# File 'lib/octokit/client/repositories.rb', line 666 def update_subscription(repo, ={}) put("repos/#{Repository.new repo}/subscription", ) end |
- (Boolean) watch(repo, options = {})
Use #star instead
Watch a repository
102 103 104 |
# File 'lib/octokit/client/repositories.rb', line 102 def watch(repo, ={}) boolean_from_response(:put, "user/watched/#{Repository.new repo}", ) end |
- (Array<Hashie::Mash>) watchers(repo, options = {})
Use #stargazers instead
List watchers of repo.
Requires authenticated client for private repos.
355 356 357 |
# File 'lib/octokit/client/repositories.rb', line 355 def watchers(repo, ={}) get "repos/#{Repository.new repo}/watchers", end |