Class: Cadenya::Types::MemoryLayerSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, description: nil, system_managed: nil, expires_at: nil, agent_id: nil, episodic_key: nil) ⇒ MemoryLayerSpec

Returns a new instance of MemoryLayerSpec.



3253
3254
3255
3256
3257
3258
3259
3260
# File 'lib/cadenya/types.rb', line 3253

def initialize(type: nil, description: nil, system_managed: nil, expires_at: nil, agent_id: nil, episodic_key: nil)
  @type = type
  @description = description
  @system_managed = system_managed
  @expires_at = expires_at
  @agent_id = agent_id
  @episodic_key = episodic_key
end

Instance Attribute Details

#agent_idObject (readonly)

Returns the value of attribute agent_id.



3251
3252
3253
# File 'lib/cadenya/types.rb', line 3251

def agent_id
  @agent_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



3251
3252
3253
# File 'lib/cadenya/types.rb', line 3251

def description
  @description
end

#episodic_keyObject (readonly)

Returns the value of attribute episodic_key.



3251
3252
3253
# File 'lib/cadenya/types.rb', line 3251

def episodic_key
  @episodic_key
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



3251
3252
3253
# File 'lib/cadenya/types.rb', line 3251

def expires_at
  @expires_at
end

#system_managedObject (readonly)

Returns the value of attribute system_managed.



3251
3252
3253
# File 'lib/cadenya/types.rb', line 3251

def system_managed
  @system_managed
end

#typeObject (readonly)

Returns the value of attribute type.



3251
3252
3253
# File 'lib/cadenya/types.rb', line 3251

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
# File 'lib/cadenya/types.rb', line 3262

def self.from_json(data)
  new(
    type: data["type"],
    description: data["description"],
    system_managed: data["systemManaged"],
    expires_at: data["expiresAt"].nil? ? nil : Time.iso8601(data["expiresAt"]),
    agent_id: data["agentId"],
    episodic_key: data["episodicKey"],
  )
end

Instance Method Details

#to_hObject



3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
# File 'lib/cadenya/types.rb', line 3273

def to_h
  {
    type: Util.plain(@type),
    description: Util.plain(@description),
    system_managed: Util.plain(@system_managed),
    expires_at: Util.plain(@expires_at),
    agent_id: Util.plain(@agent_id),
    episodic_key: Util.plain(@episodic_key),
  }.reject { |_k, v| v.nil? }
end