Class: Vapi::Call

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, org_id:, created_at:, updated_at:, type: OMIT, costs: OMIT, messages: OMIT, phone_call_provider: OMIT, phone_call_transport: OMIT, status: OMIT, ended_reason: OMIT, destination: OMIT, started_at: OMIT, ended_at: OMIT, cost: OMIT, cost_breakdown: OMIT, artifact_plan: OMIT, analysis: OMIT, monitor: OMIT, artifact: OMIT, phone_call_provider_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, additional_properties: nil) ⇒ Vapi::Call

Parameters:

  • type (Vapi::CallType) (defaults to: OMIT)

    This is the type of call.

  • costs (Array<Vapi::CallCostsItem>) (defaults to: OMIT)

    These are the costs of individual components of the call in USD.

  • messages (Array<Vapi::CallMessagesItem>) (defaults to: OMIT)
  • phone_call_provider (Vapi::CallPhoneCallProvider) (defaults to: OMIT)

    This is the provider of the call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.

  • phone_call_transport (Vapi::CallPhoneCallTransport) (defaults to: OMIT)

    This is the transport of the phone call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.

  • status (Vapi::CallStatus) (defaults to: OMIT)

    This is the status of the call.

  • ended_reason (Vapi::CallEndedReason) (defaults to: OMIT)

    This is the explanation for how the call ended.

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

    This is the destination where the call ended up being transferred to. If the call was not transferred, this will be empty.

  • id (String)

    This is the unique identifier for the call.

  • org_id (String)

    This is the unique identifier for the org that this call belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the call was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the call was last updated.

  • started_at (DateTime) (defaults to: OMIT)

    This is the ISO 8601 date-time string of when the call was started.

  • ended_at (DateTime) (defaults to: OMIT)

    This is the ISO 8601 date-time string of when the call was ended.

  • cost (Float) (defaults to: OMIT)

    This is the cost of the call in USD.

  • cost_breakdown (Vapi::CostBreakdown) (defaults to: OMIT)

    This is the cost of the call in USD.

  • artifact_plan (Vapi::ArtifactPlan) (defaults to: OMIT)

    This is a copy of assistant artifact plan. This isn’t actually stored on the call but rather just returned in POST /call/web to enable artifact creation client side.

  • analysis (Vapi::Analysis) (defaults to: OMIT)

    This is the analysis of the call. Configure in ‘assistant.analysisPlan`.

  • monitor (Vapi::Monitor) (defaults to: OMIT)

    This is to real-time monitor the call. Configure in ‘assistant.monitorPlan`.

  • artifact (Vapi::Artifact) (defaults to: OMIT)

    These are the artifacts created from the call. Configure in ‘assistant.artifactPlan`.

  • phone_call_provider_id (String) (defaults to: OMIT)

    The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.

  • assistant_id (String) (defaults to: OMIT)

    This is the assistant that will be used for the call. To use a transient assistant, use ‘assistant` instead.

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

    This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead.

  • assistant_overrides (Vapi::AssistantOverrides) (defaults to: OMIT)

    These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.

  • squad_id (String) (defaults to: OMIT)

    This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead.

  • squad (Vapi::CreateSquadDto) (defaults to: OMIT)

    This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead.

  • phone_number_id (String) (defaults to: OMIT)

    This is the phone number that will be used for the call. To use a transient number, use ‘phoneNumber` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

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

    This is the phone number that will be used for the call. To use an existing number, use ‘phoneNumberId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

  • customer_id (String) (defaults to: OMIT)

    This is the customer that will be called. To call a transient customer , use ‘customer` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

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

    This is the customer that will be called. To call an existing customer, use ‘customerId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

  • name (String) (defaults to: OMIT)

    This is the name of the call. This is just for your own reference.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/vapi_server_sdk/types/call.rb', line 172

def initialize(id:, org_id:, created_at:, updated_at:, type: OMIT, costs: OMIT, messages: OMIT, phone_call_provider: OMIT, phone_call_transport: OMIT,
               status: OMIT, ended_reason: OMIT, destination: OMIT, started_at: OMIT, ended_at: OMIT, cost: OMIT, cost_breakdown: OMIT, artifact_plan: OMIT, analysis: OMIT, monitor: OMIT, artifact: OMIT, phone_call_provider_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, additional_properties: nil)
  @type = type if type != OMIT
  @costs = costs if costs != OMIT
  @messages = messages if messages != OMIT
  @phone_call_provider = phone_call_provider if phone_call_provider != OMIT
  @phone_call_transport = phone_call_transport if phone_call_transport != OMIT
  @status = status if status != OMIT
  @ended_reason = ended_reason if ended_reason != OMIT
  @destination = destination if destination != OMIT
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @started_at = started_at if started_at != OMIT
  @ended_at = ended_at if ended_at != OMIT
  @cost = cost if cost != OMIT
  @cost_breakdown = cost_breakdown if cost_breakdown != OMIT
  @artifact_plan = artifact_plan if artifact_plan != OMIT
  @analysis = analysis if analysis != OMIT
  @monitor = monitor if monitor != OMIT
  @artifact = artifact if artifact != OMIT
  @phone_call_provider_id = phone_call_provider_id if phone_call_provider_id != OMIT
  @assistant_id = assistant_id if assistant_id != OMIT
  @assistant = assistant if assistant != OMIT
  @assistant_overrides = assistant_overrides if assistant_overrides != OMIT
  @squad_id = squad_id if squad_id != OMIT
  @squad = squad if squad != OMIT
  @phone_number_id = phone_number_id if phone_number_id != OMIT
  @phone_number = phone_number if phone_number != OMIT
  @customer_id = customer_id if customer_id != OMIT
  @customer = customer if customer != OMIT
  @name = name if name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "type": type,
    "costs": costs,
    "messages": messages,
    "phoneCallProvider": phone_call_provider,
    "phoneCallTransport": phone_call_transport,
    "status": status,
    "endedReason": ended_reason,
    "destination": destination,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "startedAt": started_at,
    "endedAt": ended_at,
    "cost": cost,
    "costBreakdown": cost_breakdown,
    "artifactPlan": artifact_plan,
    "analysis": analysis,
    "monitor": monitor,
    "artifact": artifact,
    "phoneCallProviderId": phone_call_provider_id,
    "assistantId": assistant_id,
    "assistant": assistant,
    "assistantOverrides": assistant_overrides,
    "squadId": squad_id,
    "squad": squad,
    "phoneNumberId": phone_number_id,
    "phoneNumber": phone_number,
    "customerId": customer_id,
    "customer": customer,
    "name": name
  }.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



111
112
113
# File 'lib/vapi_server_sdk/types/call.rb', line 111

def additional_properties
  @additional_properties
end

#analysisVapi::Analysis (readonly)

Returns This is the analysis of the call. Configure in ‘assistant.analysisPlan`.

Returns:

  • (Vapi::Analysis)

    This is the analysis of the call. Configure in ‘assistant.analysisPlan`.



67
68
69
# File 'lib/vapi_server_sdk/types/call.rb', line 67

def analysis
  @analysis
end

#artifactVapi::Artifact (readonly)

Returns These are the artifacts created from the call. Configure in ‘assistant.artifactPlan`.

Returns:

  • (Vapi::Artifact)

    These are the artifacts created from the call. Configure in ‘assistant.artifactPlan`.



72
73
74
# File 'lib/vapi_server_sdk/types/call.rb', line 72

def artifact
  @artifact
end

#artifact_planVapi::ArtifactPlan (readonly)

Returns This is a copy of assistant artifact plan. This isn’t actually stored on the call but rather just returned in POST /call/web to enable artifact creation client side.

Returns:

  • (Vapi::ArtifactPlan)

    This is a copy of assistant artifact plan. This isn’t actually stored on the call but rather just returned in POST /call/web to enable artifact creation client side.



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

def artifact_plan
  @artifact_plan
end

#assistantVapi::CreateAssistantDto (readonly)

Returns This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead.

Returns:

  • (Vapi::CreateAssistantDto)

    This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead.



82
83
84
# File 'lib/vapi_server_sdk/types/call.rb', line 82

def assistant
  @assistant
end

#assistant_idString (readonly)

Returns This is the assistant that will be used for the call. To use a transient assistant, use ‘assistant` instead.

Returns:

  • (String)

    This is the assistant that will be used for the call. To use a transient assistant, use ‘assistant` instead.



79
80
81
# File 'lib/vapi_server_sdk/types/call.rb', line 79

def assistant_id
  @assistant_id
end

#assistant_overridesVapi::AssistantOverrides (readonly)

Returns These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.

Returns:

  • (Vapi::AssistantOverrides)

    These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.



85
86
87
# File 'lib/vapi_server_sdk/types/call.rb', line 85

def assistant_overrides
  @assistant_overrides
end

#costFloat (readonly)

Returns This is the cost of the call in USD.

Returns:

  • (Float)

    This is the cost of the call in USD.



59
60
61
# File 'lib/vapi_server_sdk/types/call.rb', line 59

def cost
  @cost
end

#cost_breakdownVapi::CostBreakdown (readonly)

Returns This is the cost of the call in USD.

Returns:



61
62
63
# File 'lib/vapi_server_sdk/types/call.rb', line 61

def cost_breakdown
  @cost_breakdown
end

#costsArray<Vapi::CallCostsItem> (readonly)

Returns These are the costs of individual components of the call in USD.

Returns:

  • (Array<Vapi::CallCostsItem>)

    These are the costs of individual components of the call in USD.



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

def costs
  @costs
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the call was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the call was created.



51
52
53
# File 'lib/vapi_server_sdk/types/call.rb', line 51

def created_at
  @created_at
end

#customerVapi::CreateCustomerDto (readonly)

Returns This is the customer that will be called. To call an existing customer, use ‘customerId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (Vapi::CreateCustomerDto)

    This is the customer that will be called. To call an existing customer, use ‘customerId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



107
108
109
# File 'lib/vapi_server_sdk/types/call.rb', line 107

def customer
  @customer
end

#customer_idString (readonly)

Returns This is the customer that will be called. To call a transient customer , use ‘customer` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (String)

    This is the customer that will be called. To call a transient customer , use ‘customer` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



103
104
105
# File 'lib/vapi_server_sdk/types/call.rb', line 103

def customer_id
  @customer_id
end

#destinationVapi::CallDestination (readonly)

Returns This is the destination where the call ended up being transferred to. If the call was not transferred, this will be empty.

Returns:

  • (Vapi::CallDestination)

    This is the destination where the call ended up being transferred to. If the call was not transferred, this will be empty.



45
46
47
# File 'lib/vapi_server_sdk/types/call.rb', line 45

def destination
  @destination
end

#ended_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the call was ended.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the call was ended.



57
58
59
# File 'lib/vapi_server_sdk/types/call.rb', line 57

def ended_at
  @ended_at
end

#ended_reasonVapi::CallEndedReason (readonly)

Returns This is the explanation for how the call ended.

Returns:



42
43
44
# File 'lib/vapi_server_sdk/types/call.rb', line 42

def ended_reason
  @ended_reason
end

#idString (readonly)

Returns This is the unique identifier for the call.

Returns:

  • (String)

    This is the unique identifier for the call.



47
48
49
# File 'lib/vapi_server_sdk/types/call.rb', line 47

def id
  @id
end

#messagesArray<Vapi::CallMessagesItem> (readonly)

Returns:



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

def messages
  @messages
end

#monitorVapi::Monitor (readonly)

Returns This is to real-time monitor the call. Configure in ‘assistant.monitorPlan`.

Returns:

  • (Vapi::Monitor)

    This is to real-time monitor the call. Configure in ‘assistant.monitorPlan`.



69
70
71
# File 'lib/vapi_server_sdk/types/call.rb', line 69

def monitor
  @monitor
end

#nameString (readonly)

Returns This is the name of the call. This is just for your own reference.

Returns:

  • (String)

    This is the name of the call. This is just for your own reference.



109
110
111
# File 'lib/vapi_server_sdk/types/call.rb', line 109

def name
  @name
end

#org_idString (readonly)

Returns This is the unique identifier for the org that this call belongs to.

Returns:

  • (String)

    This is the unique identifier for the org that this call belongs to.



49
50
51
# File 'lib/vapi_server_sdk/types/call.rb', line 49

def org_id
  @org_id
end

#phone_call_providerVapi::CallPhoneCallProvider (readonly)

Returns This is the provider of the call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (Vapi::CallPhoneCallProvider)

    This is the provider of the call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.



35
36
37
# File 'lib/vapi_server_sdk/types/call.rb', line 35

def phone_call_provider
  @phone_call_provider
end

#phone_call_provider_idString (readonly)

Returns The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (String)

    The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.



76
77
78
# File 'lib/vapi_server_sdk/types/call.rb', line 76

def phone_call_provider_id
  @phone_call_provider_id
end

#phone_call_transportVapi::CallPhoneCallTransport (readonly)

Returns This is the transport of the phone call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (Vapi::CallPhoneCallTransport)

    This is the transport of the phone call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.



38
39
40
# File 'lib/vapi_server_sdk/types/call.rb', line 38

def phone_call_transport
  @phone_call_transport
end

#phone_numberVapi::ImportTwilioPhoneNumberDto (readonly)

Returns This is the phone number that will be used for the call. To use an existing number, use ‘phoneNumberId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (Vapi::ImportTwilioPhoneNumberDto)

    This is the phone number that will be used for the call. To use an existing number, use ‘phoneNumberId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



99
100
101
# File 'lib/vapi_server_sdk/types/call.rb', line 99

def phone_number
  @phone_number
end

#phone_number_idString (readonly)

Returns This is the phone number that will be used for the call. To use a transient number, use ‘phoneNumber` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (String)

    This is the phone number that will be used for the call. To use a transient number, use ‘phoneNumber` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



95
96
97
# File 'lib/vapi_server_sdk/types/call.rb', line 95

def phone_number_id
  @phone_number_id
end

#squadVapi::CreateSquadDto (readonly)

Returns This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead.

Returns:

  • (Vapi::CreateSquadDto)

    This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead.



91
92
93
# File 'lib/vapi_server_sdk/types/call.rb', line 91

def squad
  @squad
end

#squad_idString (readonly)

Returns This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead.

Returns:

  • (String)

    This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead.



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

def squad_id
  @squad_id
end

#started_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the call was started.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the call was started.



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

def started_at
  @started_at
end

#statusVapi::CallStatus (readonly)

Returns This is the status of the call.

Returns:



40
41
42
# File 'lib/vapi_server_sdk/types/call.rb', line 40

def status
  @status
end

#typeVapi::CallType (readonly)

Returns This is the type of call.

Returns:



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

def type
  @type
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the call was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the call was last updated.



53
54
55
# File 'lib/vapi_server_sdk/types/call.rb', line 53

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Call

Deserialize a JSON object to an instance of Call

Parameters:

  • json_object (String)

Returns:



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/vapi_server_sdk/types/call.rb', line 247

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  costs = parsed_json["costs"]&.map do |item|
    item = item.to_json
    Vapi::CallCostsItem.from_json(json_object: item)
  end
  messages = parsed_json["messages"]&.map do |item|
    item = item.to_json
    Vapi::CallMessagesItem.from_json(json_object: item)
  end
  phone_call_provider = parsed_json["phoneCallProvider"]
  phone_call_transport = parsed_json["phoneCallTransport"]
  status = parsed_json["status"]
  ended_reason = parsed_json["endedReason"]
  if parsed_json["destination"].nil?
    destination = nil
  else
    destination = parsed_json["destination"].to_json
    destination = Vapi::CallDestination.from_json(json_object: destination)
  end
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  started_at = (DateTime.parse(parsed_json["startedAt"]) unless parsed_json["startedAt"].nil?)
  ended_at = (DateTime.parse(parsed_json["endedAt"]) unless parsed_json["endedAt"].nil?)
  cost = parsed_json["cost"]
  if parsed_json["costBreakdown"].nil?
    cost_breakdown = nil
  else
    cost_breakdown = parsed_json["costBreakdown"].to_json
    cost_breakdown = Vapi::CostBreakdown.from_json(json_object: cost_breakdown)
  end
  if parsed_json["artifactPlan"].nil?
    artifact_plan = nil
  else
    artifact_plan = parsed_json["artifactPlan"].to_json
    artifact_plan = Vapi::ArtifactPlan.from_json(json_object: artifact_plan)
  end
  if parsed_json["analysis"].nil?
    analysis = nil
  else
    analysis = parsed_json["analysis"].to_json
    analysis = Vapi::Analysis.from_json(json_object: analysis)
  end
  if parsed_json["monitor"].nil?
    monitor = nil
  else
    monitor = parsed_json["monitor"].to_json
    monitor = Vapi::Monitor.from_json(json_object: monitor)
  end
  if parsed_json["artifact"].nil?
    artifact = nil
  else
    artifact = parsed_json["artifact"].to_json
    artifact = Vapi::Artifact.from_json(json_object: artifact)
  end
  phone_call_provider_id = parsed_json["phoneCallProviderId"]
  assistant_id = parsed_json["assistantId"]
  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["assistantOverrides"].nil?
    assistant_overrides = nil
  else
    assistant_overrides = parsed_json["assistantOverrides"].to_json
    assistant_overrides = Vapi::AssistantOverrides.from_json(json_object: assistant_overrides)
  end
  squad_id = parsed_json["squadId"]
  if parsed_json["squad"].nil?
    squad = nil
  else
    squad = parsed_json["squad"].to_json
    squad = Vapi::CreateSquadDto.from_json(json_object: squad)
  end
  phone_number_id = parsed_json["phoneNumberId"]
  if parsed_json["phoneNumber"].nil?
    phone_number = nil
  else
    phone_number = parsed_json["phoneNumber"].to_json
    phone_number = Vapi::ImportTwilioPhoneNumberDto.from_json(json_object: phone_number)
  end
  customer_id = parsed_json["customerId"]
  if parsed_json["customer"].nil?
    customer = nil
  else
    customer = parsed_json["customer"].to_json
    customer = Vapi::CreateCustomerDto.from_json(json_object: customer)
  end
  name = parsed_json["name"]
  new(
    type: type,
    costs: costs,
    messages: messages,
    phone_call_provider: phone_call_provider,
    phone_call_transport: phone_call_transport,
    status: status,
    ended_reason: ended_reason,
    destination: destination,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    started_at: started_at,
    ended_at: ended_at,
    cost: cost,
    cost_breakdown: cost_breakdown,
    artifact_plan: artifact_plan,
    analysis: analysis,
    monitor: monitor,
    artifact: artifact,
    phone_call_provider_id: phone_call_provider_id,
    assistant_id: assistant_id,
    assistant: assistant,
    assistant_overrides: assistant_overrides,
    squad_id: squad_id,
    squad: squad,
    phone_number_id: phone_number_id,
    phone_number: phone_number,
    customer_id: customer_id,
    customer: customer,
    name: name,
    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)


391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/vapi_server_sdk/types/call.rb', line 391

def self.validate_raw(obj:)
  obj.type&.is_a?(Vapi::CallType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.costs&.is_a?(Array) != false || raise("Passed value for field obj.costs is not the expected type, validation failed.")
  obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
  obj.phone_call_provider&.is_a?(Vapi::CallPhoneCallProvider) != false || raise("Passed value for field obj.phone_call_provider is not the expected type, validation failed.")
  obj.phone_call_transport&.is_a?(Vapi::CallPhoneCallTransport) != false || raise("Passed value for field obj.phone_call_transport is not the expected type, validation failed.")
  obj.status&.is_a?(Vapi::CallStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.ended_reason&.is_a?(Vapi::CallEndedReason) != false || raise("Passed value for field obj.ended_reason is not the expected type, validation failed.")
  obj.destination.nil? || Vapi::CallDestination.validate_raw(obj: obj.destination)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.started_at&.is_a?(DateTime) != false || raise("Passed value for field obj.started_at is not the expected type, validation failed.")
  obj.ended_at&.is_a?(DateTime) != false || raise("Passed value for field obj.ended_at is not the expected type, validation failed.")
  obj.cost&.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.")
  obj.cost_breakdown.nil? || Vapi::CostBreakdown.validate_raw(obj: obj.cost_breakdown)
  obj.artifact_plan.nil? || Vapi::ArtifactPlan.validate_raw(obj: obj.artifact_plan)
  obj.analysis.nil? || Vapi::Analysis.validate_raw(obj: obj.analysis)
  obj.monitor.nil? || Vapi::Monitor.validate_raw(obj: obj.monitor)
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
  obj.phone_call_provider_id&.is_a?(String) != false || raise("Passed value for field obj.phone_call_provider_id is not the expected type, validation failed.")
  obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.")
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
  obj.assistant_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.assistant_overrides)
  obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.")
  obj.squad.nil? || Vapi::CreateSquadDto.validate_raw(obj: obj.squad)
  obj.phone_number_id&.is_a?(String) != false || raise("Passed value for field obj.phone_number_id is not the expected type, validation failed.")
  obj.phone_number.nil? || Vapi::ImportTwilioPhoneNumberDto.validate_raw(obj: obj.phone_number)
  obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
  obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Call to a JSON object

Returns:

  • (String)


381
382
383
# File 'lib/vapi_server_sdk/types/call.rb', line 381

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