Added httparty to gemfile and fixed error logic