Module: GitHub::Client::Orgs
- Included in:
- GitHub::Client
- Defined in:
- lib/github_api_v3/client/orgs.rb
Overview
Methods for the Orgs API.
Instance Method Summary collapse
-
#add_team_member(id, username) ⇒ Boolean
(also: #add_organization_member)
Add a member to a team.
-
#add_team_repo(id, org, repo) ⇒ Boolean
Add a team repository.
-
#create_team(org, team_name, options = {}) ⇒ Hash
Create a team for an organization.
-
#delete_team(id) ⇒ Boolean
Delete a team.
-
#edit_organization(org, options = {}) ⇒ Hash
Edit an organization.
-
#edit_team(id, team_name, options = {}) ⇒ Hash
Edit a team.
-
#organization(org) ⇒ Hash
Get an organization.
-
#organization_member?(org, username) ⇒ Boolean
Check if a user is, publicly or privately, a member of the organization.
-
#organization_members(org) ⇒ Array
List all users who are members of an organization.
-
#organization_public_member?(org, username) ⇒ Array
Check if a user is publicly a member of the organization.
-
#organization_public_members(org) ⇒ Array
Retrieve public members of an organization.
-
#publicize_membership(org, username) ⇒ Boolean
Make a user’s organization membership public.
-
#remove_organization_member(org, username) ⇒ Boolean
Remove member from an organization.
-
#remove_team_member(id, username) ⇒ Boolean
Remove a team member.
-
#remove_team_repo(id, owner, repo) ⇒ Boolean
Remove a team repository.
-
#team(id) ⇒ Hash
Get a team by its ID.
-
#team_member?(id, username) ⇒ Boolean
Determine if a user is a team member.
-
#team_members(id) ⇒ Array
List team members.
-
#team_repo?(id, owner, repo) ⇒ Boolean
Determine if a repo is managed by a team.
-
#team_repos(id) ⇒ Boolean
List all repositories for a team.
-
#teams(org) ⇒ Array
List an organizations teams.
-
#unpublicize_membership(org, username) ⇒ Boolean
Conceal a user’s organization membership.
Instance Method Details
#add_team_member(id, username) ⇒ Boolean Also known as: add_organization_member
Add a member to a team.
Requires authentication. The authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.
215 216 217 |
# File 'lib/github_api_v3/client/orgs.rb', line 215 def add_team_member(id, username) boolean_request :put, "/teams/#{id}/members/#{username}" end |
#add_team_repo(id, org, repo) ⇒ Boolean
Add a team repository.
Requires authentication. The authenticated user must be an owner of the org that the team is associated with. Also, the repo must be owned by the organization, or a direct fork of a repo owned by the organization.
269 270 271 |
# File 'lib/github_api_v3/client/orgs.rb', line 269 def add_team_repo(id, org, repo) boolean_request :put, "/teams/#{id}/repos/#{org}/#{repo}" end |
#create_team(org, team_name, options = {}) ⇒ Hash
Create a team for an organization.
Requires authentication. The authenticated user must also be an owner of the specified organization.
147 148 149 150 |
# File 'lib/github_api_v3/client/orgs.rb', line 147 def create_team(org, team_name, ={}) .merge!(name: team_name) post "/orgs/#{org}/teams", body: end |
#delete_team(id) ⇒ Boolean
Delete a team.
Requires authentication. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with.
176 177 178 |
# File 'lib/github_api_v3/client/orgs.rb', line 176 def delete_team(id) boolean_request :delete, "/teams/#{id}" end |
#edit_organization(org, options = {}) ⇒ Hash
Edit an organization.
Requires authentication.
35 36 37 |
# File 'lib/github_api_v3/client/orgs.rb', line 35 def edit_organization(org, ={}) patch "/orgs/#{org}", body: end |
#edit_team(id, team_name, options = {}) ⇒ Hash
Edit a team.
Requires authentication. In order to edit a team, the authenticated user must be an owner of the specified organization.
163 164 165 166 |
# File 'lib/github_api_v3/client/orgs.rb', line 163 def edit_team(id, team_name, ={}) .merge!(name: team_name) patch "/teams/#{id}", body: end |
#organization(org) ⇒ Hash
Get an organization.
16 17 18 |
# File 'lib/github_api_v3/client/orgs.rb', line 16 def organization(org) get "/orgs/#{org}" end |
#organization_member?(org, username) ⇒ Boolean
Check if a user is, publicly or privately, a member of the organization.
54 55 56 |
# File 'lib/github_api_v3/client/orgs.rb', line 54 def organization_member?(org, username) boolean_request :get, "/orgs/#{org}/members/#{username}" end |
#organization_members(org) ⇒ Array
List all users who are members of an organization.
44 45 46 |
# File 'lib/github_api_v3/client/orgs.rb', line 44 def organization_members(org) get "/orgs/#{org}/members" end |
#organization_public_member?(org, username) ⇒ Array
Check if a user is publicly a member of the organization.
84 85 86 |
# File 'lib/github_api_v3/client/orgs.rb', line 84 def organization_public_member?(org, username) boolean_request :get, "/orgs/#{org}/public_members/#{username}" end |
#organization_public_members(org) ⇒ Array
Retrieve public members of an organization.
63 64 65 |
# File 'lib/github_api_v3/client/orgs.rb', line 63 def organization_public_members(org) get "/orgs/#{org}/public_members" end |
#publicize_membership(org, username) ⇒ Boolean
Make a user’s organization membership public.
Requires authentication.
96 97 98 |
# File 'lib/github_api_v3/client/orgs.rb', line 96 def publicize_membership(org, username) boolean_request :put, "/orgs/#{org}/public_members/#{username}" end |
#remove_organization_member(org, username) ⇒ Boolean
Remove member from an organization.
Requires authentication.
75 76 77 |
# File 'lib/github_api_v3/client/orgs.rb', line 75 def remove_organization_member(org, username) boolean_request :delete, "/orgs/#{org}/members/#{username}" end |
#remove_team_member(id, username) ⇒ Boolean
Remove a team member.
Requires authentication. The authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.
229 230 231 |
# File 'lib/github_api_v3/client/orgs.rb', line 229 def remove_team_member(id, username) boolean_request :delete, "/teams/#{id}/members/#{username}" end |
#remove_team_repo(id, owner, repo) ⇒ Boolean
Remove a team repository.
Requires authentication. The authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repo, it just removes it from the team.
283 284 285 |
# File 'lib/github_api_v3/client/orgs.rb', line 283 def remove_team_repo(id, owner, repo) boolean_request :delete, "/teams/#{id}/repos/#{owner}/#{repo}" end |
#team(id) ⇒ Hash
Get a team by its ID.
Requires authentication.
130 131 132 |
# File 'lib/github_api_v3/client/orgs.rb', line 130 def team(id) get "/teams/#{id}" end |
#team_member?(id, username) ⇒ Boolean
Determine if a user is a team member.
Requires authentication. The authenticated user must be a member of the team.
201 202 203 |
# File 'lib/github_api_v3/client/orgs.rb', line 201 def team_member?(id, username) boolean_request :get, "/teams/#{id}/members/#{username}" end |
#team_members(id) ⇒ Array
List team members
Requires authentication. In order to list members in a team, the authenticated user must be a member of the team.
188 189 190 |
# File 'lib/github_api_v3/client/orgs.rb', line 188 def team_members(id) get "/teams/#{id}/members" end |
#team_repo?(id, owner, repo) ⇒ Boolean
Determine if a repo is managed by a team.
Requires authentication.
253 254 255 |
# File 'lib/github_api_v3/client/orgs.rb', line 253 def team_repo?(id, owner, repo) boolean_request :get, "/teams/#{id}/repos/#{owner}/#{repo}" end |
#team_repos(id) ⇒ Boolean
List all repositories for a team.
Requires authentication.
240 241 242 |
# File 'lib/github_api_v3/client/orgs.rb', line 240 def team_repos(id) get "/teams/#{id}/repos" end |
#teams(org) ⇒ Array
List an organizations teams.
Requires authentication.
119 120 121 |
# File 'lib/github_api_v3/client/orgs.rb', line 119 def teams(org) get "/orgs/#{org}/teams" end |
#unpublicize_membership(org, username) ⇒ Boolean
Conceal a user’s organization membership.
Requires authentication.
108 109 110 |
# File 'lib/github_api_v3/client/orgs.rb', line 108 def unpublicize_membership(org, username) boolean_request :delete, "/orgs/#{org}/public_members/#{username}" end |