Add tests and refactor Api class to Api modul.