Module: Sem::API::Traits::AssociatedWithTeam

Included in:
Projects, SharedConfigs, Users
Defined in:
lib/sem/api/traits/associated_with_team.rb

Instance Method Summary collapse

Instance Method Details

#add_to_team(team_path, instance_path) ⇒ Object



13
14
15
16
17
18
# File 'lib/sem/api/traits/associated_with_team.rb', line 13

def add_to_team(team_path, instance_path)
  instance = info(instance_path)
  team = Teams.info(team_path)

  api.attach_to_team(instance[:id], team[:id])
end

#list_for_team(team_path) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/sem/api/traits/associated_with_team.rb', line 5

def list_for_team(team_path)
  team = Teams.info(team_path)

  instances = api.list_for_team(team[:id])

  instances.map { |instance| to_hash(instance) }
end

#remove_from_team(team_path, instance_path) ⇒ Object



20
21
22
23
24
25
# File 'lib/sem/api/traits/associated_with_team.rb', line 20

def remove_from_team(team_path, instance_path)
  instance = info(instance_path)
  team = Teams.info(team_path)

  api.detach_from_team(instance[:id], team[:id])
end