Class: Vapi::Log
- Inherits:
-
Object
- Object
- Vapi::Log
- Defined in:
- lib/vapi_server_sdk/types/log.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#assistant_id ⇒ String
readonly
This is the ID of the assistant.
-
#call_id ⇒ String
readonly
This is the ID of the call.
-
#customer_id ⇒ String
readonly
This is the ID of the customer.
-
#error ⇒ Vapi::Error
readonly
This is the error, if one occurred.
-
#org_id ⇒ String
readonly
This is the unique identifier for the org that this log belongs to.
-
#phone_number_id ⇒ String
readonly
This is the ID of the phone number.
-
#request_body ⇒ Hash{String => Object}
readonly
This is the body of the request.
-
#request_duration_seconds ⇒ Float
readonly
‘This is how long the request took.
-
#request_finished_at ⇒ String
readonly
This is the timestamp at which the request finished.
-
#request_headers ⇒ Hash{String => Object}
readonly
These are the headers of the request.
-
#request_http_method ⇒ Vapi::LogRequestHttpMethod
readonly
This is the request method.
-
#request_ip_address ⇒ String
readonly
This is the request IP address.
-
#request_origin ⇒ String
readonly
This is the origin of the request.
-
#request_path ⇒ String
readonly
This is the request path.
-
#request_query ⇒ String
readonly
This is the request query.
-
#request_started_at ⇒ String
readonly
This is the timestamp at which the request began.
-
#request_url ⇒ String
readonly
This is the request URL.
-
#resource ⇒ Vapi::LogResource
readonly
This is the specific resource, relevant only to API logs.
-
#response_body ⇒ Hash{String => Object}
readonly
This is the body of the response.
-
#response_http_code ⇒ Float
readonly
This the HTTP status code of the response.
-
#squad_id ⇒ String
readonly
This is the ID of the squad.
-
#time ⇒ String
readonly
This is the timestamp at which the log was written.
-
#type ⇒ Vapi::LogType
readonly
This is the type of the log.
-
#webhook_type ⇒ String
readonly
This is the type of the webhook, given the log is from a webhook.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Log
Deserialize a JSON object to an instance of Log.
-
.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(time:, org_id:, type:, webhook_type: OMIT, resource: OMIT, request_duration_seconds: OMIT, request_started_at: OMIT, request_finished_at: OMIT, request_body: OMIT, request_http_method: OMIT, request_url: OMIT, request_path: OMIT, request_query: OMIT, response_http_code: OMIT, request_ip_address: OMIT, request_origin: OMIT, response_body: OMIT, request_headers: OMIT, error: OMIT, assistant_id: OMIT, phone_number_id: OMIT, customer_id: OMIT, squad_id: OMIT, call_id: OMIT, additional_properties: nil) ⇒ Vapi::Log constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Log to a JSON object.
Constructor Details
#initialize(time:, org_id:, type:, webhook_type: OMIT, resource: OMIT, request_duration_seconds: OMIT, request_started_at: OMIT, request_finished_at: OMIT, request_body: OMIT, request_http_method: OMIT, request_url: OMIT, request_path: OMIT, request_query: OMIT, response_http_code: OMIT, request_ip_address: OMIT, request_origin: OMIT, response_body: OMIT, request_headers: OMIT, error: OMIT, assistant_id: OMIT, phone_number_id: OMIT, customer_id: OMIT, squad_id: OMIT, call_id: OMIT, additional_properties: nil) ⇒ Vapi::Log
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 |
# File 'lib/vapi_server_sdk/types/log.rb', line 94 def initialize(time:, org_id:, type:, webhook_type: OMIT, resource: OMIT, request_duration_seconds: OMIT, request_started_at: OMIT, request_finished_at: OMIT, request_body: OMIT, request_http_method: OMIT, request_url: OMIT, request_path: OMIT, request_query: OMIT, response_http_code: OMIT, request_ip_address: OMIT, request_origin: OMIT, response_body: OMIT, request_headers: OMIT, error: OMIT, assistant_id: OMIT, phone_number_id: OMIT, customer_id: OMIT, squad_id: OMIT, call_id: OMIT, additional_properties: nil) @time = time @org_id = org_id @type = type @webhook_type = webhook_type if webhook_type != OMIT @resource = resource if resource != OMIT @request_duration_seconds = request_duration_seconds if request_duration_seconds != OMIT @request_started_at = request_started_at if request_started_at != OMIT @request_finished_at = request_finished_at if request_finished_at != OMIT @request_body = request_body if request_body != OMIT @request_http_method = request_http_method if request_http_method != OMIT @request_url = request_url if request_url != OMIT @request_path = request_path if request_path != OMIT @request_query = request_query if request_query != OMIT @response_http_code = response_http_code if response_http_code != OMIT @request_ip_address = request_ip_address if request_ip_address != OMIT @request_origin = request_origin if request_origin != OMIT @response_body = response_body if response_body != OMIT @request_headers = request_headers if request_headers != OMIT @error = error if error != OMIT @assistant_id = assistant_id if assistant_id != OMIT @phone_number_id = phone_number_id if phone_number_id != OMIT @customer_id = customer_id if customer_id != OMIT @squad_id = squad_id if squad_id != OMIT @call_id = call_id if call_id != OMIT @additional_properties = additional_properties @_field_set = { "time": time, "orgId": org_id, "type": type, "webhookType": webhook_type, "resource": resource, "requestDurationSeconds": request_duration_seconds, "requestStartedAt": request_started_at, "requestFinishedAt": request_finished_at, "requestBody": request_body, "requestHttpMethod": request_http_method, "requestUrl": request_url, "requestPath": request_path, "requestQuery": request_query, "responseHttpCode": response_http_code, "requestIpAddress": request_ip_address, "requestOrigin": request_origin, "responseBody": response_body, "requestHeaders": request_headers, "error": error, "assistantId": assistant_id, "phoneNumberId": phone_number_id, "customerId": customer_id, "squadId": squad_id, "callId": call_id }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
61 62 63 |
# File 'lib/vapi_server_sdk/types/log.rb', line 61 def additional_properties @additional_properties end |
#assistant_id ⇒ String (readonly)
Returns This is the ID of the assistant.
51 52 53 |
# File 'lib/vapi_server_sdk/types/log.rb', line 51 def assistant_id @assistant_id end |
#call_id ⇒ String (readonly)
Returns This is the ID of the call.
59 60 61 |
# File 'lib/vapi_server_sdk/types/log.rb', line 59 def call_id @call_id end |
#customer_id ⇒ String (readonly)
Returns This is the ID of the customer.
55 56 57 |
# File 'lib/vapi_server_sdk/types/log.rb', line 55 def customer_id @customer_id end |
#error ⇒ Vapi::Error (readonly)
Returns This is the error, if one occurred.
49 50 51 |
# File 'lib/vapi_server_sdk/types/log.rb', line 49 def error @error end |
#org_id ⇒ String (readonly)
Returns This is the unique identifier for the org that this log belongs to.
15 16 17 |
# File 'lib/vapi_server_sdk/types/log.rb', line 15 def org_id @org_id end |
#phone_number_id ⇒ String (readonly)
Returns This is the ID of the phone number.
53 54 55 |
# File 'lib/vapi_server_sdk/types/log.rb', line 53 def phone_number_id @phone_number_id end |
#request_body ⇒ Hash{String => Object} (readonly)
Returns This is the body of the request.
29 30 31 |
# File 'lib/vapi_server_sdk/types/log.rb', line 29 def request_body @request_body end |
#request_duration_seconds ⇒ Float (readonly)
Returns ‘This is how long the request took.
23 24 25 |
# File 'lib/vapi_server_sdk/types/log.rb', line 23 def request_duration_seconds @request_duration_seconds end |
#request_finished_at ⇒ String (readonly)
Returns This is the timestamp at which the request finished.
27 28 29 |
# File 'lib/vapi_server_sdk/types/log.rb', line 27 def request_finished_at @request_finished_at end |
#request_headers ⇒ Hash{String => Object} (readonly)
Returns These are the headers of the request.
47 48 49 |
# File 'lib/vapi_server_sdk/types/log.rb', line 47 def request_headers @request_headers end |
#request_http_method ⇒ Vapi::LogRequestHttpMethod (readonly)
Returns This is the request method.
31 32 33 |
# File 'lib/vapi_server_sdk/types/log.rb', line 31 def request_http_method @request_http_method end |
#request_ip_address ⇒ String (readonly)
Returns This is the request IP address.
41 42 43 |
# File 'lib/vapi_server_sdk/types/log.rb', line 41 def request_ip_address @request_ip_address end |
#request_origin ⇒ String (readonly)
Returns This is the origin of the request.
43 44 45 |
# File 'lib/vapi_server_sdk/types/log.rb', line 43 def request_origin @request_origin end |
#request_path ⇒ String (readonly)
Returns This is the request path.
35 36 37 |
# File 'lib/vapi_server_sdk/types/log.rb', line 35 def request_path @request_path end |
#request_query ⇒ String (readonly)
Returns This is the request query.
37 38 39 |
# File 'lib/vapi_server_sdk/types/log.rb', line 37 def request_query @request_query end |
#request_started_at ⇒ String (readonly)
Returns This is the timestamp at which the request began.
25 26 27 |
# File 'lib/vapi_server_sdk/types/log.rb', line 25 def request_started_at @request_started_at end |
#request_url ⇒ String (readonly)
Returns This is the request URL.
33 34 35 |
# File 'lib/vapi_server_sdk/types/log.rb', line 33 def request_url @request_url end |
#resource ⇒ Vapi::LogResource (readonly)
Returns This is the specific resource, relevant only to API logs.
21 22 23 |
# File 'lib/vapi_server_sdk/types/log.rb', line 21 def resource @resource end |
#response_body ⇒ Hash{String => Object} (readonly)
Returns This is the body of the response.
45 46 47 |
# File 'lib/vapi_server_sdk/types/log.rb', line 45 def response_body @response_body end |
#response_http_code ⇒ Float (readonly)
Returns This the HTTP status code of the response.
39 40 41 |
# File 'lib/vapi_server_sdk/types/log.rb', line 39 def response_http_code @response_http_code end |
#squad_id ⇒ String (readonly)
Returns This is the ID of the squad.
57 58 59 |
# File 'lib/vapi_server_sdk/types/log.rb', line 57 def squad_id @squad_id end |
#time ⇒ String (readonly)
Returns This is the timestamp at which the log was written.
13 14 15 |
# File 'lib/vapi_server_sdk/types/log.rb', line 13 def time @time end |
#type ⇒ Vapi::LogType (readonly)
Returns This is the type of the log.
17 18 19 |
# File 'lib/vapi_server_sdk/types/log.rb', line 17 def type @type end |
#webhook_type ⇒ String (readonly)
Returns This is the type of the webhook, given the log is from a webhook.
19 20 21 |
# File 'lib/vapi_server_sdk/types/log.rb', line 19 def webhook_type @webhook_type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Log
Deserialize a JSON object to an instance of Log
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 212 213 214 |
# File 'lib/vapi_server_sdk/types/log.rb', line 155 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) time = parsed_json["time"] org_id = parsed_json["orgId"] type = parsed_json["type"] webhook_type = parsed_json["webhookType"] resource = parsed_json["resource"] request_duration_seconds = parsed_json["requestDurationSeconds"] request_started_at = parsed_json["requestStartedAt"] request_finished_at = parsed_json["requestFinishedAt"] request_body = parsed_json["requestBody"] request_http_method = parsed_json["requestHttpMethod"] request_url = parsed_json["requestUrl"] request_path = parsed_json["requestPath"] request_query = parsed_json["requestQuery"] response_http_code = parsed_json["responseHttpCode"] request_ip_address = parsed_json["requestIpAddress"] request_origin = parsed_json["requestOrigin"] response_body = parsed_json["responseBody"] request_headers = parsed_json["requestHeaders"] if parsed_json["error"].nil? error = nil else error = parsed_json["error"].to_json error = Vapi::Error.from_json(json_object: error) end assistant_id = parsed_json["assistantId"] phone_number_id = parsed_json["phoneNumberId"] customer_id = parsed_json["customerId"] squad_id = parsed_json["squadId"] call_id = parsed_json["callId"] new( time: time, org_id: org_id, type: type, webhook_type: webhook_type, resource: resource, request_duration_seconds: request_duration_seconds, request_started_at: request_started_at, request_finished_at: request_finished_at, request_body: request_body, request_http_method: request_http_method, request_url: request_url, request_path: request_path, request_query: request_query, response_http_code: response_http_code, request_ip_address: request_ip_address, request_origin: request_origin, response_body: response_body, request_headers: request_headers, error: error, assistant_id: assistant_id, phone_number_id: phone_number_id, customer_id: customer_id, squad_id: squad_id, call_id: call_id, 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.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/vapi_server_sdk/types/log.rb', line 229 def self.validate_raw(obj:) obj.time.is_a?(String) != false || raise("Passed value for field obj.time 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.type.is_a?(Vapi::LogType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.webhook_type&.is_a?(String) != false || raise("Passed value for field obj.webhook_type is not the expected type, validation failed.") obj.resource&.is_a?(Vapi::LogResource) != false || raise("Passed value for field obj.resource is not the expected type, validation failed.") obj.request_duration_seconds&.is_a?(Float) != false || raise("Passed value for field obj.request_duration_seconds is not the expected type, validation failed.") obj.request_started_at&.is_a?(String) != false || raise("Passed value for field obj.request_started_at is not the expected type, validation failed.") obj.request_finished_at&.is_a?(String) != false || raise("Passed value for field obj.request_finished_at is not the expected type, validation failed.") obj.request_body&.is_a?(Hash) != false || raise("Passed value for field obj.request_body is not the expected type, validation failed.") obj.request_http_method&.is_a?(Vapi::LogRequestHttpMethod) != false || raise("Passed value for field obj.request_http_method is not the expected type, validation failed.") obj.request_url&.is_a?(String) != false || raise("Passed value for field obj.request_url is not the expected type, validation failed.") obj.request_path&.is_a?(String) != false || raise("Passed value for field obj.request_path is not the expected type, validation failed.") obj.request_query&.is_a?(String) != false || raise("Passed value for field obj.request_query is not the expected type, validation failed.") obj.response_http_code&.is_a?(Float) != false || raise("Passed value for field obj.response_http_code is not the expected type, validation failed.") obj.request_ip_address&.is_a?(String) != false || raise("Passed value for field obj.request_ip_address is not the expected type, validation failed.") obj.request_origin&.is_a?(String) != false || raise("Passed value for field obj.request_origin is not the expected type, validation failed.") obj.response_body&.is_a?(Hash) != false || raise("Passed value for field obj.response_body is not the expected type, validation failed.") obj.request_headers&.is_a?(Hash) != false || raise("Passed value for field obj.request_headers is not the expected type, validation failed.") obj.error.nil? || Vapi::Error.validate_raw(obj: obj.error) obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") 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.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") obj.call_id&.is_a?(String) != false || raise("Passed value for field obj.call_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Log to a JSON object
219 220 221 |
# File 'lib/vapi_server_sdk/types/log.rb', line 219 def to_json(*_args) @_field_set&.to_json end |