Class: Contrast::Agent::Reporting::FindingEventProperty
- Inherits:
-
ReportableHash
- Object
- ReportableHash
- Contrast::Agent::Reporting::FindingEventProperty
- Defined in:
- lib/contrast/agent/reporting/reporting_events/finding_event_property.rb
Overview
This is the new FindingEventProperty class which will include all the needed information for the new reporting system to relay this information in the Finding/Trace messages. Events have properties on them which are held as an array of key-value pairs.
Instance Attribute Summary collapse
-
#key ⇒ String
readonly
The key of the property.
-
#value ⇒ String
readonly
The value of the source.
Instance Method Summary collapse
-
#initialize(key, value) ⇒ FindingEventProperty
constructor
A new instance of FindingEventProperty.
-
#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 ReportableHash
Methods included from Components::Logger::InstanceMethods
Constructor Details
#initialize(key, value) ⇒ FindingEventProperty
Returns a new instance of FindingEventProperty.
19 20 21 22 23 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_property.rb', line 19 def initialize key, value @key = key @value = value super() end |
Instance Attribute Details
#key ⇒ String (readonly)
Returns the key of the property.
15 16 17 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_property.rb', line 15 def key @key end |
#value ⇒ String (readonly)
Returns the value of the source.
17 18 19 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_property.rb', line 17 def value @value end |
Instance Method Details
#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.
30 31 32 33 34 35 36 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_property.rb', line 30 def to_controlled_hash validate { key: key, value: value } end |
#validate ⇒ Object
39 40 41 42 43 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_property.rb', line 39 def validate return unless Contrast::Utils::DuckUtils.empty_duck?(key) raise(ArgumentError, "#{ self } did not have a proper key. Unable to continue.") end |