Class: Confy::Api::Members
- Inherits:
-
Object
- Object
- Confy::Api::Members
- Defined in:
- lib/confy/api/members.rb
Overview
Teams contain a list of users. The Authenticated user should be the owner of the organization.
org - Name of the organization team - Name of the team
Instance Method Summary collapse
-
#add(user, options = {}) ⇒ Object
Add the user to the given team.
-
#initialize(org, team, client) ⇒ Members
constructor
A new instance of Members.
-
#list(options = {}) ⇒ Object
List all the members in the given team.
-
#remove(user, options = {}) ⇒ Object
Remove users from the given team.
Constructor Details
#initialize(org, team, client) ⇒ Members
Returns a new instance of Members.
11 12 13 14 15 |
# File 'lib/confy/api/members.rb', line 11 def initialize(org, team, client) @org = org @team = team @client = client end |
Instance Method Details
#add(user, options = {}) ⇒ Object
Add the user to the given team. The __user__ in the request needs to be a string and be the username of a valid user. The Authenticated user should be the owner of the organization.
‘/orgs/:org/teams/:team/member’ POST
user - Username of the user
31 32 33 34 35 36 |
# File 'lib/confy/api/members.rb', line 31 def add(user, = {}) body = .fetch(:body, {}) body[:user] = user @client.post("/orgs/#{@org}/teams/#{@team}/member", body, ) end |
#list(options = {}) ⇒ Object
List all the members in the given team. Authenticated user should be a member of the team or the owner of the org.
‘/orgs/:org/teams/:team/member’ GET
20 21 22 23 24 |
# File 'lib/confy/api/members.rb', line 20 def list( = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/teams/#{@team}/member", body, ) end |
#remove(user, options = {}) ⇒ Object
Remove users from the given team. The __user__ in the request needs to be a string and be the username of a valid user. Cannot delete the default member in a team. The Authenticated user should be the owner of the organization.
‘/orgs/:org/teams/:team/member’ DELETE
user - Username of the user
43 44 45 46 47 48 |
# File 'lib/confy/api/members.rb', line 43 def remove(user, = {}) body = .fetch(:body, {}) body[:user] = user @client.delete("/orgs/#{@org}/teams/#{@team}/member", body, ) end |