Class: AppStore::UserReview

Inherits:
Base
  • Object
show all
Defined in:
lib/app_store/user_review.rb

Overview

Each Application can have multiple user reviews. Available attributes:

  • average_user_rating: rating given by the user for the application.

  • user_name: name of the user who made the rating.

  • title: title of the rating (probably some internal apple stuff).

  • text: comment leaved by the user.

Instance Attribute Summary

Attributes inherited from Base

#raw

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helper::Plist

#plist

Constructor Details

This class inherits a constructor from AppStore::Base

Instance Method Details

#clean_titleObject

title extracted from title without position and version



29
30
31
# File 'lib/app_store/user_review.rb', line 29

def clean_title
  title.match(/^[0-9]+\. (.*) \(v.*\)$/)[1]
end

#clean_user_nameObject

user_name without date



39
40
41
# File 'lib/app_store/user_review.rb', line 39

def clean_user_name
  user_name.match(/^(.*) on [a-zA-Z]{3} [0-9]{1,2}, [0-9]{4}$/)[1]
end

#dateObject

date of the comment, extracted from user_name



34
35
36
# File 'lib/app_store/user_review.rb', line 34

def date
  Time.parse user_name.match(/ on ([a-zA-Z]{3} [0-9]{1,2}, [0-9]{4})$/)[1]
end

#on_versionObject

version on which the comment was made



19
20
21
# File 'lib/app_store/user_review.rb', line 19

def on_version
  @on_version ||= title.match(/.*\(v(.*)\)$/)[1]
end

#positionObject

display position of the user review



24
25
26
# File 'lib/app_store/user_review.rb', line 24

def position
  @position ||= title.match(/^([0-9]+)\..*/)[1]
end