Class: Github::Orgs::Members
Constant Summary
Constants included from Request
Request::METHODS, Request::METHODS_WITH_BODIES
Constants included from Connection
Constants included from Constants
Constants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT
Constants included from MimeType
Instance Attribute Summary
Attributes inherited from API
Attributes included from Authorization
Instance Method Summary collapse
-
#conceal(*args) ⇒ Object
(also: #conceal_membership)
Conceal a user’s membership.
-
#delete(*args) ⇒ Object
(also: #remove)
Remove a member Removing a user from this list will remove them from all teams and they will no longer have any access to the organization’s repositories.
-
#list(*args) ⇒ Object
(also: #all)
List members.
-
#member?(*args) ⇒ Boolean
Check if user is, publicly or privately, a member of an organization.
-
#publicize(*args) ⇒ Object
(also: #make_public, #publicize_membership)
Publicize a user’s membership.
Methods inherited from API
#api_methods_in, #append_arguments, #arguments, inherited, #initialize, #method_missing, #process_basic_auth, #set, #setup, #with, #yield_or_eval
Methods included from RateLimit
#ratelimit, #ratelimit_remaining
Methods included from Request
#delete_request, #get_request, #patch_request, #post_request, #put_request, #request
Methods included from Connection
#caching?, #clear_cache, #connection, #default_middleware, #default_options, #stack
Methods included from MimeType
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
#conceal(*args) ⇒ Object Also known as: conceal_membership
Conceal a user’s membership
Examples
github = Github.new :oauth_token => '...'
github.orgs.members.conceal 'org-name', 'member-name'
100 101 102 103 104 |
# File 'lib/github_api/orgs/members.rb', line 100 def conceal(*args) arguments(args, :required => [:org_name, :user]) delete_request("/orgs/#{org_name}/public_members/#{user}", arguments.params) end |
#delete(*args) ⇒ Object Also known as: remove
Remove a member Removing a user from this list will remove them from all teams and they will no longer have any access to the organization’s repositories.
Examples
github = Github.new
github.orgs.members.remove 'org-name', 'member-name'
73 74 75 76 77 |
# File 'lib/github_api/orgs/members.rb', line 73 def delete(*args) arguments(args, :required => [:org_name, :user]) delete_request("/orgs/#{org_name}/members/#{user}", arguments.params) end |
#list(*args) ⇒ Object Also known as: all
List members
List all users who are members of an organization. A member is a user that belongs to at least 1 team in the organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned. Otherwise only public members are returned.
Examples
github = Github.new
github.orgs.members.list 'org-name'
github.orgs.members.list 'org-name' { |memb| ... }
List public members
Members of an organization can choose to have their membership publicized or not.
Examples
github = Github.new
github.orgs.members.list 'org-name', public: true
github.orgs.members.list 'org-name', public: true { |memb| ... }
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/github_api/orgs/members.rb', line 27 def list(*args) params = arguments(args, :required => [:org_name]).params response = if params.delete('public') get_request("/orgs/#{org_name}/public_members", params) else get_request("/orgs/#{org_name}/members", params) end return response unless block_given? response.each { |el| yield el } end |
#member?(*args) ⇒ Boolean
Check if user is, publicly or privately, a member of an organization
Examples
github = Github.new
github.orgs.members.member? 'org-name', 'member-name'
Check if a user is a public member of an organization
Examples
github = Github.new
github.orgs.members.member? 'org-name', 'member-name', :public => true
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/github_api/orgs/members.rb', line 52 def member?(*args) params = arguments(args, :required => [:org_name, :user]).params response = if params.delete('public') get_request("/orgs/#{org_name}/public_members/#{user}", params) else get_request("/orgs/#{org_name}/members/#{user}", params) end response.status == 204 rescue Github::Error::NotFound false end |
#publicize(*args) ⇒ Object Also known as: make_public, publicize_membership
Publicize a user’s membership
Examples
github = Github.new :oauth_token => '...'
github.orgs.members.publicize 'org-name', 'member-name'
86 87 88 89 90 |
# File 'lib/github_api/orgs/members.rb', line 86 def publicize(*args) arguments(args, :required => [:org_name, :user]) put_request("/orgs/#{org_name}/public_members/#{user}", arguments.params) end |