Class: Vapi::TargetPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/target_plan.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone_number_id: OMIT, phone_number: OMIT, assistant_id: OMIT, assistant_overrides: OMIT, additional_properties: nil) ⇒ Vapi::TargetPlan

Parameters:

  • phone_number_id (String) (defaults to: OMIT)

    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.

  • phone_number (Vapi::TestSuitePhoneNumber) (defaults to: OMIT)

    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.

  • assistant_id (String) (defaults to: OMIT)

    This is the assistant being tested. During the actual test, it’ll invoked directly. To test the assistant over phone number, send phoneNumberId instead.

  • assistant_overrides (Vapi::AssistantOverrides) (defaults to: OMIT)

    This is the assistant overrides applied to assistantId before it is tested.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_idString (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.

Returns:

  • (String)

    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_overridesVapi::AssistantOverrides (readonly)

Returns This is the assistant overrides applied to assistantId before it is tested.

Returns:



25
26
27
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 25

def assistant_overrides
  @assistant_overrides
end

#phone_numberVapi::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.

Returns:

  • (Vapi::TestSuitePhoneNumber)

    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_idString (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.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


98
99
100
# File 'lib/vapi_server_sdk/types/target_plan.rb', line 98

def to_json(*_args)
  @_field_set&.to_json
end