Class: ReviewFetcher
- Inherits:
-
Object
show all
- Defined in:
- lib/Models/ReviewFetcher.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
11
12
13
|
# File 'lib/Models/ReviewFetcher.rb', line 11
def config
@config
end
|
#logger ⇒ Object
Returns the value of attribute logger.
11
12
13
|
# File 'lib/Models/ReviewFetcher.rb', line 11
def logger
@logger
end
|
Returns the value of attribute platform.
11
12
13
|
# File 'lib/Models/ReviewFetcher.rb', line 11
def platform
@platform
end
|
#processors ⇒ Object
Returns the value of attribute processors.
11
12
13
|
# File 'lib/Models/ReviewFetcher.rb', line 11
def processors
@processors
end
|
Instance Method Details
#execute ⇒ Object
13
14
15
|
# File 'lib/Models/ReviewFetcher.rb', line 13
def execute()
end
|
59
60
61
62
63
64
65
66
|
# File 'lib/Models/ReviewFetcher.rb', line 59
def getPlatformLatestCheckTimestamp()
filePath = "#{config.baseExecutePath}/latestCheckTimestamp/#{platform}"
if File.exist?(filePath)
return File.read(filePath).to_i
else
return 0
end
end
|
#isSentWelcomeMessage ⇒ Object
48
49
50
51
|
# File 'lib/Models/ReviewFetcher.rb', line 48
def isSentWelcomeMessage()
filePath = "#{config.baseExecutePath}/latestCheckTimestamp/#{platform}Welcome"
return File.exist?(filePath)
end
|
#processReviews(reviews, platform) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/Models/ReviewFetcher.rb', line 21
def processReviews(reviews, platform)
processors.each do |processor|
begin
reviews = processor.processReviews(reviews, platform)
rescue => e
errorMessage = "# Processor Error"
errorMessage += "#Error Message: #{e.message}\n"
errorMessage += "#Error Class: #{e.class}\n"
errorMessage += "#Backtrace Start#\n#{e.backtrace.join("\n")}\n#Backtrace End#\n"
logger.logError(errorMessage)
end
end
end
|
#registerProcessor(processor) ⇒ Object
17
18
19
|
# File 'lib/Models/ReviewFetcher.rb', line 17
def registerProcessor(processor)
processors.append(processor)
end
|
#sendWelcomMessage ⇒ Object
35
36
37
38
39
40
|
# File 'lib/Models/ReviewFetcher.rb', line 35
def sendWelcomMessage()
slackProcessor = processors.find { |processor| processor.is_a?(SlackProcessor) }
if !slackProcessor.nil?
slackProcessor.sendWelcomMessage(platform)
end
end
|
53
54
55
56
57
|
# File 'lib/Models/ReviewFetcher.rb', line 53
def setPlatformLatestCheckTimestamp(timestamp)
basePath = "#{config.baseExecutePath}/latestCheckTimestamp/"
Helper.createDirIfNotExist(basePath)
File.open("#{basePath}/#{platform}", 'w') { |file| file.write(timestamp) }
end
|
#setSentWelcomeMessage ⇒ Object
42
43
44
45
46
|
# File 'lib/Models/ReviewFetcher.rb', line 42
def setSentWelcomeMessage()
basePath = "#{config.baseExecutePath}/latestCheckTimestamp/"
Helper.createDirIfNotExist(basePath)
File.open("#{basePath}/#{platform}Welcome", 'w') { |file| file.write("") }
end
|