I forgot to mention that Shin-Ichiro Hara's wonderful
algebra package can certainly do anything you want. 
Look at his residue-class-ring.rb  However, it can do
so much that you might find it overkill. My Imod package,
though unfinished and undocumented, should be easier to
use.

Regards, Bret