Class: Confy::Api::Teams
- Inherits:
-
Object
- Object
- Confy::Api::Teams
- Defined in:
- lib/confy/api/teams.rb
Overview
Every organization will have a default team named __Owners__. Owner of the organization will be a default member for every team.
org - Name of the organization
Instance Method Summary collapse
-
#create(name, description, options = {}) ⇒ Object
Create a team for the given organization.
-
#destroy(team, options = {}) ⇒ Object
Delete the given team.
-
#initialize(org, client) ⇒ Teams
constructor
A new instance of Teams.
-
#list(options = {}) ⇒ Object
List teams of the given organization authenticated user is a member of.
-
#projects(team, options = {}) ⇒ Object
Retrieve the list of projects the given team has access to.
-
#retrieve(team, options = {}) ⇒ Object
Get the given team in the given organization.
-
#update(team, description, options = {}) ⇒ Object
Update the given team.
Constructor Details
#initialize(org, client) ⇒ Teams
Returns a new instance of Teams.
10 11 12 13 |
# File 'lib/confy/api/teams.rb', line 10 def initialize(org, client) @org = org @client = client end |
Instance Method Details
#create(name, description, options = {}) ⇒ Object
Create a team for the given organization. Authenticated user should be the owner of the organization.
‘/orgs/:org/teams’ POST
name - Name of the team description - Description of the team
30 31 32 33 34 35 36 |
# File 'lib/confy/api/teams.rb', line 30 def create(name, description, = {}) body = .fetch(:body, {}) body[:name] = name body[:description] = description @client.post("/orgs/#{@org}/teams", body, ) end |
#destroy(team, options = {}) ⇒ Object
Delete the given team. Cannot delete the default team in the organization. Authenticated user should be the owner of the organization.
‘/orgs/:org/teams/:team’ DELETE
team - Name of the team
67 68 69 70 71 |
# File 'lib/confy/api/teams.rb', line 67 def destroy(team, = {}) body = .fetch(:body, {}) @client.delete("/orgs/#{@org}/teams/#{team}", body, ) end |
#list(options = {}) ⇒ Object
List teams of the given organization authenticated user is a member of.
‘/orgs/:org/teams’ GET
18 19 20 21 22 |
# File 'lib/confy/api/teams.rb', line 18 def list( = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/teams", body, ) end |
#projects(team, options = {}) ⇒ Object
Retrieve the list of projects the given team has access to. Authenticated user should be a member of the team.
‘/orgs/:org/teams/:team/projects’ GET
team - Name of the team
78 79 80 81 82 |
# File 'lib/confy/api/teams.rb', line 78 def projects(team, = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/teams/#{team}/projects", body, ) end |
#retrieve(team, options = {}) ⇒ Object
Get the given team in the given organization. Access only if the authenticated user is a member of the team.
‘/orgs/:org/teams/:team’ GET
team - Name of the team
43 44 45 46 47 |
# File 'lib/confy/api/teams.rb', line 43 def retrieve(team, = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/teams/#{team}", body, ) end |
#update(team, description, options = {}) ⇒ Object
Update the given team. __Description__ is the only thing which can be updated. Authenticated user should be the owner of the organization.
‘/orgs/:org/teams/:team’ PATCH
team - Name of the team description - Description of the team
55 56 57 58 59 60 |
# File 'lib/confy/api/teams.rb', line 55 def update(team, description, = {}) body = .fetch(:body, {}) body[:description] = description @client.patch("/orgs/#{@org}/teams/#{team}", body, ) end |