Class: Contrast::Agent::Reporting::Preflight
- Inherits:
-
ApplicationReportingEvent
- Object
- ReportableHash
- ReportingEvent
- ApplicationReportingEvent
- Contrast::Agent::Reporting::Preflight
- Defined in:
- lib/contrast/agent/reporting/reporting_events/preflight.rb
Overview
This is the new Preflight class which will include all the needed information for the new reporting system to report a Preflight message to TeamServer. This message represents the identifying information of a collection of Findings/Traces, which TeamServer will use to determine if it requires the full information of any of the Findings/Traces to be reported.
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
For our purposes, we’ll only ever send one message per request; however, we must use an array to conform to the specification.
Attributes inherited from ReportingEvent
#event_endpoint, #event_method
Instance Method Summary collapse
- #file_name ⇒ Object
-
#initialize ⇒ Preflight
constructor
A new instance of Preflight.
-
#to_controlled_hash ⇒ Hash
Convert the instance variables on the class, and other information, into the identifiers required for TeamServer to process the JSON form of this message.
- #validate ⇒ Object
Methods inherited from ReportingEvent
Methods inherited from ReportableHash
Methods included from Components::Logger::InstanceMethods
Constructor Details
Instance Attribute Details
#messages ⇒ Object (readonly)
For our purposes, we’ll only ever send one message per request; however, we must use an array to conform to the specification.
18 19 20 |
# File 'lib/contrast/agent/reporting/reporting_events/preflight.rb', line 18 def @messages end |
Instance Method Details
#file_name ⇒ Object
27 28 29 |
# File 'lib/contrast/agent/reporting/reporting_events/preflight.rb', line 27 def file_name 'preflight' end |
#to_controlled_hash ⇒ Hash
Convert the instance variables on the class, and other information, into the identifiers required for TeamServer to process the JSON form of this message.
36 37 38 39 |
# File 'lib/contrast/agent/reporting/reporting_events/preflight.rb', line 36 def to_controlled_hash validate { messages: @messages.map(&:to_controlled_hash) } end |
#validate ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/contrast/agent/reporting/reporting_events/preflight.rb', line 42 def validate if Contrast::Utils::DuckUtils.empty_duck?() raise(ArgumentError, "#{ cs__class } did not have any messages. Unable to continue.") end nil end |