Class: AppleFetcher
- Inherits:
-
ReviewFetcher
- Object
- ReviewFetcher
- AppleFetcher
- Defined in:
- lib/AppleFetcher.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from ReviewFetcher
#config, #logger, #platform, #processors
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(config) ⇒ AppleFetcher
constructor
A new instance of AppleFetcher.
Methods inherited from ReviewFetcher
#getPlatformLatestCheckTimestamp, #processReviews, #registerProcessor, #sendWelcomMessage, #setPlatformLatestCheckTimestamp
Constructor Details
#initialize(config) ⇒ AppleFetcher
Returns a new instance of AppleFetcher.
15 16 17 18 19 20 21 22 23 |
# File 'lib/AppleFetcher.rb', line 15 def initialize(config) @processors = [] @config = config @logger = ZLogger.new(config.baseExecutePath) @platform = 'Apple' @token = generateJWT() puts "[AppleFetcher] Init Success." end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
13 14 15 |
# File 'lib/AppleFetcher.rb', line 13 def token @token end |
Instance Method Details
#execute ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/AppleFetcher.rb', line 25 def execute() latestCheckTimestamp = getPlatformLatestCheckTimestamp() puts "[AppleFetcher] Start execute(), latestCheckTimestamp: #{latestCheckTimestamp}" reviews = fetchReviews(latestCheckTimestamp) if reviews.length > 0 reviews.sort! { |a, b| a.createdDateTimestamp <=> b.createdDateTimestamp } puts "[AppleFetcher] latest review: #{reviews.last.body}, #{reviews.last.createdDateTimestamp}" setPlatformLatestCheckTimestamp(reviews.last.createdDateTimestamp) end # init first time, send welcome message if latestCheckTimestamp == 0 sendWelcomMessage() elsif reviews.length > 0 reviews = fullfillAppInfo(reviews) processReviews(reviews, platform) end end |