This is an old post but I wanted to share another way to do this which I found out by accident:
sg_vpd --page=bdc /dev/sda

This commands fetches the Vital Product Data for the block device characteristics. For a rotating head disk, the output will include:
Nominal rotation rate: 7200 rpm
For an SSD, it will include: 
  Non-rotating medium (e.g. solid state)