It may be a Mammillaria. A closer photo would help. Mammillaria have tubercles, not ribs but so do a few other cactus species. In Mammillaria, the spines grow at the tip of the tubercle while the flowers originate from the base. If not in bloom, there should be a small spot at the base of the tubercle that looks like tiny spines or a tuft of cotton or sometimes just a ring. Sometimes, the central spine at the apex has a hook. The blooms always form on last years growth so often they look like a ring of flowers around the top.
Daisy