Sha256: db78e53b00225a9295bf94d149e70b81e8339974ff6c9dec3b607663bd20089e
Contents?: true
Size: 1.52 KB
Versions: 4
Compression:
Stored size: 1.52 KB
Contents
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module Contrast module Agent module Reporting # The usage, meaning loaded files, of a library seen during this request class LibraryUsageObservation # @param [String] Sha256Sum of library as identified by the agent attr_accessor :id # @param [Array<String>] List of file paths that have been loaded out of or executed by the library attr_reader :names class << self # Convert a DTM for SpeedRacer to an Event for TeamServer. # # @param usage_dtm [Contrast::Api::Dtm::LibraryUsageUpdate] # @return [Contrast::Agent::Reporting::LibraryUsageObservation] def convert usage_dtm observation = new observation.attach_data(usage_dtm) observation end end def initialize @names = [] end def attach_data usage_dtm @id = usage_dtm.hash_code @names = usage_dtm.class_names.keys end def to_controlled_hash validate { id: @id, names: @names } end def validate raise(ArgumentError, "#{ self } did not have a proper id. Unable to continue.") unless id raise(ArgumentError, "#{ self } did not have a proper names. Unable to continue.") if names.empty? end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems