Refactor the token refresh method while using the net/http gem instead of httparty.