Class: Fushin::Monitor
- Inherits:
-
Object
- Object
- Fushin::Monitor
- Defined in:
- lib/fushin/monitor.rb
Instance Attribute Summary collapse
-
#rss ⇒ Object
readonly
Returns the value of attribute rss.
Class Method Summary collapse
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize ⇒ Monitor
constructor
A new instance of Monitor.
Constructor Details
Instance Attribute Details
#rss ⇒ Object (readonly)
Returns the value of attribute rss.
5 6 7 |
# File 'lib/fushin/monitor.rb', line 5 def rss @rss end |
Class Method Details
.check ⇒ Object
30 31 32 |
# File 'lib/fushin/monitor.rb', line 30 def self.check new.check end |
Instance Method Details
#check ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fushin/monitor.rb', line 10 def check rss.items.each do |item| next if Cache.cached?(item.link) attachements = [].tap do |out| out << item.post.btcs.map(&:to_attachements) out << item.post.urls.map(&:to_attachements) out << item.post.attachements.map(&:to_attachements) end.flatten attachements << { text: "IoC is not found." } if attachements.empty? Notifier.notify("#{item.title} (#{item.link})", attachements) rescue StandardError => e attachements = [] attachements << { text: "#{e.class} (#{e}) is happened during processing." } Notifier.notify("#{item.title} (#{item.link})", attachements) ensure Cache.save(item.link, true) end end |