refactor using rest-client in lieu of httparty