Class: Contrast::Agent::Reporting::RouteDiscovery
- Inherits:
-
ReportableHash
- Object
- ReportableHash
- Contrast::Agent::Reporting::RouteDiscovery
- Defined in:
- lib/contrast/agent/reporting/reporting_events/route_discovery.rb
Overview
This is the new Route Discovery class which will include all the needed information for the new reporting system to relay this information in the Application Update messages. These discoveries are used by TeamServer to construct the route coverage information for the assess feature. They represent those methods which map to externally accessible endpoints within the application, as registered to the application framework. They may or may not have been invoked at the time of reporting.
Instance Attribute Summary collapse
-
#observations ⇒ Array<Contrast::Agent::Reporting::RouteDiscoveryObservation>
readonly
The routes and verbs seen that match to this Route.
-
#signature ⇒ String
The unique identifier for this route; typically the method signature.
Instance Method Summary collapse
-
#initialize(signature, observation) ⇒ RouteDiscovery
constructor
A new instance of RouteDiscovery.
-
#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
Ensure the required fields are present.
Methods inherited from ReportableHash
Methods included from Components::Logger::InstanceMethods
Constructor Details
#initialize(signature, observation) ⇒ RouteDiscovery
Returns a new instance of RouteDiscovery.
27 28 29 30 31 32 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery.rb', line 27 def initialize signature, observation @signature = signature @observations = [] observations << observation super() end |
Instance Attribute Details
#observations ⇒ Array<Contrast::Agent::Reporting::RouteDiscoveryObservation> (readonly)
Returns the routes and verbs seen that match to this Route.
20 21 22 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery.rb', line 20 def observations @observations end |
#signature ⇒ String
Returns the unique identifier for this route; typically the method signature. Required for reporting.
23 24 25 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery.rb', line 23 def signature @signature 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.
39 40 41 42 43 44 45 46 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery.rb', line 39 def to_controlled_hash validate { count: 0, # we have this to make TS happy observations: @observations.map(&:to_controlled_hash), signature: @signature } end |
#validate ⇒ Object
Ensure the required fields are present.
51 52 53 54 55 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery.rb', line 51 def validate return unless Contrast::Utils::DuckUtils.empty_duck?(signature) raise(ArgumentError, "#{ self } did not have a proper signature. Unable to continue.") end |