Last active
August 29, 2015 14:12
-
-
Save gutomcosta/ed28604c6a3c0b7687a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrmedExtensionPoint | |
def get_students_list | |
end | |
def xpto | |
end | |
end | |
class ElgroupExtensionPoint | |
def get_students_list | |
end | |
def xpto | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Environment | |
def get_extension_point(name) | |
hash = {brmed: BrmedExtensionPoint.new, elogroup: ElogroupExtensionPoint.new } | |
hash[name] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Services | |
class StudentsRetriever | |
def retrieve_all_students(current_user) | |
extension_point = Enviroment.get_extension_point | |
extension_point.get_student_list(data) | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrmedExtensionPoint | |
def execute | |
client = PortalBrmedClient::Client.new(current_user) | |
employees = client.supervised_employees | |
employees = PortalBrmedClient::Client.employee_all if current_user.admin? | |
employees.each do |employee| | |
profile = employee.get_employee_profile | |
unless profile.can_administer_website? | |
user = Authentication::User.new(profile) | |
student = Learning::Student.find_or_initialize_by(user_id: user.id) | |
student.name = user.name | |
student.email = user.email | |
student.teacher = current_user.authenticable if current_user.teacher? | |
student.save! | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/extension_points/brmed | |
/extension_points/elogroup | |
/extension_points/other |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment