Class: Threatinator::Actions::Run::Action

Inherits:
Threatinator::Action show all
Defined in:
lib/threatinator/actions/run/action.rb

Instance Attribute Summary

Attributes inherited from Threatinator::Action

#registry

Instance Method Summary collapse

Constructor Details

#initialize(registry, config) ⇒ Action

Returns a new instance of Action.



10
11
12
13
# File 'lib/threatinator/actions/run/action.rb', line 10

def initialize(registry, config)
  super(registry)
  @config = config
end

Instance Method Details

#build_outputObject



15
16
17
# File 'lib/threatinator/actions/run/action.rb', line 15

def build_output
  @config.output.build_output
end

#execObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/threatinator/actions/run/action.rb', line 19

def exec
  opts = {}

  feed = registry.get(@config.feed_provider, @config.feed_name)
  if feed.nil?
    raise Threatinator::Exceptions::UnknownFeed.new(@config.feed_provider, @config.feed_name)
  end

  output = build_output

  feed_runner = Threatinator::FeedRunner.new(feed, output)

  @config.observers.each do |observer|
    feed_runner.add_observer(observer)
  end

  feed_runner.run

#          if feed_report.num_records_missed != 0
#            $stderr.puts "WARNING: #{feed_report.num_records_missed} lines/records were MISSED (neither filtered nor parsed). You may need to update your feed specification! Rerun with --coverage to see which records are parsed/filtered/missed" 
#          end

end