Move rule class to API to make it consistent with the rest of the code