def prepare_parallel_request
      request = ::Typhoeus::Request.new(@uri, userpwd: "#{@api_secret}:")

      request.on_complete do |response|
        if response.success?
          Utils.to_hash(response.body, @format)
        elsif response.timed_out?
          raise TimeoutError
        elsif response.code == 0
          # Could not get an http response, something's wrong
          raise HTTPError, response.curl_error_message
        else
          # Received a non-successful http response
          error_message = if response.body && response.body != ''
                            JSON.parse(response.body)['error']
                          else
                            response.code.to_s
                          end

          raise HTTPError, error_message
        end
      end

      request
    end
def prepare_parallel_request
      request = ::Typhoeus::Request.new(@uri, userpwd: "#{@api_secret}:")

      request.on_complete do |response|
        if response.success?
          Utils.to_hash(response.body, @format)
        elsif response.timed_out?
          raise TimeoutError
        elsif response.code == 0
          # Could not get an http response, something's wrong
          raise HTTPError, response.curl_error_message
        else
          # Received a non-successful http response
          error_message = if response.body && response.body != ''
                            JSON.parse(response.body)['error']
                          else
                            response.code.to_s
                          end

          raise HTTPError, error_message
        end
      end

      request
    end
TODO: Extract and refactor
 rubocop:disable MethodLength