Class: Vapi::TargetPlan
- Inherits:
-
Object
- Object
- Vapi::TargetPlan
- Defined in:
- lib/vapi_server_sdk/types/target_plan.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 assistant being tested.
-
#assistant_overrides ⇒ Vapi::AssistantOverrides
readonly
This is the assistant overrides applied to assistantId before it is tested.
-
#phone_number ⇒ Vapi::TestSuitePhoneNumber
readonly
This can be any phone number (even not on Vapi).
-
#phone_number_id ⇒ String
readonly
This is the phone number that is being tested.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TargetPlan
Deserialize a JSON object to an instance of TargetPlan.
-
.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(phone_number_id: OMIT, phone_number: OMIT, assistant_id: OMIT, assistant_overrides: OMIT, additional_properties: nil) ⇒ Vapi::TargetPlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TargetPlan to a JSON object.
Constructor Details
#initialize(phone_number_id: OMIT, phone_number: OMIT, assistant_id: OMIT, assistant_overrides: OMIT, additional_properties: nil) ⇒ Vapi::TargetPlan
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 48 def initialize(phone_number_id: OMIT, phone_number: OMIT, assistant_id: OMIT, assistant_overrides: OMIT, additional_properties: nil) @phone_number_id = phone_number_id if phone_number_id != OMIT @phone_number = phone_number if phone_number != OMIT @assistant_id = assistant_id if assistant_id != OMIT @assistant_overrides = assistant_overrides if assistant_overrides != OMIT @additional_properties = additional_properties @_field_set = { "phoneNumberId": phone_number_id, "phoneNumber": phone_number, "assistantId": assistant_id, "assistantOverrides": assistant_overrides }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
27 28 29 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 27 def additional_properties @additional_properties end |
#assistant_id ⇒ String (readonly)
Returns This is the assistant being tested. During the actual test, it’ll invoked directly. To test the assistant over phone number, send phoneNumberId instead.
23 24 25 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 23 def assistant_id @assistant_id end |
#assistant_overrides ⇒ Vapi::AssistantOverrides (readonly)
Returns This is the assistant overrides applied to assistantId before it is tested.
25 26 27 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 25 def assistant_overrides @assistant_overrides end |
#phone_number ⇒ Vapi::TestSuitePhoneNumber (readonly)
Returns This can be any phone number (even not on Vapi). During the actual test, it’ll be called. To test a Vapi number, send phoneNumberId. To test an assistant directly, send assistantId instead.
19 20 21 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 19 def phone_number @phone_number end |
#phone_number_id ⇒ String (readonly)
Returns This is the phone number that is being tested. During the actual test, it’ll be called and the assistant attached to it will pick up and be tested. To test an assistant directly, send assistantId instead.
14 15 16 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 14 def phone_number_id @phone_number_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TargetPlan
Deserialize a JSON object to an instance of TargetPlan
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 69 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) phone_number_id = parsed_json["phoneNumberId"] if parsed_json["phoneNumber"].nil? phone_number = nil else phone_number = parsed_json["phoneNumber"].to_json phone_number = Vapi::TestSuitePhoneNumber.from_json(json_object: phone_number) end assistant_id = parsed_json["assistantId"] if parsed_json["assistantOverrides"].nil? assistant_overrides = nil else assistant_overrides = parsed_json["assistantOverrides"].to_json assistant_overrides = Vapi::AssistantOverrides.from_json(json_object: assistant_overrides) end new( phone_number_id: phone_number_id, phone_number: phone_number, assistant_id: assistant_id, assistant_overrides: assistant_overrides, 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.
108 109 110 111 112 113 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 108 def self.validate_raw(obj:) 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.phone_number.nil? || Vapi::TestSuitePhoneNumber.validate_raw(obj: obj.phone_number) obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.assistant_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.assistant_overrides) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TargetPlan to a JSON object
98 99 100 |
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 98 def to_json(*_args) @_field_set&.to_json end |