Class: OpenAI::Live::UnknownServerEvent

Inherits:
Object
  • Object
show all
Includes:
WebSocket::Protocol
Defined in:
lib/openai/helpers/live/websocket.rb

Overview

A future server event retains its raw data, but routine diagnostics do not render potentially sensitive audio, transcript, or session fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:) ⇒ UnknownServerEvent

Returns a new instance of UnknownServerEvent.



33
34
35
36
37
# File 'lib/openai/helpers/live/websocket.rb', line 33

def initialize(data:)
  @type = data.fetch(:type) { data.fetch("type") }.to_sym
  @data = freeze_json(data)
  freeze
end

Instance Attribute Details

#data ⇒ Object (readonly)

Returns the value of attribute data.



31
32
33
# File 'lib/openai/helpers/live/websocket.rb', line 31

def data
  @data
end

#type ⇒ Object (readonly)

Returns the value of attribute type.



31
32
33
# File 'lib/openai/helpers/live/websocket.rb', line 31

def type
  @type
end

Instance Method Details

#inspect ⇒ Object Also known as: to_s



40
# File 'lib/openai/helpers/live/websocket.rb', line 40

def inspect = "#<#{self.class} type=#{@type.inspect}>"

#to_h ⇒ Object



39
# File 'lib/openai/helpers/live/websocket.rb', line 39

def to_h = @data