A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://rubydoc.info/github/piotrmurach/github/master/Github/Client/Orgs/Teams below:

Teams – Documentation for piotrmurach/github (master) – RubyDoc.info

Class: Github::Client::Orgs::Teams
Inherits:
API show all
Defined in:
lib/github_api/client/orgs/teams.rb
Overview

All actions against teams require at a minimum an authenticated user who is a member of the owner’s team in the :org being managed. Api calls that require explicit permissions are noted.

Constant Summary Constants included from MimeType

MimeType::MEDIA_LOOKUP

Constants included from Github::Constants

Github::Constants::ACCEPT, Github::Constants::ACCEPTED_OAUTH_SCOPES, Github::Constants::ACCEPT_CHARSET, Github::Constants::CACHE_CONTROL, Github::Constants::CONTENT_LENGTH, Github::Constants::CONTENT_TYPE, Github::Constants::DATE, Github::Constants::ETAG, Github::Constants::HEADER_LAST, Github::Constants::HEADER_LINK, Github::Constants::HEADER_NEXT, Github::Constants::LOCATION, Github::Constants::META_FIRST, Github::Constants::META_LAST, Github::Constants::META_NEXT, Github::Constants::META_PREV, Github::Constants::META_REL, Github::Constants::OAUTH_SCOPES, Github::Constants::PARAM_PAGE, Github::Constants::PARAM_PER_PAGE, Github::Constants::PARAM_START_PAGE, Github::Constants::RATELIMIT_LIMIT, Github::Constants::RATELIMIT_REMAINING, Github::Constants::RATELIMIT_RESET, Github::Constants::SERVER, Github::Constants::USER_AGENT

Instance Attribute Summary Attributes inherited from API

#current_options

Instance Method Summary collapse Methods inherited from API

after_callbacks, after_request, #api_methods_in, #arguments, before_callbacks, before_request, clear_request_methods!, #disable_redirects, #execute, extend_with_actions, extra_methods, #extract_basic_auth, extract_class_name, #filter_callbacks, inherited, #initialize, internal_methods, method_added, #method_missing, #module_methods_in, namespace, request_methods, require_all, #respond_to?, root!, #run_callbacks, #set, #yield_or_eval

Methods included from Request::Verbs

#delete_request, #get_request, #head_request, #options_request, #patch_request, #post_request, #put_request

Methods included from RateLimit

#ratelimit, #ratelimit_remaining, #ratelimit_reset

Methods included from MimeType

#lookup_media, #parse

Methods included from Authorization

#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token

Constructor Details

This class inherits a constructor from Github::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Github::API

Instance Method Details #add_member(*args) ⇒ Object Also known as: add_team_member

Add a team member

In order to add a user to a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.

223
224
225
226
227
228
# File 'lib/github_api/client/orgs/teams.rb', line 223

def add_member(*args)
  arguments(args, required: [:id, :user])

  put_request("/teams/#{arguments.id}/members/#{arguments.user}",
              arguments.params)
end
#add_membership(*args) ⇒ Object Also known as: add_team_membership

Add a team membership

In order to add a user to a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.

299
300
301
302
303
304
# File 'lib/github_api/client/orgs/teams.rb', line 299

def add_membership(*args)
  arguments(args, required: [:team_id, :user])

  put_request("/teams/#{arguments.team_id}/memberships/#{arguments.user}",
              arguments.params)
end
#add_repo(*args) ⇒ Object Also known as: add_repository

Add a team repository

In order to add a repo to a team, 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 for of a repo owned by the organization.

380
381
382
383
384
# File 'lib/github_api/client/orgs/teams.rb', line 380

def add_repo(*args)
  arguments(args, required: [:id, :user, :repo])

  put_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
end
#create(*args) ⇒ Object

Create a team

In order to create a team, the authenticated user must be an owner of :org

97
98
99
100
101
102
103
# File 'lib/github_api/client/orgs/teams.rb', line 97

def create(*args)
  arguments(args, required: [:org_name]) do
    assert_required %w(name)
  end

  post_request("/orgs/#{arguments.org_name}/teams", arguments.params)
end
#delete(*args) ⇒ Object Also known as: remove

Delete a team

In order to delete a team, the authenticated user must be an owner of the org that the team is associated with

160
161
162
163
164
# File 'lib/github_api/client/orgs/teams.rb', line 160

def delete(*args)
  arguments(args, required: [:id])

  delete_request("/teams/#{arguments.id}", arguments.params)
end
#edit(*args) ⇒ Object

Edit a team

In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.

140
141
142
143
144
145
146
# File 'lib/github_api/client/orgs/teams.rb', line 140

def edit(*args)
  arguments(args, required: [:id]) do
    assert_required %w(name)
  end

  patch_request("/teams/#{arguments.id}", arguments.params)
end
#get(*args) ⇒ Object Also known as: find
51
52
53
54
55
# File 'lib/github_api/client/orgs/teams.rb', line 51

def get(*args)
  arguments(args, required: [:id])

  get_request("/teams/#{arguments.id}", arguments.params)
end
#list(*args) ⇒ Object Also known as: all

List user teams

List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth.

List teams

29
30
31
32
33
34
35
36
37
38
39
# File 'lib/github_api/client/orgs/teams.rb', line 29

def list(*args)
  params = arguments(args).params

  if (org = params.delete('org'))
    response = get_request("/orgs/#{org}/teams", params)
  else
    response = get_request('/user/teams', params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end
#list_members(*args) ⇒ Object Also known as: all_members

List team members

In order to list members in a team, the authenticated user must be a member of the team.

182
183
184
185
186
187
188
# File 'lib/github_api/client/orgs/teams.rb', line 182

def list_members(*args)
  arguments(args, required: [:team_id])

  response = get_request("/teams/#{arguments.team_id}/members", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
#list_repos(*args) ⇒ Object Also known as: repos
338
339
340
341
342
343
344
# File 'lib/github_api/client/orgs/teams.rb', line 338

def list_repos(*args)
  arguments(args, required: [:id])

  response = get_request("/teams/#{arguments.id}/repos", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
#remove_member(*args) ⇒ Object Also known as: remove_team_member

Remove a team member

In order to remove a user from a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with. note: This does not delete the user, it just remove them from the team.

245
246
247
248
249
250
# File 'lib/github_api/client/orgs/teams.rb', line 245

def remove_member(*args)
  arguments(args, required: [:id, :user])

  delete_request("/teams/#{arguments.id}/members/#{arguments.user}",
                 arguments.params)
end
#remove_membership(*args) ⇒ Object Also known as: remove_team_membership

Remove a team membership

In order to remove a user from a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with. note: This does not delete the user, it just remove them from the team.

321
322
323
324
325
326
# File 'lib/github_api/client/orgs/teams.rb', line 321

def remove_membership(*args)
  arguments(args, required: [:team_id, :user])

  delete_request("/teams/#{arguments.team_id}/memberships/#{arguments.user}",
                 arguments.params)
end
#remove_repo(*args) ⇒ Object Also known as: remove_repository

Remove a team repository

In order to add a repo to a team, 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.

400
401
402
403
404
# File 'lib/github_api/client/orgs/teams.rb', line 400

def remove_repo(*args)
  arguments(args, required: [:id, :user, :repo])

  delete_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
end
#team_member?(*args) ⇒ Boolean

Check if a user is a member of a team

203
204
205
206
207
208
209
210
# File 'lib/github_api/client/orgs/teams.rb', line 203

def team_member?(*args)
  arguments(args, required: [:team_id, :user])

  response = get_request("/teams/#{arguments.team_id}/members/#{arguments.user}", arguments.params)
  response.status == 204
rescue Github::Error::NotFound
  false
end
#team_membership(*args) ⇒ Object

Get team membership

In order to get a user’s membership with a team, the team must be visible to the authenticated user.

268
269
270
271
272
273
# File 'lib/github_api/client/orgs/teams.rb', line 268

def team_membership(*args)
  arguments(args, required: [:team_id, :username])

  get_request("/teams/#{arguments.team_id}/memberships/#{arguments.username}",
              arguments.params)
end
#team_repo?(*args) ⇒ Boolean Also known as: team_repository?

Check if a repository belongs to a team

356
357
358
359
360
361
362
363
# File 'lib/github_api/client/orgs/teams.rb', line 356

def team_repo?(*args)
  arguments(args, required: [:id, :user, :repo])

  response = get_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
  response.status == 204
rescue Github::Error::NotFound
  false
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4