def parse_response(res)
      begin
        data = JSON.parse(res.body)
        if data.nil? == false && data.has_key?("result") && data["result"].nil? == false
          return data["result"]
        elsif data.nil? == false && data.has_key?("error") && data["error"].nil? == false
          raise CallrException.new(data["error"]["message"], data["error"]["code"], nil)
        else
          raise CallrException.new("INVALID_RESPONSE", -3, {:response => res.body})
        end
      rescue JSON::ParserError
        raise CallrException.new("INVALID_RESPONSE", -3, {:response => res.body})
      end
    end
def parse_response(res)
      begin
        data = JSON.parse(res.body)
        if data.nil? == false && data.has_key?("result") && data["result"].nil? == false
          return data["result"]
        elsif data.nil? == false && data.has_key?("error") && data["error"].nil? == false
          raise CallrException.new(data["error"]["message"], data["error"]["code"], nil)
        else
          raise CallrException.new("INVALID_RESPONSE", -3, {:response => res.body})
        end
      rescue JSON::ParserError
        raise CallrException.new("INVALID_RESPONSE", -3, {:response => res.body})
      end
    end
Response analysis