Sha256: 1d6a6441ae59f4a448d4ef896c731b08eb85de053b747a79a2afdd7eac089bf5
Contents?: true
Size: 1.95 KB
Versions: 13
Compression:
Stored size: 1.95 KB
Contents
module Datadog module Core module Telemetry module V1 # Describes attributes for integration object class Integration ERROR_NIL_ENABLED_MESSAGE = ':enabled must not be nil'.freeze ERROR_NIL_NAME_MESSAGE = ':name must not be nil'.freeze attr_reader \ :auto_enabled, :compatible, :enabled, :error, :name, :version # @param enabled [Boolean] Whether integration is enabled at time of request # @param name [String] Integration name # @param auto_enabled [Boolean] If integration is not enabled by default, but by user choice # @param compatible [Boolean] If integration is available, but incompatible # @param error [String] Error message if integration fails to load # @param version [String] Integration version (if specified in app-started, it should be for other events too) def initialize(enabled:, name:, auto_enabled: nil, compatible: nil, error: nil, version: nil) validate(enabled: enabled, name: name) @auto_enabled = auto_enabled @compatible = compatible @enabled = enabled @error = error @name = name @version = version end def to_h { auto_enabled: @auto_enabled, compatible: @compatible, enabled: @enabled, error: @error, name: @name, version: @version } end private # Validates all required arguments passed to the class on initialization are not nil # # @!visibility private def validate(enabled:, name:) raise ArgumentError, ERROR_NIL_ENABLED_MESSAGE if enabled.nil? raise ArgumentError, ERROR_NIL_NAME_MESSAGE if name.nil? end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems