extract rest initialization into Resource class