Remove API MOCK code from stage.rb

- Use dependency injection insead
- Add a Factory class for testing