Class: Vapi::ClientMessageTransferUpdate

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT, from_step_record: OMIT, additional_properties: nil) ⇒ Vapi::ClientMessageTransferUpdate

Parameters:

  • destination (Vapi::ClientMessageTransferUpdateDestination) (defaults to: OMIT)

    This is the destination of the transfer.

  • to_assistant (Vapi::CreateAssistantDto) (defaults to: OMIT)

    This is the assistant that the call is being transferred to. This is only sent if destination.type is "assistant".

  • from_assistant (Vapi::CreateAssistantDto) (defaults to: OMIT)

    This is the assistant that the call is being transferred from. This is only sent if destination.type is "assistant".

  • to_step_record (Hash{String => Object}) (defaults to: OMIT)

    This is the step that the conversation moved to.

  • from_step_record (Hash{String => Object}) (defaults to: OMIT)

    This is the step that the conversation moved from. =

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 39

def initialize(destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT,
               from_step_record: OMIT, additional_properties: nil)
  @destination = destination if destination != OMIT
  @to_assistant = to_assistant if to_assistant != OMIT
  @from_assistant = from_assistant if from_assistant != OMIT
  @to_step_record = to_step_record if to_step_record != OMIT
  @from_step_record = from_step_record if from_step_record != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "destination": destination,
    "toAssistant": to_assistant,
    "fromAssistant": from_assistant,
    "toStepRecord": to_step_record,
    "fromStepRecord": from_step_record
  }.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/client_message_transfer_update.rb', line 23

def additional_properties
  @additional_properties
end

#destinationVapi::ClientMessageTransferUpdateDestination (readonly)

Returns This is the destination of the transfer.

Returns:



11
12
13
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 11

def destination
  @destination
end

#from_assistantVapi::CreateAssistantDto (readonly)

Returns This is the assistant that the call is being transferred from. This is only sent if destination.type is "assistant".

Returns:

  • (Vapi::CreateAssistantDto)

    This is the assistant that the call is being transferred from. This is only sent if destination.type is "assistant".



17
18
19
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 17

def from_assistant
  @from_assistant
end

#from_step_recordHash{String => Object} (readonly)

Returns This is the step that the conversation moved from. =.

Returns:

  • (Hash{String => Object})

    This is the step that the conversation moved from. =



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

def from_step_record
  @from_step_record
end

#to_assistantVapi::CreateAssistantDto (readonly)

Returns This is the assistant that the call is being transferred to. This is only sent if destination.type is "assistant".

Returns:

  • (Vapi::CreateAssistantDto)

    This is the assistant that the call is being transferred to. This is only sent if destination.type is "assistant".



14
15
16
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 14

def to_assistant
  @to_assistant
end

#to_step_recordHash{String => Object} (readonly)

Returns This is the step that the conversation moved to.

Returns:

  • (Hash{String => Object})

    This is the step that the conversation moved to.



19
20
21
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 19

def to_step_record
  @to_step_record
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ClientMessageTransferUpdate

Deserialize a JSON object to an instance of ClientMessageTransferUpdate

Parameters:

  • json_object (String)

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 62

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["destination"].nil?
    destination = nil
  else
    destination = parsed_json["destination"].to_json
    destination = Vapi::ClientMessageTransferUpdateDestination.from_json(json_object: destination)
  end
  if parsed_json["toAssistant"].nil?
    to_assistant = nil
  else
    to_assistant = parsed_json["toAssistant"].to_json
    to_assistant = Vapi::CreateAssistantDto.from_json(json_object: to_assistant)
  end
  if parsed_json["fromAssistant"].nil?
    from_assistant = nil
  else
    from_assistant = parsed_json["fromAssistant"].to_json
    from_assistant = Vapi::CreateAssistantDto.from_json(json_object: from_assistant)
  end
  to_step_record = parsed_json["toStepRecord"]
  from_step_record = parsed_json["fromStepRecord"]
  new(
    destination: destination,
    to_assistant: to_assistant,
    from_assistant: from_assistant,
    to_step_record: to_step_record,
    from_step_record: from_step_record,
    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)


108
109
110
111
112
113
114
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 108

def self.validate_raw(obj:)
  obj.destination.nil? || Vapi::ClientMessageTransferUpdateDestination.validate_raw(obj: obj.destination)
  obj.to_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.to_assistant)
  obj.from_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.from_assistant)
  obj.to_step_record&.is_a?(Hash) != false || raise("Passed value for field obj.to_step_record is not the expected type, validation failed.")
  obj.from_step_record&.is_a?(Hash) != false || raise("Passed value for field obj.from_step_record is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ClientMessageTransferUpdate to a JSON object

Returns:

  • (String)


98
99
100
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 98

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