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
#init_client, #initialize, #octokit_config, #read_file, #read_students_file
Instance Method Details
#add_members_to_owners ⇒ Object
21
22
23
24
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 21
def add_members_to_owners
member_list = self.read_members_file
self.client.add_users_to_team(self.options[:organization], self.team, member_list)
end
|
#read_members_file ⇒ Object
4
5
6
7
8
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 4
def read_members_file
file = self.options[:members]
puts "Loading members to add:"
read_file(file).keys
end
|
#run ⇒ Object
26
27
28
29
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 26
def run
self.init_client
self.add_members_to_owners
end
|
#team ⇒ Object
15
16
17
18
19
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 15
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
10
11
12
13
|
# File 'lib/teachers_pet/actions/add_to_team.rb', line 10
def team_name
file = self.options[:members]
File.basename(file, File.extname(file))
end
|