refactored some java code directly into ruby wrapper for manipulating http client