Class: Spaceship::Tunes::AppRatings
- Defined in:
- spaceship/lib/spaceship/tunes/app_ratings.rb
Overview
Represents app ratings from App Store Connect
Instance Attribute Summary collapse
-
#application ⇒ Spaceship::Tunes::Application
A reference to the application this version is for.
-
#five_star_rating_count ⇒ Integer
Total number of five star ratings recevied.
-
#four_star_rating_count ⇒ Integer
Total number of four star ratings recevied.
-
#one_star_rating_count ⇒ Integer
Total number of one star ratings recevied.
-
#rating_count ⇒ Integer
Total number of ratings recevied.
-
#three_star_rating_count ⇒ Integer
Total number of three star ratings recevied.
-
#two_star_rating_count ⇒ Integer
Total number of two star ratings recevied.
Attributes inherited from Base
Instance Method Summary collapse
-
#average_rating ⇒ Float
The average rating for this summary (rounded to 2 decimal places).
-
#reviews(store_front = '', version_id = '', upto_date = nil) ⇒ Array
Of Review Objects.
Methods inherited from TunesBase
Methods inherited from Base
attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#application ⇒ Spaceship::Tunes::Application
Returns A reference to the application this version is for.
9 10 11 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 9 def application @application end |
#five_star_rating_count ⇒ Integer
Returns total number of five star ratings recevied.
27 28 29 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 27 def @five_star_rating_count end |
#four_star_rating_count ⇒ Integer
Returns total number of four star ratings recevied.
24 25 26 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 24 def @four_star_rating_count end |
#one_star_rating_count ⇒ Integer
Returns total number of one star ratings recevied.
15 16 17 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 15 def @one_star_rating_count end |
#rating_count ⇒ Integer
Returns total number of ratings recevied.
12 13 14 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 12 def @rating_count end |
#three_star_rating_count ⇒ Integer
Returns total number of three star ratings recevied.
21 22 23 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 21 def @three_star_rating_count end |
#two_star_rating_count ⇒ Integer
Returns total number of two star ratings recevied.
18 19 20 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 18 def @two_star_rating_count end |
Instance Method Details
#average_rating ⇒ Float
Returns the average rating for this summary (rounded to 2 decimal places).
40 41 42 43 44 45 46 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 40 def (( + ( * 2) + ( * 3) + ( * 4) + ( * 5)) / .to_f).round(2) end |
#reviews(store_front = '', version_id = '', upto_date = nil) ⇒ Array
Returns of Review Objects.
49 50 51 52 53 54 55 |
# File 'spaceship/lib/spaceship/tunes/app_ratings.rb', line 49 def reviews(store_front = '', version_id = '', upto_date = nil) raw_reviews = client.get_reviews(application.apple_id, application.platform, store_front, version_id, upto_date) raw_reviews.map do |review| review["value"]["application"] = self.application AppReview.factory(review["value"]) end end |