Class: Vapi::Transport

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider: OMIT, assistant_video_enabled: OMIT, additional_properties: nil) ⇒ Vapi::Transport

Parameters:

  • provider (Vapi::TransportProvider) (defaults to: OMIT) —

    This is the provider used for the call.

  • assistant_video_enabled (Boolean) (defaults to: OMIT) —

    This is determines whether the assistant will have video enabled. Only relevant for webCall type.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



27
28
29
30
31
32
33
34
# File 'lib/vapi_server_sdk/types/transport.rb', line 27

def initialize(provider: OMIT, assistant_video_enabled: OMIT, additional_properties: nil)
  @provider = provider if provider != OMIT
  @assistant_video_enabled = assistant_video_enabled if assistant_video_enabled != OMIT
  @additional_properties = additional_properties
  @_field_set = { "provider": provider, "assistantVideoEnabled": assistant_video_enabled }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



15
16
17
# File 'lib/vapi_server_sdk/types/transport.rb', line 15

def additional_properties
  @additional_properties
end

#assistant_video_enabled ⇒ Boolean (readonly)

Returns This is determines whether the assistant will have video enabled. Only relevant for webCall type.

Returns:

  • (Boolean) —

    This is determines whether the assistant will have video enabled. Only relevant for webCall type.



13
14
15
# File 'lib/vapi_server_sdk/types/transport.rb', line 13

def assistant_video_enabled
  @assistant_video_enabled
end

#provider ⇒ Vapi::TransportProvider (readonly)

Returns This is the provider used for the call.

Returns:



10
11
12
# File 'lib/vapi_server_sdk/types/transport.rb', line 10

def provider
  @provider
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Transport

Deserialize a JSON object to an instance of Transport

Parameters:

  • json_object (String)

Returns:



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/vapi_server_sdk/types/transport.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  assistant_video_enabled = parsed_json["assistantVideoEnabled"]
  new(
    provider: provider,
    assistant_video_enabled: assistant_video_enabled,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


65
66
67
68
# File 'lib/vapi_server_sdk/types/transport.rb', line 65

def self.validate_raw(obj:)
  obj.provider&.is_a?(Vapi::TransportProvider) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
  obj.assistant_video_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.assistant_video_enabled is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Transport to a JSON object

Returns:

  • (String)


55
56
57
# File 'lib/vapi_server_sdk/types/transport.rb', line 55

def to_json(*_args)
  @_field_set&.to_json
end