Class: Copilot::SessionEvent

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

Overview

Session event from the server. Uses an open struct-style approach so new event types are forward-compatible.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



459
460
461
# File 'lib/copilot/types.rb', line 459

def data
  @data
end

#ephemeralObject

Returns the value of attribute ephemeral

Returns:

  • (Object)

    the current value of ephemeral



459
460
461
# File 'lib/copilot/types.rb', line 459

def ephemeral
  @ephemeral
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



459
460
461
# File 'lib/copilot/types.rb', line 459

def id
  @id
end

#parent_idObject

Returns the value of attribute parent_id

Returns:

  • (Object)

    the current value of parent_id



459
460
461
# File 'lib/copilot/types.rb', line 459

def parent_id
  @parent_id
end

#timestampObject

Returns the value of attribute timestamp

Returns:

  • (Object)

    the current value of timestamp



459
460
461
# File 'lib/copilot/types.rb', line 459

def timestamp
  @timestamp
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



459
460
461
# File 'lib/copilot/types.rb', line 459

def type
  @type
end

Class Method Details

.from_hash(h) ⇒ Object



460
461
462
463
464
465
466
467
468
469
# File 'lib/copilot/types.rb', line 460

def self.from_hash(h)
  new(
    id: h["id"],
    timestamp: h["timestamp"],
    parent_id: h["parentId"],
    ephemeral: h["ephemeral"],
    type: h["type"],
    data: h["data"] || {}
  )
end