Class: TalonOne::Risk
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- TalonOne::Risk
- Defined in:
- lib/talon_one_sdk/models/risk.rb
Overview
A risk detected by the anomaly detection service for one Application group.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#activity ⇒ Object
The activity metric the risk was detected in.
-
#affected_entity_count ⇒ Object
The total number of entities affected by this risk.
-
#application_id ⇒ Object
The ID of the Application this risk belongs to.
-
#created ⇒ Object
The time this entity was created.
-
#criticality ⇒ Object
The critical classification bucket of this risk.
-
#description ⇒ Object
Human-readable description of the detected anomaly.
-
#discard_reason ⇒ Object
The reason this risk was discarded.
-
#entity ⇒ Object
The entity type the risk was detected in.
-
#feature_date ⇒ Object
The date of the activity data in which this risk was detected.
-
#group_key ⇒ Object
The Application group this risk was detected in.
-
#id ⇒ Object
The internal ID of this entity.
-
#modified ⇒ Object
Timestamp of the most recent update.
-
#notification_id ⇒ Object
The ID of the risk notification rule that flagged this risk.
-
#reported_date ⇒ Object
The time the ML service reported this risk.
-
#status ⇒ Object
The triage lifecycle status of this risk.
-
#status_changed_at ⇒ Object
The time of the latest reclassification action.
-
#status_changed_by ⇒ Object
The ID of the user who performed the latest reclassification action.
-
#status_comment ⇒ Object
The free-text details of the latest reclassification action: the description for resolving confirmed risks, or the details for discarding risks.
-
#time_frame ⇒ Object
The rolling time window of the risk evaluation.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Risk
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Risk
Initializes the object
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/talon_one_sdk/models/risk.rb', line 173 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::Risk` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::Risk`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'created') self.created = attributes[:'created'] else self.created = nil end if attributes.key?(:'notification_id') self.notification_id = attributes[:'notification_id'] else self.notification_id = nil end if attributes.key?(:'feature_date') self.feature_date = attributes[:'feature_date'] else self.feature_date = nil end if attributes.key?(:'group_key') self.group_key = attributes[:'group_key'] else self.group_key = nil end if attributes.key?(:'application_id') self.application_id = attributes[:'application_id'] end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'criticality') self.criticality = attributes[:'criticality'] else self.criticality = nil end if attributes.key?(:'entity') self.entity = attributes[:'entity'] else self.entity = nil end if attributes.key?(:'activity') self.activity = attributes[:'activity'] else self.activity = nil end if attributes.key?(:'time_frame') self.time_frame = attributes[:'time_frame'] else self.time_frame = nil end if attributes.key?(:'reported_date') self.reported_date = attributes[:'reported_date'] else self.reported_date = nil end if attributes.key?(:'affected_entity_count') self.affected_entity_count = attributes[:'affected_entity_count'] else self.affected_entity_count = nil end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'discard_reason') self.discard_reason = attributes[:'discard_reason'] end if attributes.key?(:'status_comment') self.status_comment = attributes[:'status_comment'] end if attributes.key?(:'status_changed_by') self.status_changed_by = attributes[:'status_changed_by'] end if attributes.key?(:'status_changed_at') self.status_changed_at = attributes[:'status_changed_at'] end if attributes.key?(:'modified') self.modified = attributes[:'modified'] else self.modified = nil end end |
Instance Attribute Details
#activity ⇒ Object
The activity metric the risk was detected in.
47 48 49 |
# File 'lib/talon_one_sdk/models/risk.rb', line 47 def activity @activity end |
#affected_entity_count ⇒ Object
The total number of entities affected by this risk.
56 57 58 |
# File 'lib/talon_one_sdk/models/risk.rb', line 56 def affected_entity_count @affected_entity_count end |
#application_id ⇒ Object
The ID of the Application this risk belongs to. Absent for global metrics.
35 36 37 |
# File 'lib/talon_one_sdk/models/risk.rb', line 35 def application_id @application_id end |
#created ⇒ Object
The time this entity was created.
23 24 25 |
# File 'lib/talon_one_sdk/models/risk.rb', line 23 def created @created end |
#criticality ⇒ Object
The critical classification bucket of this risk.
41 42 43 |
# File 'lib/talon_one_sdk/models/risk.rb', line 41 def criticality @criticality end |
#description ⇒ Object
Human-readable description of the detected anomaly.
59 60 61 |
# File 'lib/talon_one_sdk/models/risk.rb', line 59 def description @description end |
#discard_reason ⇒ Object
The reason this risk was discarded. Only present on discarded risks.
62 63 64 |
# File 'lib/talon_one_sdk/models/risk.rb', line 62 def discard_reason @discard_reason end |
#entity ⇒ Object
The entity type the risk was detected in.
44 45 46 |
# File 'lib/talon_one_sdk/models/risk.rb', line 44 def entity @entity end |
#feature_date ⇒ Object
The date of the activity data in which this risk was detected. The anomaly detection pipeline scores complete 24-hour cycles, so this is always the day before the risk was reported, not the reporting date itself.
29 30 31 |
# File 'lib/talon_one_sdk/models/risk.rb', line 29 def feature_date @feature_date end |
#group_key ⇒ Object
The Application group this risk was detected in. Contains the Application ID, or __GLOBAL__ for metrics that are not grouped by Application.
32 33 34 |
# File 'lib/talon_one_sdk/models/risk.rb', line 32 def group_key @group_key end |
#id ⇒ Object
The internal ID of this entity.
20 21 22 |
# File 'lib/talon_one_sdk/models/risk.rb', line 20 def id @id end |
#modified ⇒ Object
Timestamp of the most recent update.
74 75 76 |
# File 'lib/talon_one_sdk/models/risk.rb', line 74 def modified @modified end |
#notification_id ⇒ Object
The ID of the risk notification rule that flagged this risk.
26 27 28 |
# File 'lib/talon_one_sdk/models/risk.rb', line 26 def notification_id @notification_id end |
#reported_date ⇒ Object
The time the ML service reported this risk.
53 54 55 |
# File 'lib/talon_one_sdk/models/risk.rb', line 53 def reported_date @reported_date end |
#status ⇒ Object
The triage lifecycle status of this risk.
38 39 40 |
# File 'lib/talon_one_sdk/models/risk.rb', line 38 def status @status end |
#status_changed_at ⇒ Object
The time of the latest reclassification action.
71 72 73 |
# File 'lib/talon_one_sdk/models/risk.rb', line 71 def status_changed_at @status_changed_at end |
#status_changed_by ⇒ Object
The ID of the user who performed the latest reclassification action.
68 69 70 |
# File 'lib/talon_one_sdk/models/risk.rb', line 68 def status_changed_by @status_changed_by end |
#status_comment ⇒ Object
The free-text details of the latest reclassification action: the description for resolving confirmed risks, or the details for discarding risks.
65 66 67 |
# File 'lib/talon_one_sdk/models/risk.rb', line 65 def status_comment @status_comment end |
#time_frame ⇒ Object
The rolling time window of the risk evaluation.
50 51 52 |
# File 'lib/talon_one_sdk/models/risk.rb', line 50 def time_frame @time_frame end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
124 125 126 |
# File 'lib/talon_one_sdk/models/risk.rb', line 124 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
129 130 131 |
# File 'lib/talon_one_sdk/models/risk.rb', line 129 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/talon_one_sdk/models/risk.rb', line 99 def self.attribute_map { :'id' => :'id', :'created' => :'created', :'notification_id' => :'notificationId', :'feature_date' => :'featureDate', :'group_key' => :'groupKey', :'application_id' => :'applicationId', :'status' => :'status', :'criticality' => :'criticality', :'entity' => :'entity', :'activity' => :'activity', :'time_frame' => :'timeFrame', :'reported_date' => :'reportedDate', :'affected_entity_count' => :'affectedEntityCount', :'description' => :'description', :'discard_reason' => :'discardReason', :'status_comment' => :'statusComment', :'status_changed_by' => :'statusChangedBy', :'status_changed_at' => :'statusChangedAt', :'modified' => :'modified' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'lib/talon_one_sdk/models/risk.rb', line 563 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
165 166 167 168 169 |
# File 'lib/talon_one_sdk/models/risk.rb', line 165 def self.openapi_all_of [ :'Entity' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
159 160 161 162 |
# File 'lib/talon_one_sdk/models/risk.rb', line 159 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/talon_one_sdk/models/risk.rb', line 134 def self.openapi_types { :'id' => :'Integer', :'created' => :'Time', :'notification_id' => :'Integer', :'feature_date' => :'Date', :'group_key' => :'String', :'application_id' => :'Integer', :'status' => :'String', :'criticality' => :'String', :'entity' => :'String', :'activity' => :'String', :'time_frame' => :'String', :'reported_date' => :'Time', :'affected_entity_count' => :'Integer', :'description' => :'String', :'discard_reason' => :'String', :'status_comment' => :'String', :'status_changed_by' => :'Integer', :'status_changed_at' => :'Time', :'modified' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
# File 'lib/talon_one_sdk/models/risk.rb', line 524 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && created == o.created && notification_id == o.notification_id && feature_date == o.feature_date && group_key == o.group_key && application_id == o.application_id && status == o.status && criticality == o.criticality && entity == o.entity && activity == o.activity && time_frame == o.time_frame && reported_date == o.reported_date && affected_entity_count == o.affected_entity_count && description == o.description && discard_reason == o.discard_reason && status_comment == o.status_comment && status_changed_by == o.status_changed_by && status_changed_at == o.status_changed_at && modified == o.modified end |
#eql?(o) ⇒ Boolean
550 551 552 |
# File 'lib/talon_one_sdk/models/risk.rb', line 550 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
556 557 558 |
# File 'lib/talon_one_sdk/models/risk.rb', line 556 def hash [id, created, notification_id, feature_date, group_key, application_id, status, criticality, entity, activity, time_frame, reported_date, affected_entity_count, description, discard_reason, status_comment, status_changed_by, status_changed_at, modified].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/talon_one_sdk/models/risk.rb', line 292 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @notification_id.nil? invalid_properties.push('invalid value for "notification_id", notification_id cannot be nil.') end if @feature_date.nil? invalid_properties.push('invalid value for "feature_date", feature_date cannot be nil.') end if @group_key.nil? invalid_properties.push('invalid value for "group_key", group_key cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @criticality.nil? invalid_properties.push('invalid value for "criticality", criticality cannot be nil.') end if @entity.nil? invalid_properties.push('invalid value for "entity", entity cannot be nil.') end if @activity.nil? invalid_properties.push('invalid value for "activity", activity cannot be nil.') end if @time_frame.nil? invalid_properties.push('invalid value for "time_frame", time_frame cannot be nil.') end if @reported_date.nil? invalid_properties.push('invalid value for "reported_date", reported_date cannot be nil.') end if @affected_entity_count.nil? invalid_properties.push('invalid value for "affected_entity_count", affected_entity_count cannot be nil.') end if @modified.nil? invalid_properties.push('invalid value for "modified", modified cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/talon_one_sdk/models/risk.rb', line 585 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/talon_one_sdk/models/risk.rb', line 352 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @created.nil? return false if @notification_id.nil? return false if @feature_date.nil? return false if @group_key.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["active", "in_review", "confirmed", "discarded"]) return false unless status_validator.valid?(@status) return false if @criticality.nil? criticality_validator = EnumAttributeValidator.new('String', ["critical", "not_critical"]) return false unless criticality_validator.valid?(@criticality) return false if @entity.nil? entity_validator = EnumAttributeValidator.new('String', ["customer_profile", "customer_session"]) return false unless entity_validator.valid?(@entity) return false if @activity.nil? activity_validator = EnumAttributeValidator.new('String', ["loyalty_points_earned", "discounted_amount", "completed_orders", "coupon_attempts"]) return false unless activity_validator.valid?(@activity) return false if @time_frame.nil? time_frame_validator = EnumAttributeValidator.new('String', ["1D", "7D", "30D"]) return false unless time_frame_validator.valid?(@time_frame) return false if @reported_date.nil? return false if @affected_entity_count.nil? discard_reason_validator = EnumAttributeValidator.new('String', ["expected_behavior", "other"]) return false unless discard_reason_validator.valid?(@discard_reason) return false if @modified.nil? true end |