Small code cleanup and moving files from app to lib

Mostly to fix a dependency issue I was getting when trying to test openstax_api.
isn't an advantage of this kind of initializer that it isn't called if activesupport isn't used?  http://simonecarletti.com/blog/2011/04/understanding-ruby-and-rails-lazy-load-hooks/