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 ⇒ Float
readonly
This is the timestamp at which the log was written.
-
#type ⇒ Vapi::LogType
readonly
This is the type of the log.
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:, request_duration_seconds:, request_started_at:, request_finished_at:, request_body:, request_http_method:, request_url:, request_path:, response_http_code:, resource: OMIT, request_query: 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:, request_duration_seconds:, request_started_at:, request_finished_at:, request_body:, request_http_method:, request_url:, request_path:, response_http_code:, resource: OMIT, request_query: 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
91 92 93 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 |
# File 'lib/vapi_server_sdk/types/log.rb', line 91 def initialize(time:, org_id:, type:, request_duration_seconds:, request_started_at:, request_finished_at:, request_body:, request_http_method:, request_url:, request_path:, response_http_code:, resource: OMIT, request_query: 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 @resource = resource if resource != OMIT @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 if request_query != OMIT @response_http_code = response_http_code @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, "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.
59 60 61 |
# File 'lib/vapi_server_sdk/types/log.rb', line 59 def additional_properties @additional_properties end |
#assistant_id ⇒ String (readonly)
Returns This is the ID of the assistant.
49 50 51 |
# File 'lib/vapi_server_sdk/types/log.rb', line 49 def assistant_id @assistant_id end |
#call_id ⇒ String (readonly)
Returns This is the ID of the call.
57 58 59 |
# File 'lib/vapi_server_sdk/types/log.rb', line 57 def call_id @call_id end |
#customer_id ⇒ String (readonly)
Returns This is the ID of the customer.
53 54 55 |
# File 'lib/vapi_server_sdk/types/log.rb', line 53 def customer_id @customer_id end |
#error ⇒ Vapi::Error (readonly)
Returns This is the error, if one occurred.
47 48 49 |
# File 'lib/vapi_server_sdk/types/log.rb', line 47 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.
51 52 53 |
# File 'lib/vapi_server_sdk/types/log.rb', line 51 def phone_number_id @phone_number_id end |
#request_body ⇒ Hash{String => Object} (readonly)
Returns This is the body of the request.
27 28 29 |
# File 'lib/vapi_server_sdk/types/log.rb', line 27 def request_body @request_body end |
#request_duration_seconds ⇒ Float (readonly)
Returns ‘This is how long the request took.
21 22 23 |
# File 'lib/vapi_server_sdk/types/log.rb', line 21 def request_duration_seconds @request_duration_seconds end |
#request_finished_at ⇒ String (readonly)
Returns This is the timestamp at which the request finished.
25 26 27 |
# File 'lib/vapi_server_sdk/types/log.rb', line 25 def request_finished_at @request_finished_at end |
#request_headers ⇒ Hash{String => Object} (readonly)
Returns These are the headers of the request.
45 46 47 |
# File 'lib/vapi_server_sdk/types/log.rb', line 45 def request_headers @request_headers end |
#request_http_method ⇒ Vapi::LogRequestHttpMethod (readonly)
Returns This is the request method.
29 30 31 |
# File 'lib/vapi_server_sdk/types/log.rb', line 29 def request_http_method @request_http_method end |
#request_ip_address ⇒ String (readonly)
Returns This is the request IP address.
39 40 41 |
# File 'lib/vapi_server_sdk/types/log.rb', line 39 def request_ip_address @request_ip_address end |
#request_origin ⇒ String (readonly)
Returns This is the origin of the request.
41 42 43 |
# File 'lib/vapi_server_sdk/types/log.rb', line 41 def request_origin @request_origin end |
#request_path ⇒ String (readonly)
Returns This is the request path.
33 34 35 |
# File 'lib/vapi_server_sdk/types/log.rb', line 33 def request_path @request_path end |
#request_query ⇒ String (readonly)
Returns This is the request query.
35 36 37 |
# File 'lib/vapi_server_sdk/types/log.rb', line 35 def request_query @request_query end |
#request_started_at ⇒ String (readonly)
Returns This is the timestamp at which the request began.
23 24 25 |
# File 'lib/vapi_server_sdk/types/log.rb', line 23 def request_started_at @request_started_at end |
#request_url ⇒ String (readonly)
Returns This is the request URL.
31 32 33 |
# File 'lib/vapi_server_sdk/types/log.rb', line 31 def request_url @request_url end |
#resource ⇒ Vapi::LogResource (readonly)
Returns This is the specific resource, relevant only to API logs.
19 20 21 |
# File 'lib/vapi_server_sdk/types/log.rb', line 19 def resource @resource end |
#response_body ⇒ Hash{String => Object} (readonly)
Returns This is the body of the response.
43 44 45 |
# File 'lib/vapi_server_sdk/types/log.rb', line 43 def response_body @response_body end |
#response_http_code ⇒ Float (readonly)
Returns This the HTTP status code of the response.
37 38 39 |
# File 'lib/vapi_server_sdk/types/log.rb', line 37 def response_http_code @response_http_code end |
#squad_id ⇒ String (readonly)
Returns This is the ID of the squad.
55 56 57 |
# File 'lib/vapi_server_sdk/types/log.rb', line 55 def squad_id @squad_id end |
#time ⇒ Float (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 |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Log
Deserialize a JSON object to an instance of Log
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 |
# File 'lib/vapi_server_sdk/types/log.rb', line 150 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"] 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, 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.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/vapi_server_sdk/types/log.rb', line 222 def self.validate_raw(obj:) obj.time.is_a?(Float) != 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.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
212 213 214 |
# File 'lib/vapi_server_sdk/types/log.rb', line 212 def to_json(*_args) @_field_set&.to_json end |