Class: Verizon::TriggersListOptions

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

Overview

TriggersListOptions Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#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, anomalyattributes = SKIP, notification = SKIP) ⇒ TriggersListOptions

Returns a new instance of TriggersListOptions.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/verizon/models/triggers_list_options.rb', line 85

def initialize(trigger_id = SKIP, trigger_name = SKIP,
               organization_name = SKIP, trigger_category = SKIP,
               trigger_attributes = SKIP, created_at = SKIP,
               modified_at = SKIP, anomalyattributes = SKIP,
               notification = SKIP)
  @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
  @anomalyattributes = anomalyattributes unless anomalyattributes == SKIP
  @notification = notification unless notification == SKIP
end

Instance Attribute Details

#anomalyattributesUsageAnomalyAttributes

The details of the UsageAnomaly trigger.



44
45
46
# File 'lib/verizon/models/triggers_list_options.rb', line 44

def anomalyattributes
  @anomalyattributes
end

#created_atString

Timestamp for whe the trigger was created.

Returns:

  • (String)


36
37
38
# File 'lib/verizon/models/triggers_list_options.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/triggers_list_options.rb', line 40

def modified_at
  @modified_at
end

#notificationTriggerNotification

The notification details of the trigger.

Returns:



48
49
50
# File 'lib/verizon/models/triggers_list_options.rb', line 48

def notification
  @notification
end

#organization_nameString

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

Returns:

  • (String)


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

def organization_name
  @organization_name
end

#trigger_attributesArray[TriggerAttributesOptions]

Additional details and keys for the trigger.

Returns:



32
33
34
# File 'lib/verizon/models/triggers_list_options.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/triggers_list_options.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/triggers_list_options.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/triggers_list_options.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.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/verizon/models/triggers_list_options.rb', line 102

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
  # Parameter is an array, so we need to iterate through it
  trigger_attributes = nil
  unless hash['triggerAttributes'].nil?
    trigger_attributes = []
    hash['triggerAttributes'].each do |structure|
      trigger_attributes << (TriggerAttributesOptions.from_hash(structure) if structure)
    end
  end

  trigger_attributes = SKIP unless hash.key?('triggerAttributes')
  created_at = hash.key?('createdAt') ? hash['createdAt'] : SKIP
  modified_at = hash.key?('modifiedAt') ? hash['modifiedAt'] : SKIP
  anomalyattributes = UsageAnomalyAttributes.from_hash(hash['anomalyattributes']) if
    hash['anomalyattributes']
  notification = TriggerNotification.from_hash(hash['notification']) if hash['notification']

  # Create object from extracted values.
  TriggersListOptions.new(trigger_id,
                          trigger_name,
                          organization_name,
                          trigger_category,
                          trigger_attributes,
                          created_at,
                          modified_at,
                          anomalyattributes,
                          notification)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/verizon/models/triggers_list_options.rb', line 51

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['anomalyattributes'] = 'anomalyattributes'
  @_hash['notification'] = 'notification'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/verizon/models/triggers_list_options.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/verizon/models/triggers_list_options.rb', line 66

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