Class: Vapi::Call
- Inherits:
-
Object
- Object
- Vapi::Call
- Defined in:
- lib/vapi_server_sdk/types/call.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#analysis ⇒ Vapi::Analysis
readonly
This is the analysis of the call.
-
#artifact ⇒ Vapi::Artifact
readonly
These are the artifacts created from the call.
-
#artifact_plan ⇒ Vapi::ArtifactPlan
readonly
This is a copy of assistant artifact plan.
-
#assistant ⇒ Vapi::CreateAssistantDto
readonly
This is the assistant that will be used for the call.
-
#assistant_id ⇒ String
readonly
This is the assistant ID that will be used for the call.
-
#assistant_overrides ⇒ Vapi::AssistantOverrides
readonly
These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.
-
#campaign_id ⇒ String
readonly
This is the campaign ID that the call belongs to.
-
#cost ⇒ Float
readonly
This is the cost of the call in USD.
-
#cost_breakdown ⇒ Vapi::CostBreakdown
readonly
This is the cost of the call in USD.
-
#costs ⇒ Array<Vapi::CallCostsItem>
readonly
These are the costs of individual components of the call in USD.
-
#created_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call was created.
-
#customer ⇒ Vapi::CreateCustomerDto
readonly
This is the customer that will be called.
-
#customer_id ⇒ String
readonly
This is the customer that will be called.
-
#destination ⇒ Vapi::CallDestination
readonly
This is the destination where the call ended up being transferred to.
-
#ended_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call was ended.
-
#ended_reason ⇒ Vapi::CallEndedReason
readonly
This is the explanation for how the call ended.
-
#id ⇒ String
readonly
This is the unique identifier for the call.
- #messages ⇒ Array<Vapi::CallMessagesItem> readonly
-
#monitor ⇒ Vapi::Monitor
readonly
This is to real-time monitor the call.
-
#name ⇒ String
readonly
This is the name of the call.
-
#org_id ⇒ String
readonly
This is the unique identifier for the org that this call belongs to.
-
#phone_call_provider ⇒ Vapi::CallPhoneCallProvider
readonly
This is the provider of the call.
-
#phone_call_provider_id ⇒ String
readonly
The ID of the call as provided by the phone number service.
-
#phone_call_transport ⇒ Vapi::CallPhoneCallTransport
readonly
This is the transport of the phone call.
-
#phone_number ⇒ Vapi::ImportTwilioPhoneNumberDto
readonly
This is the phone number that will be used for the call.
-
#phone_number_id ⇒ String
readonly
This is the phone number that will be used for the call.
-
#schedule_plan ⇒ Vapi::SchedulePlan
readonly
This is the schedule plan of the call.
-
#squad ⇒ Vapi::CreateSquadDto
readonly
This is a squad that will be used for the call.
-
#squad_id ⇒ String
readonly
This is the squad that will be used for the call.
-
#started_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call was started.
-
#status ⇒ Vapi::CallStatus
readonly
This is the status of the call.
-
#transport ⇒ Hash{String => Object}
readonly
This is the transport of the call.
-
#type ⇒ Vapi::CallType
readonly
This is the type of call.
-
#updated_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call was last updated.
-
#workflow ⇒ Vapi::CreateWorkflowDto
readonly
This is a workflow that will be used for the call.
-
#workflow_id ⇒ String
readonly
This is the workflow that will be used for the call.
-
#workflow_overrides ⇒ Vapi::WorkflowOverrides
readonly
These are the overrides for the ‘workflow` or `workflowId`’s settings and template variables.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Call
Deserialize a JSON object to an instance of Call.
-
.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.
Instance Method Summary collapse
- #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, campaign_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, workflow_id: OMIT, workflow: OMIT, workflow_overrides: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, schedule_plan: OMIT, transport: OMIT, additional_properties: nil) ⇒ Vapi::Call constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Call to a JSON object.
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, campaign_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, workflow_id: OMIT, workflow: OMIT, workflow_overrides: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, schedule_plan: OMIT, transport: OMIT, additional_properties: nil) ⇒ Vapi::Call
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 |
# File 'lib/vapi_server_sdk/types/call.rb', line 247 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, campaign_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, workflow_id: OMIT, workflow: OMIT, workflow_overrides: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, schedule_plan: OMIT, transport: OMIT, additional_properties: nil) @type = type if type != OMIT @costs = costs if costs != OMIT @messages = if != 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 @campaign_id = campaign_id if campaign_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 @workflow_id = workflow_id if workflow_id != OMIT @workflow = workflow if workflow != OMIT @workflow_overrides = workflow_overrides if workflow_overrides != 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 @schedule_plan = schedule_plan if schedule_plan != OMIT @transport = transport if transport != OMIT @additional_properties = additional_properties @_field_set = { "type": type, "costs": costs, "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, "campaignId": campaign_id, "assistantId": assistant_id, "assistant": assistant, "assistantOverrides": assistant_overrides, "squadId": squad_id, "squad": squad, "workflowId": workflow_id, "workflow": workflow, "workflowOverrides": workflow_overrides, "phoneNumberId": phone_number_id, "phoneNumber": phone_number, "customerId": customer_id, "customer": customer, "name": name, "schedulePlan": schedule_plan, "transport": transport }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
153 154 155 |
# File 'lib/vapi_server_sdk/types/call.rb', line 153 def additional_properties @additional_properties end |
#analysis ⇒ Vapi::Analysis (readonly)
Returns This is the analysis of the call. Configure in ‘assistant.analysisPlan`.
70 71 72 |
# File 'lib/vapi_server_sdk/types/call.rb', line 70 def analysis @analysis end |
#artifact ⇒ Vapi::Artifact (readonly)
Returns These are the artifacts created from the call. Configure in ‘assistant.artifactPlan`.
75 76 77 |
# File 'lib/vapi_server_sdk/types/call.rb', line 75 def artifact @artifact end |
#artifact_plan ⇒ Vapi::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.
68 69 70 |
# File 'lib/vapi_server_sdk/types/call.rb', line 68 def artifact_plan @artifact_plan end |
#assistant ⇒ Vapi::CreateAssistantDto (readonly)
Returns This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead. To start a call with:
-
Assistant, use ‘assistant`
-
Squad, use ‘squad`
-
Workflow, use ‘workflow`.
95 96 97 |
# File 'lib/vapi_server_sdk/types/call.rb', line 95 def assistant @assistant end |
#assistant_id ⇒ String (readonly)
Returns This is the assistant ID that will be used for the call. To use a transient assistant, use ‘assistant` instead. To start a call with:
-
Assistant, use ‘assistantId` or `assistant`
-
Squad, use ‘squadId` or `squad`
-
Workflow, use ‘workflowId` or `workflow`.
88 89 90 |
# File 'lib/vapi_server_sdk/types/call.rb', line 88 def assistant_id @assistant_id end |
#assistant_overrides ⇒ Vapi::AssistantOverrides (readonly)
Returns These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.
98 99 100 |
# File 'lib/vapi_server_sdk/types/call.rb', line 98 def assistant_overrides @assistant_overrides end |
#campaign_id ⇒ String (readonly)
Returns This is the campaign ID that the call belongs to.
81 82 83 |
# File 'lib/vapi_server_sdk/types/call.rb', line 81 def campaign_id @campaign_id end |
#cost ⇒ Float (readonly)
Returns This is the cost of the call in USD.
62 63 64 |
# File 'lib/vapi_server_sdk/types/call.rb', line 62 def cost @cost end |
#cost_breakdown ⇒ Vapi::CostBreakdown (readonly)
Returns This is the cost of the call in USD.
64 65 66 |
# File 'lib/vapi_server_sdk/types/call.rb', line 64 def cost_breakdown @cost_breakdown end |
#costs ⇒ Array<Vapi::CallCostsItem> (readonly)
Returns These are the costs of individual components of the call in USD.
33 34 35 |
# File 'lib/vapi_server_sdk/types/call.rb', line 33 def costs @costs end |
#created_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the call was created.
54 55 56 |
# File 'lib/vapi_server_sdk/types/call.rb', line 54 def created_at @created_at end |
#customer ⇒ Vapi::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.
145 146 147 |
# File 'lib/vapi_server_sdk/types/call.rb', line 145 def customer @customer end |
#customer_id ⇒ String (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.
141 142 143 |
# File 'lib/vapi_server_sdk/types/call.rb', line 141 def customer_id @customer_id end |
#destination ⇒ Vapi::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.
48 49 50 |
# File 'lib/vapi_server_sdk/types/call.rb', line 48 def destination @destination end |
#ended_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the call was ended.
60 61 62 |
# File 'lib/vapi_server_sdk/types/call.rb', line 60 def ended_at @ended_at end |
#ended_reason ⇒ Vapi::CallEndedReason (readonly)
Returns This is the explanation for how the call ended.
45 46 47 |
# File 'lib/vapi_server_sdk/types/call.rb', line 45 def ended_reason @ended_reason end |
#id ⇒ String (readonly)
Returns This is the unique identifier for the call.
50 51 52 |
# File 'lib/vapi_server_sdk/types/call.rb', line 50 def id @id end |
#messages ⇒ Array<Vapi::CallMessagesItem> (readonly)
35 36 37 |
# File 'lib/vapi_server_sdk/types/call.rb', line 35 def @messages end |
#monitor ⇒ Vapi::Monitor (readonly)
Returns This is to real-time monitor the call. Configure in ‘assistant.monitorPlan`.
72 73 74 |
# File 'lib/vapi_server_sdk/types/call.rb', line 72 def monitor @monitor end |
#name ⇒ String (readonly)
Returns This is the name of the call. This is just for your own reference.
147 148 149 |
# File 'lib/vapi_server_sdk/types/call.rb', line 147 def name @name end |
#org_id ⇒ String (readonly)
Returns This is the unique identifier for the org that this call belongs to.
52 53 54 |
# File 'lib/vapi_server_sdk/types/call.rb', line 52 def org_id @org_id end |
#phone_call_provider ⇒ Vapi::CallPhoneCallProvider (readonly)
Returns This is the provider of the call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.
38 39 40 |
# File 'lib/vapi_server_sdk/types/call.rb', line 38 def phone_call_provider @phone_call_provider end |
#phone_call_provider_id ⇒ String (readonly)
Returns The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage. callControlId in Telnyx. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.
79 80 81 |
# File 'lib/vapi_server_sdk/types/call.rb', line 79 def phone_call_provider_id @phone_call_provider_id end |
#phone_call_transport ⇒ Vapi::CallPhoneCallTransport (readonly)
Returns This is the transport of the phone call. Only relevant for ‘outboundPhoneCall` and `inboundPhoneCall` type.
41 42 43 |
# File 'lib/vapi_server_sdk/types/call.rb', line 41 def phone_call_transport @phone_call_transport end |
#phone_number ⇒ Vapi::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.
137 138 139 |
# File 'lib/vapi_server_sdk/types/call.rb', line 137 def phone_number @phone_number end |
#phone_number_id ⇒ String (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.
133 134 135 |
# File 'lib/vapi_server_sdk/types/call.rb', line 133 def phone_number_id @phone_number_id end |
#schedule_plan ⇒ Vapi::SchedulePlan (readonly)
Returns This is the schedule plan of the call.
149 150 151 |
# File 'lib/vapi_server_sdk/types/call.rb', line 149 def schedule_plan @schedule_plan end |
#squad ⇒ Vapi::CreateSquadDto (readonly)
Returns This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead. To start a call with:
-
Assistant, use ‘assistant` or `assistantId`
-
Squad, use ‘squad` or `squadId`
-
Workflow, use ‘workflow` or `workflowId`.
112 113 114 |
# File 'lib/vapi_server_sdk/types/call.rb', line 112 def squad @squad end |
#squad_id ⇒ String (readonly)
Returns This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead. To start a call with:
-
Assistant, use ‘assistant` or `assistantId`
-
Squad, use ‘squad` or `squadId`
-
Workflow, use ‘workflow` or `workflowId`.
105 106 107 |
# File 'lib/vapi_server_sdk/types/call.rb', line 105 def squad_id @squad_id end |
#started_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the call was started.
58 59 60 |
# File 'lib/vapi_server_sdk/types/call.rb', line 58 def started_at @started_at end |
#status ⇒ Vapi::CallStatus (readonly)
Returns This is the status of the call.
43 44 45 |
# File 'lib/vapi_server_sdk/types/call.rb', line 43 def status @status end |
#transport ⇒ Hash{String => Object} (readonly)
Returns This is the transport of the call.
151 152 153 |
# File 'lib/vapi_server_sdk/types/call.rb', line 151 def transport @transport end |
#type ⇒ Vapi::CallType (readonly)
Returns This is the type of call.
31 32 33 |
# File 'lib/vapi_server_sdk/types/call.rb', line 31 def type @type end |
#updated_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the call was last updated.
56 57 58 |
# File 'lib/vapi_server_sdk/types/call.rb', line 56 def updated_at @updated_at end |
#workflow ⇒ Vapi::CreateWorkflowDto (readonly)
Returns This is a workflow that will be used for the call. To use an existing workflow, use ‘workflowId` instead. To start a call with:
-
Assistant, use ‘assistant` or `assistantId`
-
Squad, use ‘squad` or `squadId`
-
Workflow, use ‘workflow` or `workflowId`.
126 127 128 |
# File 'lib/vapi_server_sdk/types/call.rb', line 126 def workflow @workflow end |
#workflow_id ⇒ String (readonly)
Returns This is the workflow that will be used for the call. To use a transient workflow, use ‘workflow` instead. To start a call with:
-
Assistant, use ‘assistant` or `assistantId`
-
Squad, use ‘squad` or `squadId`
-
Workflow, use ‘workflow` or `workflowId`.
119 120 121 |
# File 'lib/vapi_server_sdk/types/call.rb', line 119 def workflow_id @workflow_id end |
#workflow_overrides ⇒ Vapi::WorkflowOverrides (readonly)
Returns These are the overrides for the ‘workflow` or `workflowId`’s settings and template variables.
129 130 131 |
# File 'lib/vapi_server_sdk/types/call.rb', line 129 def workflow_overrides @workflow_overrides end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Call
Deserialize a JSON object to an instance of Call
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 377 378 379 380 381 382 383 384 385 386 387 388 389 390 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 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/vapi_server_sdk/types/call.rb', line 334 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 = 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"] campaign_id = parsed_json["campaignId"] 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 workflow_id = parsed_json["workflowId"] if parsed_json["workflow"].nil? workflow = nil else workflow = parsed_json["workflow"].to_json workflow = Vapi::CreateWorkflowDto.from_json(json_object: workflow) end if parsed_json["workflowOverrides"].nil? workflow_overrides = nil else workflow_overrides = parsed_json["workflowOverrides"].to_json workflow_overrides = Vapi::WorkflowOverrides.from_json(json_object: workflow_overrides) 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"] if parsed_json["schedulePlan"].nil? schedule_plan = nil else schedule_plan = parsed_json["schedulePlan"].to_json schedule_plan = Vapi::SchedulePlan.from_json(json_object: schedule_plan) end transport = parsed_json["transport"] new( type: type, costs: costs, 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, campaign_id: campaign_id, assistant_id: assistant_id, assistant: assistant, assistant_overrides: assistant_overrides, squad_id: squad_id, squad: squad, workflow_id: workflow_id, workflow: workflow, workflow_overrides: workflow_overrides, phone_number_id: phone_number_id, phone_number: phone_number, customer_id: customer_id, customer: customer, name: name, schedule_plan: schedule_plan, transport: transport, 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.
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
# File 'lib/vapi_server_sdk/types/call.rb', line 505 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.&.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.campaign_id&.is_a?(String) != false || raise("Passed value for field obj.campaign_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.workflow_id&.is_a?(String) != false || raise("Passed value for field obj.workflow_id is not the expected type, validation failed.") obj.workflow.nil? || Vapi::CreateWorkflowDto.validate_raw(obj: obj.workflow) obj.workflow_overrides.nil? || Vapi::WorkflowOverrides.validate_raw(obj: obj.workflow_overrides) 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.") obj.schedule_plan.nil? || Vapi::SchedulePlan.validate_raw(obj: obj.schedule_plan) obj.transport&.is_a?(Hash) != false || raise("Passed value for field obj.transport is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Call to a JSON object
495 496 497 |
# File 'lib/vapi_server_sdk/types/call.rb', line 495 def to_json(*_args) @_field_set&.to_json end |