Class: Vapi::VapiVoicemailDetectionPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(beep_max_await_seconds: OMIT, backoff_plan: OMIT, additional_properties: nil) ⇒ Vapi::VapiVoicemailDetectionPlan

Parameters:

  • beep_max_await_seconds (Float) (defaults to: OMIT)

    This is the maximum duration from the start of the call that we will wait for a voicemail beep, before speaking our message

    • If we detect a voicemail beep before this, we will speak the message at that

    point.

    • Setting too low a value means that the bot will start speaking its voicemail

    message too early. If it does so before the actual beep, it will get cut off. You should definitely tune this to your use case. @default 30 @min 0 @max 60

  • backoff_plan (Vapi::VoicemailDetectionBackoffPlan) (defaults to: OMIT)

    This is the backoff plan for the voicemail detection.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 43

def initialize(beep_max_await_seconds: OMIT, backoff_plan: OMIT, additional_properties: nil)
  @beep_max_await_seconds = beep_max_await_seconds if beep_max_await_seconds != OMIT
  @backoff_plan = backoff_plan if backoff_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = { "beepMaxAwaitSeconds": beep_max_await_seconds, "backoffPlan": backoff_plan }.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



23
24
25
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 23

def additional_properties
  @additional_properties
end

#backoff_planVapi::VoicemailDetectionBackoffPlan (readonly)

Returns This is the backoff plan for the voicemail detection.

Returns:



21
22
23
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 21

def backoff_plan
  @backoff_plan
end

#beep_max_await_secondsFloat (readonly)

Returns This is the maximum duration from the start of the call that we will wait for a voicemail beep, before speaking our message

  • If we detect a voicemail beep before this, we will speak the message at that

point.

  • Setting too low a value means that the bot will start speaking its voicemail

message too early. If it does so before the actual beep, it will get cut off. You should definitely tune this to your use case. @default 30 @min 0 @max 60.

Returns:

  • (Float)

    This is the maximum duration from the start of the call that we will wait for a voicemail beep, before speaking our message

    • If we detect a voicemail beep before this, we will speak the message at that

    point.

    • Setting too low a value means that the bot will start speaking its voicemail

    message too early. If it does so before the actual beep, it will get cut off. You should definitely tune this to your use case. @default 30 @min 0 @max 60



19
20
21
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 19

def beep_max_await_seconds
  @beep_max_await_seconds
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::VapiVoicemailDetectionPlan

Deserialize a JSON object to an instance of VapiVoicemailDetectionPlan

Parameters:

  • json_object (String)

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 56

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  beep_max_await_seconds = parsed_json["beepMaxAwaitSeconds"]
  if parsed_json["backoffPlan"].nil?
    backoff_plan = nil
  else
    backoff_plan = parsed_json["backoffPlan"].to_json
    backoff_plan = Vapi::VoicemailDetectionBackoffPlan.from_json(json_object: backoff_plan)
  end
  new(
    beep_max_await_seconds: beep_max_await_seconds,
    backoff_plan: backoff_plan,
    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)


86
87
88
89
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 86

def self.validate_raw(obj:)
  obj.beep_max_await_seconds&.is_a?(Float) != false || raise("Passed value for field obj.beep_max_await_seconds is not the expected type, validation failed.")
  obj.backoff_plan.nil? || Vapi::VoicemailDetectionBackoffPlan.validate_raw(obj: obj.backoff_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of VapiVoicemailDetectionPlan to a JSON object

Returns:

  • (String)


76
77
78
# File 'lib/vapi_server_sdk/types/vapi_voicemail_detection_plan.rb', line 76

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