Class: Verizon::UserSmartAlert

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

Overview

UserSmartAlert Model.

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(createdon:, lastupdated:, versionid:, accountclientid: SKIP, billingaccountid: SKIP, category: SKIP, condition: SKIP, description: SKIP, deviceid: SKIP, foreignid: SKIP, id: SKIP, isacknowledged: SKIP, iscleared: SKIP, isdisabled: SKIP, name: SKIP, ruleid: SKIP, severity: SKIP, state: SKIP, template: SKIP, version: SKIP) ⇒ UserSmartAlert

Returns a new instance of UserSmartAlert.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/verizon/models/user_smart_alert.rb', line 149

def initialize(createdon:, lastupdated:, versionid:, accountclientid: SKIP,
               billingaccountid: SKIP, category: SKIP, condition: SKIP,
               description: SKIP, deviceid: SKIP, foreignid: SKIP, id: SKIP,
               isacknowledged: SKIP, iscleared: SKIP, isdisabled: SKIP,
               name: SKIP, ruleid: SKIP, severity: SKIP, state: SKIP,
               template: SKIP, version: SKIP)
  @accountclientid = accountclientid unless accountclientid == SKIP
  @billingaccountid = billingaccountid unless billingaccountid == SKIP
  @category = category unless category == SKIP
  @condition = condition unless condition == SKIP
  @createdon = createdon
  @description = description unless description == SKIP
  @deviceid = deviceid unless deviceid == SKIP
  @foreignid = foreignid unless foreignid == SKIP
  @id = id unless id == SKIP
  @isacknowledged = isacknowledged unless isacknowledged == SKIP
  @iscleared = iscleared unless iscleared == SKIP
  @isdisabled = isdisabled unless isdisabled == SKIP
  @lastupdated = lastupdated
  @name = name unless name == SKIP
  @ruleid = ruleid unless ruleid == SKIP
  @severity = severity unless severity == SKIP
  @state = state unless state == SKIP
  @template = template unless template == SKIP
  @version = version unless version == SKIP
  @versionid = versionid
end

Instance Attribute Details

#accountclientidString

Not used in this release, future functionality

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/user_smart_alert.rb', line 15

def accountclientid
  @accountclientid
end

#billingaccountidString

The billing account ID. This is the same value as the Account ID

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/user_smart_alert.rb', line 19

def billingaccountid
  @billingaccountid
end

#categoryString

The type of alert and will be either ‘telemetry` or `infrastructure`

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/user_smart_alert.rb', line 23

def category
  @category
end

#conditionInteger

The condition or threshold for an alert

Returns:

  • (Integer)


27
28
29
# File 'lib/verizon/models/user_smart_alert.rb', line 27

def condition
  @condition
end

#createdonDateTime

Timestamp of the record

Returns:

  • (DateTime)


31
32
33
# File 'lib/verizon/models/user_smart_alert.rb', line 31

def createdon
  @createdon
end

#descriptionString

a short description

Returns:

  • (String)


35
36
37
# File 'lib/verizon/models/user_smart_alert.rb', line 35

def description
  @description
end

#deviceidString

This is a UUID value of the device created when the device is onboarded

Returns:

  • (String)


39
40
41
# File 'lib/verizon/models/user_smart_alert.rb', line 39

def deviceid
  @deviceid
end

#foreignidString

UUID of the ECPD account the user belongs to

Returns:

  • (String)


43
44
45
# File 'lib/verizon/models/user_smart_alert.rb', line 43

def foreignid
  @foreignid
end

#idString

UUID of the user record, assigned at creation

Returns:

  • (String)


47
48
49
# File 'lib/verizon/models/user_smart_alert.rb', line 47

def id
  @id
end

#isacknowledgedTrueClass | FalseClass

A flag that indicates if the alarm has been acknowledged

Returns:

  • (TrueClass | FalseClass)


51
52
53
# File 'lib/verizon/models/user_smart_alert.rb', line 51

def isacknowledged
  @isacknowledged
end

#isclearedTrueClass | FalseClass

A flag that indicates if the alarm has been cleared

Returns:

  • (TrueClass | FalseClass)


55
56
57
# File 'lib/verizon/models/user_smart_alert.rb', line 55

def iscleared
  @iscleared
end

#isdisabledTrueClass | FalseClass

A flag that indicates if the alarm has been disabled

Returns:

  • (TrueClass | FalseClass)


59
60
61
# File 'lib/verizon/models/user_smart_alert.rb', line 59

def isdisabled
  @isdisabled
end

#lastupdatedDateTime

Timestamp of the record

Returns:

  • (DateTime)


63
64
65
# File 'lib/verizon/models/user_smart_alert.rb', line 63

def lastupdated
  @lastupdated
end

#nameString

User defined name of the record

Returns:

  • (String)


67
68
69
# File 'lib/verizon/models/user_smart_alert.rb', line 67

def name
  @name
end

#ruleidString

The UUID of a rule for alerts

Returns:

  • (String)


71
72
73
# File 'lib/verizon/models/user_smart_alert.rb', line 71

def ruleid
  @ruleid
end

#severityString

The threshold value to trigger an alert and will be Critical, Major or Minor

Returns:

  • (String)


76
77
78
# File 'lib/verizon/models/user_smart_alert.rb', line 76

def severity
  @severity
end

#stateString

The current status of the device or transaction and will be ‘success` or `failed`

Returns:

  • (String)


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

def state
  @state
end

#templateString

template of the rule which triggered a given alert

Returns:

  • (String)


85
86
87
# File 'lib/verizon/models/user_smart_alert.rb', line 85

def template
  @template
end

#versionString

The resource version

Returns:

  • (String)


89
90
91
# File 'lib/verizon/models/user_smart_alert.rb', line 89

def version
  @version
end

#versionidString

The UUID of the resource version

Returns:

  • (String)


93
94
95
# File 'lib/verizon/models/user_smart_alert.rb', line 93

def versionid
  @versionid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/verizon/models/user_smart_alert.rb', line 178

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  createdon = if hash.key?('createdon')
                (DateTimeHelper.from_rfc3339(hash['createdon']) if hash['createdon'])
              end
  lastupdated = if hash.key?('lastupdated')
                  (DateTimeHelper.from_rfc3339(hash['lastupdated']) if hash['lastupdated'])
                end
  versionid = hash.key?('versionid') ? hash['versionid'] : nil
  accountclientid =
    hash.key?('accountclientid') ? hash['accountclientid'] : SKIP
  billingaccountid =
    hash.key?('billingaccountid') ? hash['billingaccountid'] : SKIP
  category = hash.key?('category') ? hash['category'] : SKIP
  condition = hash.key?('condition') ? hash['condition'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  deviceid = hash.key?('deviceid') ? hash['deviceid'] : SKIP
  foreignid = hash.key?('foreignid') ? hash['foreignid'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  isacknowledged =
    hash.key?('isacknowledged') ? hash['isacknowledged'] : SKIP
  iscleared = hash.key?('iscleared') ? hash['iscleared'] : SKIP
  isdisabled = hash.key?('isdisabled') ? hash['isdisabled'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  ruleid = hash.key?('ruleid') ? hash['ruleid'] : SKIP
  severity = hash.key?('severity') ? hash['severity'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  template = hash.key?('template') ? hash['template'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  UserSmartAlert.new(createdon: createdon,
                     lastupdated: lastupdated,
                     versionid: versionid,
                     accountclientid: accountclientid,
                     billingaccountid: billingaccountid,
                     category: category,
                     condition: condition,
                     description: description,
                     deviceid: deviceid,
                     foreignid: foreignid,
                     id: id,
                     isacknowledged: isacknowledged,
                     iscleared: iscleared,
                     isdisabled: isdisabled,
                     name: name,
                     ruleid: ruleid,
                     severity: severity,
                     state: state,
                     template: template,
                     version: version)
end

.namesObject

A mapping from model property names to API property names.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/verizon/models/user_smart_alert.rb', line 96

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accountclientid'] = 'accountclientid'
  @_hash['billingaccountid'] = 'billingaccountid'
  @_hash['category'] = 'category'
  @_hash['condition'] = 'condition'
  @_hash['createdon'] = 'createdon'
  @_hash['description'] = 'description'
  @_hash['deviceid'] = 'deviceid'
  @_hash['foreignid'] = 'foreignid'
  @_hash['id'] = 'id'
  @_hash['isacknowledged'] = 'isacknowledged'
  @_hash['iscleared'] = 'iscleared'
  @_hash['isdisabled'] = 'isdisabled'
  @_hash['lastupdated'] = 'lastupdated'
  @_hash['name'] = 'name'
  @_hash['ruleid'] = 'ruleid'
  @_hash['severity'] = 'severity'
  @_hash['state'] = 'state'
  @_hash['template'] = 'template'
  @_hash['version'] = 'version'
  @_hash['versionid'] = 'versionid'
  @_hash
end

.nullablesObject

An array for nullable fields



145
146
147
# File 'lib/verizon/models/user_smart_alert.rb', line 145

def self.nullables
  []
end

.optionalsObject

An array for optional fields



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/verizon/models/user_smart_alert.rb', line 122

def self.optionals
  %w[
    accountclientid
    billingaccountid
    category
    condition
    description
    deviceid
    foreignid
    id
    isacknowledged
    iscleared
    isdisabled
    name
    ruleid
    severity
    state
    template
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/verizon/models/user_smart_alert.rb', line 254

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accountclientid: #{@accountclientid.inspect}, billingaccountid:"\
  " #{@billingaccountid.inspect}, category: #{@category.inspect}, condition:"\
  " #{@condition.inspect}, createdon: #{@createdon.inspect}, description:"\
  " #{@description.inspect}, deviceid: #{@deviceid.inspect}, foreignid: #{@foreignid.inspect},"\
  " id: #{@id.inspect}, isacknowledged: #{@isacknowledged.inspect}, iscleared:"\
  " #{@iscleared.inspect}, isdisabled: #{@isdisabled.inspect}, lastupdated:"\
  " #{@lastupdated.inspect}, name: #{@name.inspect}, ruleid: #{@ruleid.inspect}, severity:"\
  " #{@severity.inspect}, state: #{@state.inspect}, template: #{@template.inspect}, version:"\
  " #{@version.inspect}, versionid: #{@versionid.inspect}>"
end

#to_custom_createdonObject



233
234
235
# File 'lib/verizon/models/user_smart_alert.rb', line 233

def to_custom_createdon
  DateTimeHelper.to_rfc3339(createdon)
end

#to_custom_lastupdatedObject



237
238
239
# File 'lib/verizon/models/user_smart_alert.rb', line 237

def to_custom_lastupdated
  DateTimeHelper.to_rfc3339(lastupdated)
end

#to_sObject

Provides a human-readable string representation of the object.



242
243
244
245
246
247
248
249
250
251
# File 'lib/verizon/models/user_smart_alert.rb', line 242

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accountclientid: #{@accountclientid}, billingaccountid:"\
  " #{@billingaccountid}, category: #{@category}, condition: #{@condition}, createdon:"\
  " #{@createdon}, description: #{@description}, deviceid: #{@deviceid}, foreignid:"\
  " #{@foreignid}, id: #{@id}, isacknowledged: #{@isacknowledged}, iscleared: #{@iscleared},"\
  " isdisabled: #{@isdisabled}, lastupdated: #{@lastupdated}, name: #{@name}, ruleid:"\
  " #{@ruleid}, severity: #{@severity}, state: #{@state}, template: #{@template}, version:"\
  " #{@version}, versionid: #{@versionid}>"
end