Class: Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
- Inherits:
-
Object
- Object
- Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
- Defined in:
- lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb
Instance Attribute Summary collapse
- #discriminant ⇒ String readonly
- #member ⇒ Object readonly
Class Method Summary collapse
- .chat(member:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
-
.from_json(json_object:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
Deserialize a JSON object to an instance of TestSuiteTestControllerRemoveResponse.
-
.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.
- .voice(member:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
Instance Method Summary collapse
- #initialize(member:, discriminant:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse constructor
-
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
- #kind_of? ⇒ Object
-
#to_json(*_args) ⇒ String
For Union Types, to_json functionality is delegated to the wrapped member.
Constructor Details
#initialize(member:, discriminant:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
21 22 23 24 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 21 def initialize(member:, discriminant:) @member = member @discriminant = discriminant end |
Instance Attribute Details
#discriminant ⇒ String (readonly)
13 14 15 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 13 def discriminant @discriminant end |
#member ⇒ Object (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 11 def member @member end |
Class Method Details
.chat(member:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
92 93 94 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 92 def self.chat(member:) new(member: member, discriminant: "chat") end |
.from_json(json_object:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
Deserialize a JSON object to an instance of
TestSuiteTestControllerRemoveResponse
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 31 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.type when "voice" Vapi::TestSuiteTestVoice.from_json(json_object: json_object) when "chat" Vapi::TestSuiteTestChat.from_json(json_object: json_object) else Vapi::TestSuiteTestVoice.from_json(json_object: json_object) end new(member: member, discriminant: struct.type) 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.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 65 def self.validate_raw(obj:) case obj.type when "voice" Vapi::TestSuiteTestVoice.validate_raw(obj: obj) when "chat" Vapi::TestSuiteTestChat.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end end |
.voice(member:) ⇒ Vapi::TestSuiteTests::TestSuiteTestControllerRemoveResponse
86 87 88 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 86 def self.voice(member:) new(member: member, discriminant: "voice") end |
Instance Method Details
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
80 81 82 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 80 def is_a?(obj) @member.is_a?(obj) end |
#kind_of? ⇒ Object
16 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 16 alias kind_of? is_a? |
#to_json(*_args) ⇒ String
For Union Types, to_json functionality is delegated to the wrapped member.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb', line 47 def to_json(*_args) case @discriminant when "voice" { **@member.to_json, type: @discriminant }.to_json when "chat" { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @member.to_json end |