All for aggregate queries on the social stats API endpoint

@martynjames I guess you are the only person to look at a Ruby PR :-)