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.
I guess you could use the Rails gem, but not use ActionController. But that seems a little weird?