Class: Github::Client::Orgs::Members
- Defined in:
- lib/github_api2/client/orgs/members.rb
Constant Summary
Constants included from MimeType
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
Instance Method Summary collapse
-
#conceal(*args) ⇒ Object
(also: #conceal_membership)
Conceal a user’s membership.
-
#delete(*args) ⇒ Object
(also: #remove)
Remove a member.
-
#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
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
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
135 136 137 138 139 |
# File 'lib/github_api2/client/orgs/members.rb', line 135 def conceal(*args) arguments(args, required: [:org_name, :user]) delete_request("/orgs/#{arguments.org_name}/public_members/#{arguments.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.
101 102 103 104 105 106 |
# File 'lib/github_api2/client/orgs/members.rb', line 101 def delete(*args) arguments(args, required: [:org_name, :user]) delete_request("/orgs/#{arguments.org_name}/members/#{arguments.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.
List public members
Members of an organization can choose to have their membership publicized or not.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/github_api2/client/orgs/members.rb', line 48 def list(*args) params = arguments(args, required: [:org_name]).params org_name = arguments.org_name 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
Check if a user is a public member of an organization
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/github_api2/client/orgs/members.rb', line 75 def member?(*args) params = arguments(args, required: [:org_name, :user]).params org_name = arguments.org_name user = arguments.user 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
118 119 120 121 122 |
# File 'lib/github_api2/client/orgs/members.rb', line 118 def publicize(*args) arguments(args, required: [:org_name, :user]) put_request("/orgs/#{arguments.org_name}/public_members/#{arguments.user}", arguments.params) end |