Skip to content

Instantly share code, notes, and snippets.

@gutomcosta
Last active August 29, 2015 14:12
Show Gist options
  • Save gutomcosta/ed28604c6a3c0b7687a6 to your computer and use it in GitHub Desktop.
Save gutomcosta/ed28604c6a3c0b7687a6 to your computer and use it in GitHub Desktop.
class BrmedExtensionPoint
def get_students_list
end
def xpto
end
end
class ElgroupExtensionPoint
def get_students_list
end
def xpto
end
end
class Environment
def get_extension_point(name)
hash = {brmed: BrmedExtensionPoint.new, elogroup: ElogroupExtensionPoint.new }
hash[name]
end
end
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
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
/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