bitpay/ruby-client — pull request #14 by arrtchiu (2014-09-19 03:37:54+00:00)
Title: refactor request handling in bitpay client

Noticed an exception while parsing JSON during a brief connection issue between CloudFlare and BitPay. CloudFlare in this instance responded with a HTML page which caused the JSON parser to fail.

This definitely isn't the most elegant approach (we should check response code too) but it at the very least allows API users to rescue from `BitPayError` in the event this occurs again.

Also took the opportunity to DRY the code a little.