class Spaceship::Tunes::AppRatingSummary

def average_rating

Returns:
  • (Float) - the average rating for this summary (rounded to 2 decimal places)
def average_rating
  ((self.one_star_rating_count +
    (self.two_star_rating_count * 2) +
    (self.three_star_rating_count * 3) +
    (self.four_star_rating_count * 4) +
    (self.five_star_rating_count * 5)) / self.rating_count.to_f).round(2)
end

def factory(attrs)

This is used to create a new object based on the server response.
Create a new object based on a hash.
def factory(attrs)
  obj = self.new(attrs)
  return obj
end