Module: GitHub::Client::Repos
- Included in:
- GitHub::Client
- Defined in:
- lib/github_api_v3/client/repos.rb
Overview
Contains methods for the Repos API.
Instance Method Summary collapse
-
#add_collaborator(owner, repo, user) ⇒ Boolean
Add a collaborator to a repository.
-
#all_repos ⇒ Array
List all repositories.
-
#assignee?(owner, repo, assignee) ⇒ Boolean
Check to see if a particular user is an assignee for a repository.
-
#assignees(owner, repo) ⇒ Array
List available assignees (owner + collaborators) to which issues may be assigned.
-
#branch(owner, repo, branch) ⇒ Object
Get information about a branch.
-
#branches(owner, repo) ⇒ Array
List branches for a repository.
-
#collaborator?(owner, repo, user) ⇒ Boolean
Determine if a user is a collaborator to a repository.
-
#collaborators(owner, repo) ⇒ Array
Get list of collaborators for a repository.
-
#contributors(owner, repo) ⇒ Array
List contributors for a repository.
-
#create_repo(name, options = {}) ⇒ Hash
Create a repository.
-
#delete_repo(owner, repo) ⇒ Boolean
Delete a repository.
-
#edit_repo(owner, repo, options = {}) ⇒ Hash
Edit a repository.
-
#languages(owner, repo) ⇒ Hash
List languages for a repository.
-
#org_repos(org) ⇒ Array
Get organization repositories.
-
#remove_collaborator(owner, repo, user) ⇒ Boolean
Remove a collaborator from a repository.
-
#repo(owner, repo) ⇒ Hash
Get one repository.
-
#repos(username = nil) ⇒ Array
Get all repositories for a user.
-
#star(owner, repo) ⇒ Boolean
Star a repository.
-
#stargazers(owner, repo) ⇒ Array
List Stargazers for a repository.
-
#subscribe(owner, repo, options = {}) ⇒ Hash
Set a repository subscription.
-
#subscription(owner, repo) ⇒ Hash
Get subscription information.
-
#tags(owner, repo) ⇒ Array
List tags for a repository.
-
#unstar(owner, repo) ⇒ Boolean
Unstar a repository.
-
#unsubscribe(owner, repo) ⇒ Hash
Delete a repository subscription.
-
#watchers(owner, repo) ⇒ Array
List Watchers for a repository.
Instance Method Details
#add_collaborator(owner, repo, user) ⇒ Boolean
Add a collaborator to a repository.
Requires authentication.
219 220 221 |
# File 'lib/github_api_v3/client/repos.rb', line 219 def add_collaborator(owner, repo, user) boolean_request :put, "/repos/#{owner}/#{repo}/collaborators/#{user}" end |
#all_repos ⇒ Array
List all repositories
Get a list of all repositories.
15 16 17 |
# File 'lib/github_api_v3/client/repos.rb', line 15 def all_repos get '/repositories' end |
#assignee?(owner, repo, assignee) ⇒ Boolean
Check to see if a particular user is an assignee for a repository.
342 343 344 |
# File 'lib/github_api_v3/client/repos.rb', line 342 def assignee?(owner, repo, assignee) boolean_request :get, "/repos/#{owner}/#{repo}/assignees/#{assignee}" end |
#assignees(owner, repo) ⇒ Array
List available assignees (owner + collaborators) to which issues may be assigned.
331 332 333 |
# File 'lib/github_api_v3/client/repos.rb', line 331 def assignees(owner, repo) get "/repos/#{owner}/#{repo}/assignees" end |
#branch(owner, repo, branch) ⇒ Object
Get information about a branch.
181 182 183 |
# File 'lib/github_api_v3/client/repos.rb', line 181 def branch(owner, repo, branch) get "/repos/#{owner}/#{repo}/branches/#{branch}" end |
#branches(owner, repo) ⇒ Array
List branches for a repository.
169 170 171 |
# File 'lib/github_api_v3/client/repos.rb', line 169 def branches(owner, repo) get "/repos/#{owner}/#{repo}/branches" end |
#collaborator?(owner, repo, user) ⇒ Boolean
Determine if a user is a collaborator to a repository.
206 207 208 |
# File 'lib/github_api_v3/client/repos.rb', line 206 def collaborator?(owner, repo, user) boolean_request :get, "/repos/#{owner}/#{repo}/collaborators/#{user}" end |
#collaborators(owner, repo) ⇒ Array
Get list of collaborators for a repository.
193 194 195 |
# File 'lib/github_api_v3/client/repos.rb', line 193 def collaborators(owner, repo) get "/repos/#{owner}/#{repo}/collaborators" end |
#contributors(owner, repo) ⇒ Array
List contributors for a repository.
129 130 131 |
# File 'lib/github_api_v3/client/repos.rb', line 129 def contributors(owner, repo) get "/repos/#{owner}/#{repo}/contributors" end |
#create_repo(name, options = {}) ⇒ Hash
Create a repository.
Requires authentication.
69 70 71 |
# File 'lib/github_api_v3/client/repos.rb', line 69 def create_repo(name, ={}) post "/user/repos", body: .merge(name: name) end |
#delete_repo(owner, repo) ⇒ Boolean
Delete a repository.
Requires authentication.
106 107 108 |
# File 'lib/github_api_v3/client/repos.rb', line 106 def delete_repo(owner, repo) boolean_request :delete, "/repos/#{owner}/#{repo}" end |
#edit_repo(owner, repo, options = {}) ⇒ Hash
Edit a repository.
Requires authentication.
92 93 94 95 |
# File 'lib/github_api_v3/client/repos.rb', line 92 def edit_repo(owner, repo, ={}) [:name] = repo unless [:name] patch "/repos/#{owner}/#{repo}", body: end |
#languages(owner, repo) ⇒ Hash
List languages for a repository.
141 142 143 |
# File 'lib/github_api_v3/client/repos.rb', line 141 def languages(owner, repo) get "/repos/#{owner}/#{repo}/languages" end |
#org_repos(org) ⇒ Array
Get organization repositories.
117 118 119 |
# File 'lib/github_api_v3/client/repos.rb', line 117 def org_repos(org) get "/orgs/#{org}/repos" end |
#remove_collaborator(owner, repo, user) ⇒ Boolean
Remove a collaborator from a repository.
Requires authentication.
232 233 234 |
# File 'lib/github_api_v3/client/repos.rb', line 232 def remove_collaborator(owner, repo, user) boolean_request :delete, "/repos/#{owner}/#{repo}/collaborators/#{user}" end |
#repo(owner, repo) ⇒ Hash
Get one repository.
27 28 29 |
# File 'lib/github_api_v3/client/repos.rb', line 27 def repo(owner, repo) get "/repos/#{owner}/#{repo}" end |
#repos(username = nil) ⇒ Array
Get all repositories for a user.
If authenticated, returns all repos for authenticated user.
42 43 44 45 46 47 48 |
# File 'lib/github_api_v3/client/repos.rb', line 42 def repos(username=nil) if username get "/users/#{username}/repos" else get '/user/repos' end end |
#star(owner, repo) ⇒ Boolean
Star a repository.
Requires authentication.
256 257 258 |
# File 'lib/github_api_v3/client/repos.rb', line 256 def star(owner, repo) boolean_request :put, "/user/starred/#{owner}/#{repo}" end |
#stargazers(owner, repo) ⇒ Array
List Stargazers for a repository.
244 245 246 |
# File 'lib/github_api_v3/client/repos.rb', line 244 def stargazers(owner, repo) get "/repos/#{owner}/#{repo}/stargazers" end |
#subscribe(owner, repo, options = {}) ⇒ Hash
Set a repository subscription.
Requires authentication.
306 307 308 309 310 |
# File 'lib/github_api_v3/client/repos.rb', line 306 def subscribe(owner, repo, ={}) [:subscribed] = true unless [:subscribed] [:ignored] = false unless [:ignored] put "/repos/#{owner}/#{repo}/subscription", body: end |
#subscription(owner, repo) ⇒ Hash
Get subscription information.
Requires authentication.
292 293 294 |
# File 'lib/github_api_v3/client/repos.rb', line 292 def subscription(owner, repo) get "/repos/#{owner}/#{repo}/subscription" end |
#tags(owner, repo) ⇒ Array
List tags for a repository.
157 158 159 |
# File 'lib/github_api_v3/client/repos.rb', line 157 def (owner, repo) get "/repos/#{owner}/#{repo}/tags" end |
#unstar(owner, repo) ⇒ Boolean
Unstar a repository.
Requires authentication.
268 269 270 |
# File 'lib/github_api_v3/client/repos.rb', line 268 def unstar(owner, repo) boolean_request :delete, "/user/starred/#{owner}/#{repo}" end |
#unsubscribe(owner, repo) ⇒ Hash
Delete a repository subscription.
Requires authentication.
321 322 323 |
# File 'lib/github_api_v3/client/repos.rb', line 321 def unsubscribe(owner, repo) boolean_request :delete, "/repos/#{owner}/#{repo}/subscription" end |
#watchers(owner, repo) ⇒ Array
List Watchers for a repository.
278 279 280 |
# File 'lib/github_api_v3/client/repos.rb', line 278 def watchers(owner, repo) get "/repos/#{owner}/#{repo}/subscribers" end |