abstract api code to a separate gem