Class: TeachersPet::Actions::AddToTeam

Inherits:
Base
  • Object
show all
Defined in:
lib/teachers_pet/actions/add_to_team.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #options

Instance Method Summary collapse

Methods inherited from Base

#execute, #init_client, #initialize, #octokit_config, #read_file, #read_members_file, #read_students_file

Constructor Details

This class inherits a constructor from TeachersPet::Actions::Base

Instance Method Details

#add_membersObject


15
16
17
18
# File 'lib/teachers_pet/actions/add_to_team.rb', line 15

def add_members
  member_list = self.read_members_file
  self.client.add_users_to_team(self.options[:organization], self.team, member_list)
end

#runObject


20
21
22
23
# File 'lib/teachers_pet/actions/add_to_team.rb', line 20

def run
  self.init_client
  self.add_members
end

#teamObject


9
10
11
12
13
# File 'lib/teachers_pet/actions/add_to_team.rb', line 9

def team
   = self.options[:organization]
  teams_by_name = self.client.existing_teams_by_name()
  teams_by_name[self.team_name] || self.client.create_team(, team_name)
end

#team_nameObject


4
5
6
7
# File 'lib/teachers_pet/actions/add_to_team.rb', line 4

def team_name
  file = self.options[:members]
  File.basename(file, File.extname(file))
end