Class: GetAuditLogsResponseTrailsItem

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
# File 'lib/schemas.rb', line 7071

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    action:     d["action"],
    data:       d["data"] ? GetAuditLogsResponseTrailsItemData.from_dynamic!(d["data"]) : nil,
    id:         d["id"],
    ip:         d["ip"],
    message:    d["message"],
    timestamp:  d["timestamp"],
    user_agent: d["userAgent"],
  )
end

.from_json!(json) ⇒ Object



7084
7085
7086
# File 'lib/schemas.rb', line 7084

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
# File 'lib/schemas.rb', line 7088

def to_dynamic
  {
    "action"    => action,
    "data"      => data&.to_dynamic,
    "id"        => id,
    "ip"        => ip,
    "message"   => message,
    "timestamp" => timestamp,
    "userAgent" => user_agent,
  }
end

#to_json(options = nil) ⇒ Object



7100
7101
7102
# File 'lib/schemas.rb', line 7100

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end