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:

  • step_name (String)

    This is the step to transfer to.

  • message (String) (defaults to: OMIT)

    This is the message to say before transferring the call to the destination. 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.

  • 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



43
44
45
46
47
48
49
50
51
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 43

def initialize(step_name:, message: OMIT, description: OMIT, additional_properties: nil)
  @step_name = step_name
  @message = message if message != OMIT
  @description = description if description != OMIT
  @additional_properties = additional_properties
  @_field_set = { "stepName": step_name, "message": message, "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



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

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.



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

def description
  @description
end

#messageString (readonly)

Returns This is the message to say before transferring the call to the destination. 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.

Returns:

  • (String)

    This is the message to say before transferring the call to the destination. 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.



18
19
20
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 18

def message
  @message
end

#step_nameString (readonly)

Returns This is the step to transfer to.

Returns:

  • (String)

    This is the step to transfer to.



9
10
11
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 9

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:



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 57

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


84
85
86
87
88
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 84

def self.validate_raw(obj:)
  obj.step_name.is_a?(String) != false || raise("Passed value for field obj.step_name is not the expected type, validation failed.")
  obj.message&.is_a?(String) != false || raise("Passed value for field obj.message 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)


74
75
76
# File 'lib/vapi_server_sdk/types/transfer_destination_step.rb', line 74

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