lib/contrast/agent/assess/events/event_factory.rb in contrast-agent-4.14.1 vs lib/contrast/agent/assess/events/event_factory.rb in contrast-agent-5.0.0
- old
+ new
@@ -1,23 +1,31 @@
-# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
+# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true
require 'contrast/agent/assess/contrast_event'
require 'contrast/agent/assess/events/source_event'
+require 'contrast/agent/assess/events/event_data'
module Contrast
module Agent
module Assess
module Events
# This module returns the event type appropriate to the given Node
module EventFactory
- def self.build policy_node, tagged, object, ret, args, source_type = nil, source_name = nil
- case policy_node
+ # This method returns the event type appropriate to the given Node
+ #
+ # @param event_data [Contrast::Agent::Assess::Events::EventData]
+ # @param source_type [String] the type of this source, from the
+ # source_node, or a KEY_TYPE if invoked for a map,
+ # @param source_name [String, nil] the name of this source, i.e.
+ # the key used to accessed if from a map or nil if a type like,
+ # @return [Contrast::Agent::Assess::Events::SourceEvent, Contrast::Agent::Assess::ContrastEvent]
+ def self.build event_data, source_type = nil, source_name = nil
+ case event_data.policy_node
when Contrast::Agent::Assess::Policy::SourceNode
- Contrast::Agent::Assess::Events::SourceEvent.new(policy_node, tagged, object, ret, args, source_type,
- source_name)
+ Contrast::Agent::Assess::Events::SourceEvent.new(event_data, source_type, source_name)
when Contrast::Agent::Assess::Policy::PolicyNode
- Contrast::Agent::Assess::ContrastEvent.new(policy_node, tagged, object, ret, args)
+ Contrast::Agent::Assess::ContrastEvent.new(event_data)
end
end
end
end
end