Class: Confy::Api::Access

Inherits:
Object
  • Object
show all
Defined in:
lib/confy/api/access.rb

Overview

List of teams whic have access to the project. Default team __Owners__ will have access to every project. Authenticated user should be the owner of the organization for the below endpoints.

org - Name of the organization project - Name of the project

Instance Method Summary collapse

Constructor Details

#initialize(org, project, client) ⇒ Access

Returns a new instance of Access.



11
12
13
14
15
# File 'lib/confy/api/access.rb', line 11

def initialize(org, project, client)
  @org = org
  @project = project
  @client = client
end

Instance Method Details

#add(team, options = {}) ⇒ Object

Give the team access to the given project. The __team__ in the request needs to be a string and should be the name of a valid team. Authenticated user should be the owner of the organization.

‘/orgs/:org/projects/:project/access’ POST

team - Name of the team



31
32
33
34
35
36
# File 'lib/confy/api/access.rb', line 31

def add(team, options = {})
  body = options.fetch(:body, {})
  body[:team] = team

  @client.post("/orgs/#{@org}/projects/#{@project}/access", body, options)
end

#list(options = {}) ⇒ Object

Retrieve a list of teams which have access to the given project. Authenticated user should be a member of the team.

‘/orgs/:org/projects/:project/access’ GET



20
21
22
23
24
# File 'lib/confy/api/access.rb', line 20

def list(options = {})
  body = options.fetch(:query, {})

  @client.get("/orgs/#{@org}/projects/#{@project}/access", body, options)
end

#remove(team, options = {}) ⇒ Object

Remove project access for the given team. The __team__ in the request needs to be a string and should be the name of a valid team. Can’t delete default team’s access. Authenticated user should be the owner of the organization.

‘/orgs/:org/projects/:project/access’ DELETE

team - Name of the team



43
44
45
46
47
48
# File 'lib/confy/api/access.rb', line 43

def remove(team, options = {})
  body = options.fetch(:body, {})
  body[:team] = team

  @client.delete("/orgs/#{@org}/projects/#{@project}/access", body, options)
end