Class: Vapi::ResponseErrorEvent
- Inherits:
-
Object
- Object
- Vapi::ResponseErrorEvent
- Defined in:
- lib/vapi_server_sdk/types/response_error_event.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#code ⇒ String
readonly
Error code.
-
#message ⇒ String
readonly
Error message.
-
#param ⇒ String
readonly
Parameter that caused the error.
-
#sequence_number ⇒ Float
readonly
Sequence number of the event.
-
#type ⇒ String
readonly
Event type.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ResponseErrorEvent
Deserialize a JSON object to an instance of ResponseErrorEvent.
-
.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(type:, code:, message:, sequence_number:, param: OMIT, additional_properties: nil) ⇒ Vapi::ResponseErrorEvent constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ResponseErrorEvent to a JSON object.
Constructor Details
#initialize(type:, code:, message:, sequence_number:, param: OMIT, additional_properties: nil) ⇒ Vapi::ResponseErrorEvent
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 33 def initialize(type:, code:, message:, sequence_number:, param: OMIT, additional_properties: nil) @type = type @code = code @message = @param = param if param != OMIT @sequence_number = sequence_number @additional_properties = additional_properties @_field_set = { "type": type, "code": code, "message": , "param": param, "sequence_number": sequence_number }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 19 def additional_properties @additional_properties end |
#code ⇒ String (readonly)
Returns Error code.
11 12 13 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 11 def code @code end |
#message ⇒ String (readonly)
Returns Error message.
13 14 15 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 13 def @message end |
#param ⇒ String (readonly)
Returns Parameter that caused the error.
15 16 17 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 15 def param @param end |
#sequence_number ⇒ Float (readonly)
Returns Sequence number of the event.
17 18 19 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 17 def sequence_number @sequence_number end |
#type ⇒ String (readonly)
Returns Event type.
9 10 11 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 9 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ResponseErrorEvent
Deserialize a JSON object to an instance of ResponseErrorEvent
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 55 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) type = parsed_json["type"] code = parsed_json["code"] = parsed_json["message"] param = parsed_json["param"] sequence_number = parsed_json["sequence_number"] new( type: type, code: code, message: , param: param, sequence_number: sequence_number, 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.
86 87 88 89 90 91 92 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 86 def self.validate_raw(obj:) obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.code.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.") obj..is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") obj.param&.is_a?(String) != false || raise("Passed value for field obj.param is not the expected type, validation failed.") obj.sequence_number.is_a?(Float) != false || raise("Passed value for field obj.sequence_number is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ResponseErrorEvent to a JSON object
76 77 78 |
# File 'lib/vapi_server_sdk/types/response_error_event.rb', line 76 def to_json(*_args) @_field_set&.to_json end |