Class: Vapi::TransferDestinationStep

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_name:, message: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationStep

Parameters:

  • message (Vapi::TransferDestinationStepMessage) (defaults to: OMIT)

    This is spoken to the customer before connecting them to the destination. Usage:

    • If this is not provided and transfer tool messages is not provided, default is

    “Transferring the call now”.

    • If set to “”, nothing is spoken. This is useful when you want to silently

    transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set ‘assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the contents field.

  • step_name (String)

    This is the step to transfer to.

  • description (String) (defaults to: OMIT)

    This is the description of the destination, used by the AI to choose when and how to transfer the call.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



52
53
54
55
56
57
58
59
60
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 52

def initialize(step_name:, message: OMIT, description: OMIT, additional_properties: nil)
  @message = message if message != OMIT
  @step_name = step_name
  @description = description if description != OMIT
  @additional_properties = additional_properties
  @_field_set = { "message": message, "stepName": step_name, "description": description }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



28
29
30
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 28

def additional_properties
  @additional_properties
end

#descriptionString (readonly)

Returns This is the description of the destination, used by the AI to choose when and how to transfer the call.

Returns:

  • (String)

    This is the description of the destination, used by the AI to choose when and how to transfer the call.



26
27
28
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 26

def description
  @description
end

#messageVapi::TransferDestinationStepMessage (readonly)

Returns This is spoken to the customer before connecting them to the destination. Usage:

  • If this is not provided and transfer tool messages is not provided, default is

“Transferring the call now”.

  • If set to “”, nothing is spoken. This is useful when you want to silently

transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set ‘assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the contents field.

Returns:

  • (Vapi::TransferDestinationStepMessage)

    This is spoken to the customer before connecting them to the destination. Usage:

    • If this is not provided and transfer tool messages is not provided, default is

    “Transferring the call now”.

    • If set to “”, nothing is spoken. This is useful when you want to silently

    transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set ‘assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the contents field.



21
22
23
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 21

def message
  @message
end

#step_nameString (readonly)

Returns This is the step to transfer to.

Returns:

  • (String)

    This is the step to transfer to.



23
24
25
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 23

def step_name
  @step_name
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TransferDestinationStep

Deserialize a JSON object to an instance of TransferDestinationStep

Parameters:

  • json_object (String)

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 66

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["message"].nil?
    message = nil
  else
    message = parsed_json["message"].to_json
    message = Vapi::TransferDestinationStepMessage.from_json(json_object: message)
  end
  step_name = parsed_json["stepName"]
  description = parsed_json["description"]
  new(
    message: message,
    step_name: step_name,
    description: description,
    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)


98
99
100
101
102
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 98

def self.validate_raw(obj:)
  obj.message.nil? || Vapi::TransferDestinationStepMessage.validate_raw(obj: obj.message)
  obj.step_name.is_a?(String) != false || raise("Passed value for field obj.step_name is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TransferDestinationStep to a JSON object

Returns:

  • (String)


88
89
90
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 88

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