Class: Verizon::AnomalyTriggerValue

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/anomaly_trigger_value.rb

Overview

Trigger details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(trigger_id: SKIP, trigger_name: SKIP, organization_name: SKIP, trigger_category: SKIP, trigger_attributes: SKIP, created_at: SKIP, modified_at: SKIP, additional_properties: nil) ⇒ AnomalyTriggerValue

Returns a new instance of AnomalyTriggerValue.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 73

def initialize(trigger_id: SKIP, trigger_name: SKIP,
               organization_name: SKIP, trigger_category: SKIP,
               trigger_attributes: SKIP, created_at: SKIP,
               modified_at: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @trigger_id = trigger_id unless trigger_id == SKIP
  @trigger_name = trigger_name unless trigger_name == SKIP
  @organization_name = organization_name unless organization_name == SKIP
  @trigger_category = trigger_category unless trigger_category == SKIP
  @trigger_attributes = trigger_attributes unless trigger_attributes == SKIP
  @created_at = created_at unless created_at == SKIP
  @modified_at = modified_at unless modified_at == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_atString

Timestamp for whe the trigger was created.

Returns:

  • (String)


36
37
38
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 36

def created_at
  @created_at
end

#modified_atString

Timestamp for the most recent time the trigger was modified.

Returns:

  • (String)


40
41
42
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 40

def modified_at
  @modified_at
end

#organization_nameString

The user assigned name of the organization associated with the trigger.

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 22

def organization_name
  @organization_name
end

#trigger_attributesArray[Object]

Additional details and keys for the trigger.

Returns:

  • (Array[Object])


32
33
34
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 32

def trigger_attributes
  @trigger_attributes
end

#trigger_categoryString

This is the value to use in the request body to detect anomalous behaivior. The values in this table will only be relevant when this parameter is set to this value.

Returns:

  • (String)


28
29
30
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 28

def trigger_category
  @trigger_category
end

#trigger_idString

The system assigned name of the trigger being updated.

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 14

def trigger_id
  @trigger_id
end

#trigger_nameString

The user defined name of the trigger.

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 18

def trigger_name
  @trigger_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  trigger_id = hash.key?('triggerId') ? hash['triggerId'] : SKIP
  trigger_name = hash.key?('triggerName') ? hash['triggerName'] : SKIP
  organization_name =
    hash.key?('organizationName') ? hash['organizationName'] : SKIP
  trigger_category =
    hash.key?('triggerCategory') ? hash['triggerCategory'] : SKIP
  trigger_attributes = hash.key?('triggerAttributes') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:TriggerAttributesOptions), hash['triggerAttributes']
  ) : SKIP
  created_at = hash.key?('createdAt') ? hash['createdAt'] : SKIP
  modified_at = hash.key?('modifiedAt') ? hash['modifiedAt'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  AnomalyTriggerValue.new(trigger_id: trigger_id,
                          trigger_name: trigger_name,
                          organization_name: organization_name,
                          trigger_category: trigger_category,
                          trigger_attributes: trigger_attributes,
                          created_at: created_at,
                          modified_at: modified_at,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['trigger_id'] = 'triggerId'
  @_hash['trigger_name'] = 'triggerName'
  @_hash['organization_name'] = 'organizationName'
  @_hash['trigger_category'] = 'triggerCategory'
  @_hash['trigger_attributes'] = 'triggerAttributes'
  @_hash['created_at'] = 'createdAt'
  @_hash['modified_at'] = 'modifiedAt'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 56

def self.optionals
  %w[
    trigger_id
    trigger_name
    organization_name
    trigger_category
    trigger_attributes
    created_at
    modified_at
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



127
128
129
130
131
132
133
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 127

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



145
146
147
148
149
150
151
152
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 145

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} trigger_id: #{@trigger_id.inspect}, trigger_name: #{@trigger_name.inspect},"\
  " organization_name: #{@organization_name.inspect}, trigger_category:"\
  " #{@trigger_category.inspect}, trigger_attributes: #{@trigger_attributes.inspect},"\
  " created_at: #{@created_at.inspect}, modified_at: #{@modified_at.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



136
137
138
139
140
141
142
# File 'lib/verizon/models/anomaly_trigger_value.rb', line 136

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} trigger_id: #{@trigger_id}, trigger_name: #{@trigger_name},"\
  " organization_name: #{@organization_name}, trigger_category: #{@trigger_category},"\
  " trigger_attributes: #{@trigger_attributes}, created_at: #{@created_at}, modified_at:"\
  " #{@modified_at}, additional_properties: #{@additional_properties}>"
end