def do_delete(path, params={})
      login if need_login?

      # Resource id is a special param as it needs to be added to the path
      path = add_id_and_params_to_path(path, params)

      req, res, resource_type, body = nil

      begin
        retry_request do
          @rest_client[path].delete(headers) do |response, request, result|
            req, res = request, response
            update_cookies(response)
            update_last_request(request, response)

            case response.code
            when 200, 204
              nil
            when 301, 302
              update_api_url(response)
              do_delete(path, params)
            when 404
              raise UnknownRouteError.new(request, response)
            else
              raise ApiError.new(request, response)
            end
          end
        end
      rescue => e
        raise wrap(e, :delete, path, params, req, res)
      end
    end
def do_delete(path, params={})
      login if need_login?

      # Resource id is a special param as it needs to be added to the path
      path = add_id_and_params_to_path(path, params)

      req, res, resource_type, body = nil

      begin
        retry_request do
          @rest_client[path].delete(headers) do |response, request, result|
            req, res = request, response
            update_cookies(response)
            update_last_request(request, response)

            case response.code
            when 200, 204
              nil
            when 301, 302
              update_api_url(response)
              do_delete(path, params)
            when 404
              raise UnknownRouteError.new(request, response)
            else
              raise ApiError.new(request, response)
            end
          end
        end
      rescue => e
        raise wrap(e, :delete, path, params, req, res)
      end
    end
Generic delete