Class: TeachersPet::Actions::AddToTeam
- Inherits:
-
Base
- Object
- Base
- TeachersPet::Actions::AddToTeam
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
Instance Method Details
#add_members ⇒ Object
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
|
#run ⇒ Object
20
21
22
23
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 20
def run
self.init_client
self.add_members
end
|
#team ⇒ Object
9
10
11
12
13
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 9
def team
org_login = self.options[:organization]
teams_by_name = self.client.existing_teams_by_name(org_login)
teams_by_name[self.team_name] || self.client.create_team(org_login, team_name)
end
|
#team_name ⇒ Object
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
|