Implemented enrollment api

also some refactoring.
Refactoring
Locked dependency to rails 3.2.13