Class: WorkOS::AuditLogSchemaJson

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/audit_logs/audit_log_schema_json.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  version: :version,
  actor: :actor,
  targets: :targets,
  metadata: :metadata,
  created_at: :created_at
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

normalize

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ AuditLogSchemaJson

Returns a new instance of AuditLogSchemaJson.



24
25
26
27
28
29
30
31
32
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 24

def initialize(json)
  hash = self.class.normalize(json)
  @object = hash[:object]
  @version = hash[:version]
  @actor = hash[:actor] ? WorkOS::AuditLogSchemaJsonActor.new(hash[:actor]) : nil
  @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogSchemaJsonTarget.new(item) : nil }
  @metadata = hash[:metadata] || {}
  @created_at = hash[:created_at]
end

Instance Attribute Details

#actorObject

Returns the value of attribute actor.



16
17
18
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 16

def actor
  @actor
end

#created_atObject

Returns the value of attribute created_at.



16
17
18
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 16

def created_at
  @created_at
end

#metadataObject

Returns the value of attribute metadata.



16
17
18
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 16

def 
  @metadata
end

#objectObject

Returns the value of attribute object.



16
17
18
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 16

def object
  @object
end

#targetsObject

Returns the value of attribute targets.



16
17
18
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 16

def targets
  @targets
end

#versionObject

Returns the value of attribute version.



16
17
18
# File 'lib/workos/audit_logs/audit_log_schema_json.rb', line 16

def version
  @version
end