Class: Spaceship::Tunes::AppRatingSummary
- Defined in:
- lib/spaceship/tunes/app_ratings.rb
Instance Attribute Summary collapse
-
#five_star_rating_count ⇒ Integer
readonly
Total number of five star ratings recevied.
-
#four_star_rating_count ⇒ Integer
readonly
Total number of four star ratings recevied.
-
#one_star_rating_count ⇒ Integer
readonly
Total number of one star ratings recevied.
-
#rating_count ⇒ Integer
readonly
Total number of ratings recevied.
-
#review_count ⇒ Integer
readonly
Total number of reviews recevied.
-
#three_star_rating_count ⇒ Integer
readonly
Total number of three star ratings recevied.
-
#two_star_rating_count ⇒ Integer
readonly
Total number of two star ratings recevied.
Attributes inherited from Base
Class Method Summary collapse
-
.factory(attrs) ⇒ Object
Create a new object based on a hash.
Instance Method Summary collapse
-
#average_rating ⇒ Float
The average rating for this summary (rounded to 2 decimal places).
Methods inherited from TunesBase
Methods inherited from Base
attr_accessor, attr_mapping, #attributes, attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#five_star_rating_count ⇒ Integer (readonly)
Returns total number of five star ratings recevied.
76 77 78 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 76 def @five_star_rating_count end |
#four_star_rating_count ⇒ Integer (readonly)
Returns total number of four star ratings recevied.
73 74 75 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 73 def @four_star_rating_count end |
#one_star_rating_count ⇒ Integer (readonly)
Returns total number of one star ratings recevied.
64 65 66 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 64 def @one_star_rating_count end |
#rating_count ⇒ Integer (readonly)
Returns total number of ratings recevied.
61 62 63 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 61 def @rating_count end |
#review_count ⇒ Integer (readonly)
Returns total number of reviews recevied.
58 59 60 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 58 def review_count @review_count end |
#three_star_rating_count ⇒ Integer (readonly)
Returns total number of three star ratings recevied.
70 71 72 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 70 def @three_star_rating_count end |
#two_star_rating_count ⇒ Integer (readonly)
Returns total number of two star ratings recevied.
67 68 69 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 67 def @two_star_rating_count end |
Class Method Details
.factory(attrs) ⇒ Object
Create a new object based on a hash. This is used to create a new object based on the server response.
91 92 93 94 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 91 def factory(attrs) obj = self.new(attrs) return obj end |
Instance Method Details
#average_rating ⇒ Float
Returns the average rating for this summary (rounded to 2 decimal places).
98 99 100 101 102 103 104 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 98 def ((self. + (self. * 2) + (self. * 3) + (self. * 4) + (self. * 5)) / self..to_f).round(2) end |