refactor gapiClient into factory