class Spaceship::Tunes::AppRatings
Represents app ratings from iTunesConnect
Attributes
application[RW]
@return (Spaceship::Tunes::Application
) A reference to the application
this version is for
rating_summary[RW]
@return (Spaceship::Tunes::AppRatingSummary
) A summary of the overall ratings for the application
store_fronts[R]
@return (Hash) mapping country codes to a (Spaceship::Tunes::AppRatingSummary
) summary of ratings for that country
versions[R]
@return (Hash) of iTunesConnect version id's to readable version numbers
Public Class Methods
factory(attrs)
click to toggle source
Create a new object based on a hash. This is used to create a new object based on the server response.
# File lib/spaceship/tunes/app_ratings.rb, line 25 def factory(attrs) obj = self.new(attrs) obj.unfold_rating_summary(attrs['ratings']) obj.unfold_store_fronts(attrs['storeFronts']) return obj end
Public Instance Methods
reviews(store_front, versionId = '')
click to toggle source
@return (Array) of raw hashes representing user reviews for the given store front (and optional versionId)
# 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)
click to toggle source
# File lib/spaceship/tunes/app_ratings.rb, line 35 def unfold_rating_summary(attrs) unfolded_rating_summary = AppRatingSummary.new(attrs) instance_variable_set(:@rating_summary, unfolded_rating_summary) end
unfold_store_fronts(attrs)
click to toggle source
# 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