Class: Spaceship::Tunes::AppRatings
- Defined in:
- lib/spaceship/tunes/app_ratings.rb
Overview
Represents app ratings from iTunesConnect
Instance Attribute Summary collapse
-
#application ⇒ Spaceship::Tunes::Application
A reference to the application this version is for.
-
#rating_summary ⇒ Spaceship::Tunes::AppRatingSummary
A summary of the overall ratings for the application.
-
#store_fronts ⇒ Hash
readonly
Mapping country codes to a (Spaceship::Tunes::AppRatingSummary) summary of ratings for that country.
-
#versions ⇒ Hash
readonly
Of iTunesConnect version id’s to readable version numbers.
Attributes inherited from Base
Class Method Summary collapse
-
.factory(attrs) ⇒ Object
Create a new object based on a hash.
Instance Method Summary collapse
-
#reviews(store_front, versionId = '') ⇒ Array
Of raw hashes representing user reviews for the given store front (and optional versionId).
- #unfold_rating_summary(attrs) ⇒ Object
- #unfold_store_fronts(attrs) ⇒ Object
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
#application ⇒ Spaceship::Tunes::Application
Returns A reference to the application this version is for.
7 8 9 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 7 def application @application end |
#rating_summary ⇒ Spaceship::Tunes::AppRatingSummary
Returns A summary of the overall ratings for the application.
10 11 12 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 10 def @rating_summary end |
#store_fronts ⇒ Hash (readonly)
Returns mapping country codes to a (Spaceship::Tunes::AppRatingSummary) summary of ratings for that country.
13 14 15 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 13 def store_fronts @store_fronts end |
#versions ⇒ Hash (readonly)
Returns of iTunesConnect version id’s to readable version numbers.
16 17 18 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 16 def versions @versions 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.
25 26 27 28 29 30 31 32 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 25 def factory(attrs) obj = self.new(attrs) obj.(attrs['ratings']) obj.unfold_store_fronts(attrs['storeFronts']) return obj end |
Instance Method Details
#reviews(store_front, versionId = '') ⇒ Array
Returns of raw hashes representing user reviews for the given store front (and optional versionId).
51 52 53 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 51 def reviews(store_front, versionId = '') client.get_reviews(application.apple_id, application.platform, store_front, versionId) end |
#unfold_rating_summary(attrs) ⇒ Object
35 36 37 38 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 35 def (attrs) = AppRatingSummary.new(attrs) instance_variable_set(:@rating_summary, ) end |
#unfold_store_fronts(attrs) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/spaceship/tunes/app_ratings.rb', line 40 def unfold_store_fronts(attrs) unfolded_store_fronts = {} attrs.each do |info| unfolded_store_fronts[info['countryCode']] = AppRatingSummary.new(info['ratings']) end instance_variable_set(:@store_fronts, unfolded_store_fronts) end |