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(phone_number: OMIT, destination: OMIT, timestamp: OMIT, call: OMIT, customer: OMIT, assistant: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT, from_step_record: OMIT, additional_properties: nil) ⇒ Vapi::ClientMessageTransferUpdate

Parameters:

  • phone_number (Vapi::ClientMessageTransferUpdatePhoneNumber) (defaults to: OMIT)

    This is the phone number that the message is associated with.

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

    This is the destination of the transfer.

  • timestamp (Float) (defaults to: OMIT)

    This is the timestamp of the message.

  • call (Vapi::Call) (defaults to: OMIT)

    This is the call that the message is associated with.

  • customer (Vapi::CreateCustomerDto) (defaults to: OMIT)

    This is the customer that the message is associated with.

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

    This is the assistant that the message is associated with.

  • 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



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 57

def initialize(phone_number: OMIT, destination: OMIT, timestamp: OMIT, call: OMIT, customer: OMIT, assistant: OMIT,
               to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT, from_step_record: OMIT, additional_properties: nil)
  @phone_number = phone_number if phone_number != OMIT
  @destination = destination if destination != OMIT
  @timestamp = timestamp if timestamp != OMIT
  @call = call if call != OMIT
  @customer = customer if customer != OMIT
  @assistant = assistant if assistant != 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 = {
    "phoneNumber": phone_number,
    "destination": destination,
    "timestamp": timestamp,
    "call": call,
    "customer": customer,
    "assistant": assistant,
    "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



36
37
38
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 36

def additional_properties
  @additional_properties
end

#assistantVapi::CreateAssistantDto (readonly)

Returns This is the assistant that the message is associated with.

Returns:



24
25
26
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 24

def assistant
  @assistant
end

#callVapi::Call (readonly)

Returns This is the call that the message is associated with.

Returns:

  • (Vapi::Call)

    This is the call that the message is associated with.



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

def call
  @call
end

#customerVapi::CreateCustomerDto (readonly)

Returns This is the customer that the message is associated with.

Returns:



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

def customer
  @customer
end

#destinationVapi::ClientMessageTransferUpdateDestination (readonly)

Returns This is the destination of the transfer.

Returns:



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

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”.



30
31
32
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 30

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. =



34
35
36
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 34

def from_step_record
  @from_step_record
end

#phone_numberVapi::ClientMessageTransferUpdatePhoneNumber (readonly)

Returns This is the phone number that the message is associated with.

Returns:



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

def phone_number
  @phone_number
end

#timestampFloat (readonly)

Returns This is the timestamp of the message.

Returns:

  • (Float)

    This is the timestamp of the message.



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

def timestamp
  @timestamp
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”.



27
28
29
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 27

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.



32
33
34
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 32

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:



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 90

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["phoneNumber"].nil?
    phone_number = nil
  else
    phone_number = parsed_json["phoneNumber"].to_json
    phone_number = Vapi::ClientMessageTransferUpdatePhoneNumber.from_json(json_object: phone_number)
  end
  if parsed_json["destination"].nil?
    destination = nil
  else
    destination = parsed_json["destination"].to_json
    destination = Vapi::ClientMessageTransferUpdateDestination.from_json(json_object: destination)
  end
  timestamp = parsed_json["timestamp"]
  if parsed_json["call"].nil?
    call = nil
  else
    call = parsed_json["call"].to_json
    call = Vapi::Call.from_json(json_object: call)
  end
  if parsed_json["customer"].nil?
    customer = nil
  else
    customer = parsed_json["customer"].to_json
    customer = Vapi::CreateCustomerDto.from_json(json_object: customer)
  end
  if parsed_json["assistant"].nil?
    assistant = nil
  else
    assistant = parsed_json["assistant"].to_json
    assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant)
  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(
    phone_number: phone_number,
    destination: destination,
    timestamp: timestamp,
    call: call,
    customer: customer,
    assistant: assistant,
    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)


166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 166

def self.validate_raw(obj:)
  obj.phone_number.nil? || Vapi::ClientMessageTransferUpdatePhoneNumber.validate_raw(obj: obj.phone_number)
  obj.destination.nil? || Vapi::ClientMessageTransferUpdateDestination.validate_raw(obj: obj.destination)
  obj.timestamp&.is_a?(Float) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
  obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call)
  obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer)
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
  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)


156
157
158
# File 'lib/vapi_server_sdk/types/client_message_transfer_update.rb', line 156

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