added correct httparty logic but it turned out like friday afternoon code, definately refactor this