Class: Contrast::Agent::Reporting::RouteDiscoveryObservation
- Inherits:
-
ReportableHash
- Object
- ReportableHash
- Contrast::Agent::Reporting::RouteDiscoveryObservation
- Defined in:
- lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb
Overview
This is the new Route Discovery Observation class which will include all the needed information for the new reporting system to relay this information in the Application Update messages. These route observations are used by TeamServer to construct the route coverage information for the assess feature. They represent the literal URL and HTTP verb used to invoke a method in the application, as routed by the application framework.
Instance Attribute Summary collapse
-
#url ⇒ String
The URL requested to hit this endpoint.
-
#verb ⇒ String
The HTTP Method requested to his this endpoint.
Instance Method Summary collapse
-
#initialize(url, verb) ⇒ RouteDiscoveryObservation
constructor
A new instance of RouteDiscoveryObservation.
-
#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(url, verb) ⇒ RouteDiscoveryObservation
Returns a new instance of RouteDiscoveryObservation.
22 23 24 25 26 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb', line 22 def initialize url, verb @url = url @verb = verb if Contrast::Utils::StringUtils.present?(verb) super() end |
Instance Attribute Details
#url ⇒ String
Returns the URL requested to hit this endpoint. Required for reporting; required attributes.
17 18 19 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb', line 17 def url @url end |
#verb ⇒ String
Returns the HTTP Method requested to his this endpoint. Empty means all, so is allowed for reporting; optional attributes.
20 21 22 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb', line 20 def verb @verb 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.
33 34 35 36 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb', line 33 def to_controlled_hash validate { url: url, verb: verb }.compact end |
#validate ⇒ Object
Ensure the required fields are present.
41 42 43 44 45 |
# File 'lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb', line 41 def validate return unless Contrast::Utils::DuckUtils.empty_duck?(url) raise(ArgumentError, "#{ self } did not have a proper url. Unable to continue.") end |