Simulations of x-ray absorption spectra for CO desorbing from Ru(0001) with transition-potential and time-dependent density functional theory approaches