Class: MistApi::AuditLog

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/audit_log.rb

Overview

AuditLog 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(admin_id = nil, admin_name = nil, id = nil, message = nil, org_id = nil, site_id = nil, timestamp = nil, after = SKIP, before = SKIP, for_site = SKIP) ⇒ AuditLog

Returns a new instance of AuditLog.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/mist_api/models/audit_log.rb', line 82

def initialize(admin_id = nil, admin_name = nil, id = nil, message = nil,
               org_id = nil, site_id = nil, timestamp = nil, after = SKIP,
               before = SKIP, for_site = SKIP)
  @admin_id = admin_id
  @admin_name = admin_name
  @after = after unless after == SKIP
  @before = before unless before == SKIP
  @for_site = for_site unless for_site == SKIP
  @id = id
  @message = message
  @org_id = org_id
  @site_id = site_id
  @timestamp = timestamp
end

Instance Attribute Details

#admin_idUUID | String

ID of the administrator

Returns:

  • (UUID | String)


14
15
16
# File 'lib/mist_api/models/audit_log.rb', line 14

def admin_id
  @admin_id
end

#admin_nameString

ID of the administrator

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/audit_log.rb', line 18

def admin_name
  @admin_name
end

#afterObject

Field values after the change

Returns:

  • (Object)


22
23
24
# File 'lib/mist_api/models/audit_log.rb', line 22

def after
  @after
end

#beforeObject

Field values prior to the change

Returns:

  • (Object)


26
27
28
# File 'lib/mist_api/models/audit_log.rb', line 26

def before
  @before
end

#for_siteTrueClass | FalseClass

Field values prior to the change

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/mist_api/models/audit_log.rb', line 30

def for_site
  @for_site
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


34
35
36
# File 'lib/mist_api/models/audit_log.rb', line 34

def id
  @id
end

#messageString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/audit_log.rb', line 38

def message
  @message
end

#org_idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


42
43
44
# File 'lib/mist_api/models/audit_log.rb', line 42

def org_id
  @org_id
end

#site_idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


46
47
48
# File 'lib/mist_api/models/audit_log.rb', line 46

def site_id
  @site_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


50
51
52
# File 'lib/mist_api/models/audit_log.rb', line 50

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
124
# File 'lib/mist_api/models/audit_log.rb', line 98

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  admin_id = hash.key?('admin_id') ? hash['admin_id'] : nil
  admin_name = hash.key?('admin_name') ? hash['admin_name'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  message = hash.key?('message') ? hash['message'] : nil
  org_id = hash.key?('org_id') ? hash['org_id'] : nil
  site_id = hash.key?('site_id') ? hash['site_id'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  after = hash.key?('after') ? hash['after'] : SKIP
  before = hash.key?('before') ? hash['before'] : SKIP
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP

  # Create object from extracted values.
  AuditLog.new(admin_id,
               admin_name,
               id,
               message,
               org_id,
               site_id,
               timestamp,
               after,
               before,
               for_site)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/mist_api/models/audit_log.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['admin_id'] = 'admin_id'
  @_hash['admin_name'] = 'admin_name'
  @_hash['after'] = 'after'
  @_hash['before'] = 'before'
  @_hash['for_site'] = 'for_site'
  @_hash['id'] = 'id'
  @_hash['message'] = 'message'
  @_hash['org_id'] = 'org_id'
  @_hash['site_id'] = 'site_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



78
79
80
# File 'lib/mist_api/models/audit_log.rb', line 78

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
# File 'lib/mist_api/models/audit_log.rb', line 69

def self.optionals
  %w[
    after
    before
    for_site
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/mist_api/models/audit_log.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} admin_id: #{@admin_id.inspect}, admin_name: #{@admin_name.inspect}, after:"\
  " #{@after.inspect}, before: #{@before.inspect}, for_site: #{@for_site.inspect}, id:"\
  " #{@id.inspect}, message: #{@message.inspect}, org_id: #{@org_id.inspect}, site_id:"\
  " #{@site_id.inspect}, timestamp: #{@timestamp.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
132
# File 'lib/mist_api/models/audit_log.rb', line 127

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} admin_id: #{@admin_id}, admin_name: #{@admin_name}, after: #{@after},"\
  " before: #{@before}, for_site: #{@for_site}, id: #{@id}, message: #{@message}, org_id:"\
  " #{@org_id}, site_id: #{@site_id}, timestamp: #{@timestamp}>"
end