Class: Gerd::Inspections::Actions::CreateTeam

Inherits:
Object
  • Object
show all
Defined in:
lib/gerd/inspections/actions/create_team.rb

Instance Method Summary collapse

Constructor Details

#initialize(team_name, organisation, team_opts) ⇒ CreateTeam

Returns a new instance of CreateTeam.



7
8
9
10
11
# File 'lib/gerd/inspections/actions/create_team.rb', line 7

def initialize(team_name, organisation, team_opts)
  @team_name = team_name
  @org = organisation
  @opts = team_opts
end

Instance Method Details

#invoke(client, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gerd/inspections/actions/create_team.rb', line 13

def invoke(client, options = {})
  team_name = @team_name
  description = @opts['description']
  privacy = @opts['privacy']
  repos = []
  repos = @opts['repos'].collect { | repo | "#{@org}/#{repo}" } unless !@opts.has_key?('repos')
  opts = {
    :name => team_name,
    :repo_names => repos,
    :permission => 'admin'
  }
  client.create_team(@org, opts)
end