Class: Vapi::ServerMessageEndOfCallReport
- Inherits:
-
Object
- Object
- Vapi::ServerMessageEndOfCallReport
- Defined in:
- lib/vapi_server_sdk/types/server_message_end_of_call_report.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 from the call.
-
#assistant ⇒ Vapi::CreateAssistantDto
readonly
This is the assistant that is currently active.
-
#call ⇒ Vapi::Call
readonly
This is the call object.
-
#cost ⇒ Float
readonly
This is the cost of the call in USD.
-
#costs ⇒ Array<Vapi::ServerMessageEndOfCallReportCostsItem>
readonly
These are the costs of individual components of the call in USD.
-
#customer ⇒ Vapi::CreateCustomerDto
readonly
This is the customer associated with the call.
-
#ended_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call ended.
-
#ended_reason ⇒ Vapi::ServerMessageEndOfCallReportEndedReason
readonly
This is the reason the call ended.
-
#phone_number ⇒ Vapi::ServerMessageEndOfCallReportPhoneNumber
readonly
This is the phone number associated with the call.
-
#started_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call started.
-
#timestamp ⇒ String
readonly
This is the ISO-8601 formatted timestamp of when the message was sent.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ServerMessageEndOfCallReport
Deserialize a JSON object to an instance of ServerMessageEndOfCallReport.
-
.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(ended_reason:, artifact:, analysis:, phone_number: OMIT, cost: OMIT, costs: OMIT, timestamp: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, started_at: OMIT, ended_at: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageEndOfCallReport constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ServerMessageEndOfCallReport to a JSON object.
Constructor Details
#initialize(ended_reason:, artifact:, analysis:, phone_number: OMIT, cost: OMIT, costs: OMIT, timestamp: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, started_at: OMIT, ended_at: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageEndOfCallReport
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 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 111 def initialize(ended_reason:, artifact:, analysis:, phone_number: OMIT, cost: OMIT, costs: OMIT, timestamp: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, started_at: OMIT, ended_at: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @ended_reason = ended_reason @cost = cost if cost != OMIT @costs = costs if costs != OMIT @timestamp = if != OMIT @artifact = artifact @assistant = assistant if assistant != OMIT @customer = customer if customer != OMIT @call = call if call != OMIT @analysis = analysis @started_at = started_at if started_at != OMIT @ended_at = ended_at if ended_at != OMIT @additional_properties = additional_properties @_field_set = { "phoneNumber": phone_number, "endedReason": ended_reason, "cost": cost, "costs": costs, "timestamp": , "artifact": artifact, "assistant": assistant, "customer": customer, "call": call, "analysis": analysis, "startedAt": started_at, "endedAt": ended_at }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
66 67 68 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 66 def additional_properties @additional_properties end |
#analysis ⇒ Vapi::Analysis (readonly)
Returns This is the analysis of the call. This can also be found at ‘call.analysis` on GET /call/:id.
58 59 60 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 58 def analysis @analysis end |
#artifact ⇒ Vapi::Artifact (readonly)
Returns These are the artifacts from the call. This can also be found at ‘call.artifact` on GET /call/:id.
35 36 37 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 35 def artifact @artifact end |
#assistant ⇒ Vapi::CreateAssistantDto (readonly)
Returns This is the assistant that is currently active. This is provided for convenience. This matches one of the following:
-
‘call.assistant`,
-
‘call.assistantId`,
-
‘call.squad.assistant`,
-
‘call.squad.assistantId`,
-
‘call.squadId->.assistant`,
-
‘call.squadId->.assistantId`.
45 46 47 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 45 def assistant @assistant end |
#call ⇒ Vapi::Call (readonly)
Returns This is the call object. This matches what was returned in POST /call. Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.
55 56 57 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 55 def call @call end |
#cost ⇒ Float (readonly)
Returns This is the cost of the call in USD. This can also be found at ‘call.cost` on GET /call/:id.
27 28 29 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 27 def cost @cost end |
#costs ⇒ Array<Vapi::ServerMessageEndOfCallReportCostsItem> (readonly)
Returns These are the costs of individual components of the call in USD. This can also be found at ‘call.costs` on GET /call/:id.
30 31 32 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 30 def costs @costs end |
#customer ⇒ Vapi::CreateCustomerDto (readonly)
Returns This is the customer associated with the call. This matches one of the following:
-
‘call.customer`,
-
‘call.customerId`.
50 51 52 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 50 def customer @customer end |
#ended_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the call ended. This can also be found at ‘call.endedAt` on GET /call/:id.
64 65 66 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 64 def ended_at @ended_at end |
#ended_reason ⇒ Vapi::ServerMessageEndOfCallReportEndedReason (readonly)
Returns This is the reason the call ended. This can also be found at ‘call.endedReason` on GET /call/:id.
24 25 26 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 24 def ended_reason @ended_reason end |
#phone_number ⇒ Vapi::ServerMessageEndOfCallReportPhoneNumber (readonly)
Returns This is the phone number associated with the call. This matches one of the following:
-
‘call.phoneNumber`,
-
‘call.phoneNumberId`.
21 22 23 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 21 def phone_number @phone_number end |
#started_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the call started. This can also be found at ‘call.startedAt` on GET /call/:id.
61 62 63 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 61 def started_at @started_at end |
#timestamp ⇒ String (readonly)
Returns This is the ISO-8601 formatted timestamp of when the message was sent.
32 33 34 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 32 def @timestamp end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ServerMessageEndOfCallReport
Deserialize a JSON object to an instance of ServerMessageEndOfCallReport
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 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 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 148 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::ServerMessageEndOfCallReportPhoneNumber.from_json(json_object: phone_number) end ended_reason = parsed_json["endedReason"] cost = parsed_json["cost"] costs = parsed_json["costs"]&.map do |item| item = item.to_json Vapi::ServerMessageEndOfCallReportCostsItem.from_json(json_object: item) end = parsed_json["timestamp"] if parsed_json["artifact"].nil? artifact = nil else artifact = parsed_json["artifact"].to_json artifact = Vapi::Artifact.from_json(json_object: artifact) 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["customer"].nil? customer = nil else customer = parsed_json["customer"].to_json customer = Vapi::CreateCustomerDto.from_json(json_object: customer) end 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["analysis"].nil? analysis = nil else analysis = parsed_json["analysis"].to_json analysis = Vapi::Analysis.from_json(json_object: analysis) end started_at = (DateTime.parse(parsed_json["startedAt"]) unless parsed_json["startedAt"].nil?) ended_at = (DateTime.parse(parsed_json["endedAt"]) unless parsed_json["endedAt"].nil?) new( phone_number: phone_number, ended_reason: ended_reason, cost: cost, costs: costs, timestamp: , artifact: artifact, assistant: assistant, customer: customer, call: call, analysis: analysis, started_at: started_at, ended_at: ended_at, 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.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 226 def self.validate_raw(obj:) obj.phone_number.nil? || Vapi::ServerMessageEndOfCallReportPhoneNumber.validate_raw(obj: obj.phone_number) obj.ended_reason.is_a?(Vapi::ServerMessageEndOfCallReportEndedReason) != false || raise("Passed value for field obj.ended_reason 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.costs&.is_a?(Array) != false || raise("Passed value for field obj.costs is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.") Vapi::Artifact.validate_raw(obj: obj.artifact) obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer) obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call) Vapi::Analysis.validate_raw(obj: obj.analysis) 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ServerMessageEndOfCallReport to a JSON object
216 217 218 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 216 def to_json(*_args) @_field_set&.to_json end |