class Threatinator::Event
Constants
- EventHeader
- VALID_TYPES
Attributes
feed_name[R]
feed_provider[R]
fqdns[R]
ipv4s[R]
type[R]
urls[R]
Public Class Methods
new(opts = {})
click to toggle source
@param [Hash] opts @option opts [String] :feed_provider The name of the feed provider @option opts [String] :feed_name The name of the feed @option opts [Symbol] :type The 'type' of feed. @option opts [#each] :ipv4s A collection of ipv4s @option opts [#each] :fqdns A collection of FQDNs @option opts [#each] :urls A collection of Urls
Calls superclass method
Threatinator::Model::Base::new
# File lib/threatinator/event.rb, line 30 def initialize(opts = {}) @feed_provider = opts[:feed_provider] @feed_name = opts[:feed_name] @type = opts[:type] @ipv4s = Threatinator::Model::Observables::Ipv4Collection.new(opts[:ipv4s] || []) @fqdns = Threatinator::Model::Observables::FqdnCollection.new(opts[:fqdns] || []) @urls = Threatinator::Model::Observables::UrlCollection.new(opts[:urls] || []) super() end
Public Instance Methods
header()
click to toggle source
# File lib/threatinator/event.rb, line 40 def header event_header = EventHeader.new(@feed_provider, @feed_name, @type) end
to_serializable_hash()
click to toggle source
# File lib/threatinator/event.rb, line 44 def to_serializable_hash ret = { import_time: Time.now.utc.to_i, feed_provider: @feed_provider, feed_name: @feed_name, source: 'threatinator' } if @type ret[:tags] = @type.to_s end ret[:ipv4s] = @ipv4s.list ret[:fqdns] = @fqdns.list ret[:urls] = @urls.list ret end