Class: Verizon::ResourceEvent

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

Overview

ResourceEvent 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:, fieldid:, foreignid:, lastupdated:, state:, versionid:, accountclientid: SKIP, callbackurl: SKIP, description: SKIP, deviceid: SKIP, errmsg: SKIP, fields: SKIP, fieldvalue: SKIP, id: SKIP, modelid: SKIP, name: SKIP, sensordataaggregation: SKIP, transactionid: SKIP, version: SKIP) ⇒ ResourceEvent

Returns a new instance of ResourceEvent.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/verizon/models/resource_event.rb', line 139

def initialize(createdon:, fieldid:, foreignid:, lastupdated:, state:,
               versionid:, accountclientid: SKIP, callbackurl: SKIP,
               description: SKIP, deviceid: SKIP, errmsg: SKIP,
               fields: SKIP, fieldvalue: SKIP, id: SKIP, modelid: SKIP,
               name: SKIP, sensordataaggregation: SKIP, transactionid: SKIP,
               version: SKIP)
  @accountclientid = accountclientid unless accountclientid == SKIP
  @callbackurl = callbackurl unless callbackurl == SKIP
  @createdon = createdon
  @description = description unless description == SKIP
  @deviceid = deviceid unless deviceid == SKIP
  @errmsg = errmsg unless errmsg == SKIP
  @fieldid = fieldid
  @fields = fields unless fields == SKIP
  @fieldvalue = fieldvalue unless fieldvalue == SKIP
  @foreignid = foreignid
  @id = id unless id == SKIP
  @lastupdated = lastupdated
  @modelid = modelid unless modelid == SKIP
  @name = name unless name == SKIP
  @sensordataaggregation = sensordataaggregation unless sensordataaggregation == SKIP
  @state = state
  @transactionid = transactionid unless transactionid == 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/resource_event.rb', line 15

def accountclientid
  @accountclientid
end

#callbackurlString

The URL of the callback listener

Returns:

  • (String)


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

def callbackurl
  @callbackurl
end

#createdonDateTime

Timestamp of the record

Returns:

  • (DateTime)


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

def createdon
  @createdon
end

#descriptionString

a short description

Returns:

  • (String)


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

def description
  @description
end

#deviceidString

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

Returns:

  • (String)


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

def deviceid
  @deviceid
end

#errmsgString

Error message

Returns:

  • (String)


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

def errmsg
  @errmsg
end

#fieldidString

Error message

Returns:

  • (String)


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

def fieldid
  @fieldid
end

#fieldsDtoFields

Fields to return needed by search

Returns:



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

def fields
  @fields
end

#fieldvalueArray[Integer]

Fields to return needed by search

Returns:

  • (Array[Integer])


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

def fieldvalue
  @fieldvalue
end

#foreignidString

UUID of the ECPD account the user belongs to

Returns:

  • (String)


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

def foreignid
  @foreignid
end

#idString

UUID of the user record, assigned at creation

Returns:

  • (String)


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

def id
  @id
end

#lastupdatedDateTime

Timestamp of the record

Returns:

  • (DateTime)


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

def lastupdated
  @lastupdated
end

#modelidString

The model ID of the device

Returns:

  • (String)


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

def modelid
  @modelid
end

#nameString

User defined name of the record

Returns:

  • (String)


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

def name
  @name
end

#sensordataaggregationTrueClass | FalseClass

A flag to indicate if sensor data is to be aggregated (true) or not

Returns:

  • (TrueClass | FalseClass)


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

def sensordataaggregation
  @sensordataaggregation
end

#stateString

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

Returns:

  • (String)


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

def state
  @state
end

#transactionidString

The system-generated UUID of the transaction

Returns:

  • (String)


80
81
82
# File 'lib/verizon/models/resource_event.rb', line 80

def transactionid
  @transactionid
end

#versionString

The resource version

Returns:

  • (String)


84
85
86
# File 'lib/verizon/models/resource_event.rb', line 84

def version
  @version
end

#versionidString

The UUID of the resource version

Returns:

  • (String)


88
89
90
# File 'lib/verizon/models/resource_event.rb', line 88

def versionid
  @versionid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



167
168
169
170
171
172
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
# File 'lib/verizon/models/resource_event.rb', line 167

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
  fieldid = hash.key?('fieldid') ? hash['fieldid'] : nil
  foreignid = hash.key?('foreignid') ? hash['foreignid'] : nil
  lastupdated = if hash.key?('lastupdated')
                  (DateTimeHelper.from_rfc3339(hash['lastupdated']) if hash['lastupdated'])
                end
  state = hash.key?('state') ? hash['state'] : nil
  versionid = hash.key?('versionid') ? hash['versionid'] : nil
  accountclientid =
    hash.key?('accountclientid') ? hash['accountclientid'] : SKIP
  callbackurl = hash.key?('callbackurl') ? hash['callbackurl'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  deviceid = hash.key?('deviceid') ? hash['deviceid'] : SKIP
  errmsg = hash.key?('errmsg') ? hash['errmsg'] : SKIP
  fields = DtoFields.from_hash(hash['fields']) if hash['fields']
  fieldvalue = hash.key?('fieldvalue') ? hash['fieldvalue'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  modelid = hash.key?('modelid') ? hash['modelid'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  sensordataaggregation =
    hash.key?('sensordataaggregation') ? hash['sensordataaggregation'] : SKIP
  transactionid = hash.key?('transactionid') ? hash['transactionid'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  ResourceEvent.new(createdon: createdon,
                    fieldid: fieldid,
                    foreignid: foreignid,
                    lastupdated: lastupdated,
                    state: state,
                    versionid: versionid,
                    accountclientid: accountclientid,
                    callbackurl: callbackurl,
                    description: description,
                    deviceid: deviceid,
                    errmsg: errmsg,
                    fields: fields,
                    fieldvalue: fieldvalue,
                    id: id,
                    modelid: modelid,
                    name: name,
                    sensordataaggregation: sensordataaggregation,
                    transactionid: transactionid,
                    version: version)
end

.namesObject

A mapping from model property names to API property names.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/verizon/models/resource_event.rb', line 91

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accountclientid'] = 'accountclientid'
  @_hash['callbackurl'] = 'callbackurl'
  @_hash['createdon'] = 'createdon'
  @_hash['description'] = 'description'
  @_hash['deviceid'] = 'deviceid'
  @_hash['errmsg'] = 'errmsg'
  @_hash['fieldid'] = 'fieldid'
  @_hash['fields'] = 'fields'
  @_hash['fieldvalue'] = 'fieldvalue'
  @_hash['foreignid'] = 'foreignid'
  @_hash['id'] = 'id'
  @_hash['lastupdated'] = 'lastupdated'
  @_hash['modelid'] = 'modelid'
  @_hash['name'] = 'name'
  @_hash['sensordataaggregation'] = 'sensordataaggregation'
  @_hash['state'] = 'state'
  @_hash['transactionid'] = 'transactionid'
  @_hash['version'] = 'version'
  @_hash['versionid'] = 'versionid'
  @_hash
end

.nullablesObject

An array for nullable fields



135
136
137
# File 'lib/verizon/models/resource_event.rb', line 135

def self.nullables
  []
end

.optionalsObject

An array for optional fields



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/verizon/models/resource_event.rb', line 116

def self.optionals
  %w[
    accountclientid
    callbackurl
    description
    deviceid
    errmsg
    fields
    fieldvalue
    id
    modelid
    name
    sensordataaggregation
    transactionid
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/verizon/models/resource_event.rb', line 239

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accountclientid: #{@accountclientid.inspect}, callbackurl:"\
  " #{@callbackurl.inspect}, createdon: #{@createdon.inspect}, description:"\
  " #{@description.inspect}, deviceid: #{@deviceid.inspect}, errmsg: #{@errmsg.inspect},"\
  " fieldid: #{@fieldid.inspect}, fields: #{@fields.inspect}, fieldvalue:"\
  " #{@fieldvalue.inspect}, foreignid: #{@foreignid.inspect}, id: #{@id.inspect}, lastupdated:"\
  " #{@lastupdated.inspect}, modelid: #{@modelid.inspect}, name: #{@name.inspect},"\
  " sensordataaggregation: #{@sensordataaggregation.inspect}, state: #{@state.inspect},"\
  " transactionid: #{@transactionid.inspect}, version: #{@version.inspect}, versionid:"\
  " #{@versionid.inspect}>"
end

#to_custom_createdonObject



219
220
221
# File 'lib/verizon/models/resource_event.rb', line 219

def to_custom_createdon
  DateTimeHelper.to_rfc3339(createdon)
end

#to_custom_lastupdatedObject



223
224
225
# File 'lib/verizon/models/resource_event.rb', line 223

def to_custom_lastupdated
  DateTimeHelper.to_rfc3339(lastupdated)
end

#to_sObject

Provides a human-readable string representation of the object.



228
229
230
231
232
233
234
235
236
# File 'lib/verizon/models/resource_event.rb', line 228

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accountclientid: #{@accountclientid}, callbackurl: #{@callbackurl},"\
  " createdon: #{@createdon}, description: #{@description}, deviceid: #{@deviceid}, errmsg:"\
  " #{@errmsg}, fieldid: #{@fieldid}, fields: #{@fields}, fieldvalue: #{@fieldvalue},"\
  " foreignid: #{@foreignid}, id: #{@id}, lastupdated: #{@lastupdated}, modelid: #{@modelid},"\
  " name: #{@name}, sensordataaggregation: #{@sensordataaggregation}, state: #{@state},"\
  " transactionid: #{@transactionid}, version: #{@version}, versionid: #{@versionid}>"
end