Class: Contrast::Agent::Reporting::FindingEventParentObject

Inherits:
ReportableHash show all
Defined in:
lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb

Overview

This is the new FindingEventParentObject class which will include all the needed information for the new reporting system to relay this information in the Finding/Trace messages. These FindingEventParentObject are used by TeamServer to relate this event to those that came previously. They represent the events that directly preceding the FindingEvent generated.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ReportableHash

#event_json, #valid?

Methods included from Components::Logger::InstanceMethods

#cef_logger, #logger

Constructor Details

#initialize(id) ⇒ FindingEventParentObject



19
20
21
22
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb', line 19

def initialize id
  @id = id
  super()
end

Instance Attribute Details

#idInteger (readonly)



17
18
19
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb', line 17

def id
  @id
end

Instance Method Details

#to_controlled_hashHash

Convert the instance variables on the class, and other information, into the identifiers required for TeamServer to process the JSON form of this message.

Raises:

  • (ArgumentError)


29
30
31
32
33
34
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb', line 29

def to_controlled_hash
  validate
  {
      id: id
  }
end

#validateObject

Raises:

  • (ArgumentError)


37
38
39
40
41
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb', line 37

def validate
  return unless Contrast::Utils::DuckUtils.empty_duck?(id)

  raise(ArgumentError, "#{ self } did not have a proper id. Unable to continue.")
end