Class: OpenAI::Realtime::UnknownServerEvent

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

Overview

A valid JSON event whose discriminator is newer than this SDK version.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:) ⇒ UnknownServerEvent

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of UnknownServerEvent.



16
17
18
19
20
21
22
23
24
25
# File 'lib/openai/helpers/realtime/unknown_server_event.rb', line 16

def initialize(data:)
  value = data.fetch(:type)
  unless value.is_a?(String) || value.is_a?(Symbol)
    raise ArgumentError, "Realtime server event type must be a string or symbol"
  end

  @type = value.to_sym
  @data = freeze_json(data)
  freeze
end

Instance Attribute Details

#data ⇒ Hash{Symbol=>Object} (readonly)

Returns:

  • (Hash{Symbol=>Object})


13
14
15
# File 'lib/openai/helpers/realtime/unknown_server_event.rb', line 13

def data
  @data
end

#type ⇒ Symbol (readonly)

Returns:

  • (Symbol)


10
11
12
# File 'lib/openai/helpers/realtime/unknown_server_event.rb', line 10

def type
  @type
end

Instance Method Details

#inspect ⇒ Object Also known as: to_s

Remote values, including the discriminator, require explicit access.



31
# File 'lib/openai/helpers/realtime/unknown_server_event.rb', line 31

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

#to_h ⇒ Hash{Symbol=>Object}

Returns:

  • (Hash{Symbol=>Object})


28
# File 'lib/openai/helpers/realtime/unknown_server_event.rb', line 28

def to_h = @data