Class: Contrast::Api::Communication::ResponseProcessor

Inherits:
Object
  • Object
show all
Includes:
Components::Interface
Defined in:
lib/contrast/api/communication/response_processor.rb

Overview

Handles processing deferred messages

Instance Method Summary collapse

Methods included from Components::Interface

included

Instance Method Details

#process(response) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/contrast/api/communication/response_processor.rb', line 14

def process response
  logger.debug('Received a response', sent_ms: response&.sent_ms)

  server_features = process_server_response(response)
  app_settings = process_application_response(response)

  # ReactionProcessor is a design pattern from TeamServer.
  # Right now, there's one potential reaction, which is disabling the agent
  Contrast::Agent::ReactionProcessor.process(response&.application_settings)

  Contrast::Logger::Log.instance.update(server_features&.log_file, server_features&.log_level)
  update_features(server_features, app_settings)
  logger.trace(
      'Agent settings updated in response to Service',
      protect_on: PROTECT.enabled?,
      assess_on: ASSESS.enabled?)
end