Jacobi connected the generating function counting the number of representations as a square with elliptic trigonometry and use Fourier series to find the exact congruence condition and formula for counting representations as a sum of three squares [1].

To be precise it was the theta function $$1 + \sum_{n=1}^\infty 2 q^{n^2}$$

I was wondering if it was possible to use this approach on positive cubes $$\sum_{n=1}^\infty q^{n^3}$$ and integer cubes $$\sum_{n=-\infty \ldots \infty} q^{n^3}$$ since there is no useful algebraic object (like the Gaussian integers, quaternions and such) for cubes.