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 the message is associated with.
-
#call ⇒ Vapi::Call
readonly
This is the call that the message is associated with.
-
#chat ⇒ Vapi::Chat
readonly
This is the chat 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 that the message is associated with.
-
#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 that the message is associated with.
-
#started_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the call started.
-
#timestamp ⇒ Float
readonly
This is the timestamp of the message.
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, chat: 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, chat: OMIT, started_at: OMIT, ended_at: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageEndOfCallReport
81 82 83 84 85 86 87 88 89 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 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 81 def initialize(ended_reason:, artifact:, analysis:, phone_number: OMIT, cost: OMIT, costs: OMIT, timestamp: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, chat: 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 @chat = chat if chat != 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, "chat": chat, "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.
52 53 54 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 52 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.
44 45 46 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 44 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.
33 34 35 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 33 def artifact @artifact end |
#assistant ⇒ Vapi::CreateAssistantDto (readonly)
Returns This is the assistant that the message is associated with.
35 36 37 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 35 def assistant @assistant end |
#call ⇒ Vapi::Call (readonly)
Returns This is the call that the message is associated with.
39 40 41 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 39 def call @call end |
#chat ⇒ Vapi::Chat (readonly)
Returns This is the chat object.
41 42 43 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 41 def chat @chat 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.
25 26 27 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 25 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.
28 29 30 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 28 def costs @costs end |
#customer ⇒ Vapi::CreateCustomerDto (readonly)
Returns This is the customer that the message is associated with.
37 38 39 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 37 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.
50 51 52 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 50 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.
22 23 24 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 22 def ended_reason @ended_reason end |
#phone_number ⇒ Vapi::ServerMessageEndOfCallReportPhoneNumber (readonly)
Returns This is the phone number that the message is associated with.
19 20 21 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 19 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.
47 48 49 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 47 def started_at @started_at end |
#timestamp ⇒ Float (readonly)
Returns This is the timestamp of the message.
30 31 32 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 30 def @timestamp end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ServerMessageEndOfCallReport
Deserialize a JSON object to an instance of ServerMessageEndOfCallReport
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 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 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 120 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["chat"].nil? chat = nil else chat = parsed_json["chat"].to_json chat = Vapi::Chat.from_json(json_object: chat) 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, chat: chat, 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.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 205 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?(Float) != 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) obj.chat.nil? || Vapi::Chat.validate_raw(obj: obj.chat) 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
195 196 197 |
# File 'lib/vapi_server_sdk/types/server_message_end_of_call_report.rb', line 195 def to_json(*_args) @_field_set&.to_json end |