Class: Vapi::CallBatchError
- Inherits:
-
Object
- Object
- Vapi::CallBatchError
- Defined in:
- lib/vapi_server_sdk/types/call_batch_error.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #customer ⇒ Vapi::CreateCustomerDto readonly
- #error ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CallBatchError
Deserialize a JSON object to an instance of CallBatchError.
-
.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(customer:, error:, additional_properties: nil) ⇒ Vapi::CallBatchError constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CallBatchError to a JSON object.
Constructor Details
#initialize(customer:, error:, additional_properties: nil) ⇒ Vapi::CallBatchError
25 26 27 28 29 30 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 25 def initialize(customer:, error:, additional_properties: nil) @customer = customer @error = error @additional_properties = additional_properties @_field_set = { "customer": customer, "error": error } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
14 15 16 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 14 def additional_properties @additional_properties end |
#customer ⇒ Vapi::CreateCustomerDto (readonly)
10 11 12 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 10 def customer @customer end |
#error ⇒ String (readonly)
12 13 14 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 12 def error @error end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CallBatchError
Deserialize a JSON object to an instance of CallBatchError
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["customer"].nil? customer = nil else customer = parsed_json["customer"].to_json customer = Vapi::CreateCustomerDto.from_json(json_object: customer) end error = parsed_json["error"] new( customer: customer, error: error, 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.
66 67 68 69 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 66 def self.validate_raw(obj:) Vapi::CreateCustomerDto.validate_raw(obj: obj.customer) obj.error.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CallBatchError to a JSON object
56 57 58 |
# File 'lib/vapi_server_sdk/types/call_batch_error.rb', line 56 def to_json(*_args) @_field_set&.to_json end |