Class: Vapi::TransferFallbackPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, end_call_enabled: OMIT, additional_properties: nil) ⇒ Vapi::TransferFallbackPlan

Parameters:

  • message (Vapi::TransferFallbackPlanMessage)

    This is the message the assistant will deliver to the customer if the transfer fails.

  • end_call_enabled (Boolean) (defaults to: OMIT)

    This controls what happens after delivering the failure message to the customer.

    • true: End the call after delivering the failure message (default)

    • false: Keep the assistant on the call to continue handling the customer’s

    request @default true

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



35
36
37
38
39
40
41
42
# File 'lib/vapi_server_sdk/types/transfer_fallback_plan.rb', line 35

def initialize(message:, end_call_enabled: OMIT, additional_properties: nil)
  @message = message
  @end_call_enabled = end_call_enabled if end_call_enabled != OMIT
  @additional_properties = additional_properties
  @_field_set = { "message": message, "endCallEnabled": end_call_enabled }.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



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

def additional_properties
  @additional_properties
end

#end_call_enabledBoolean (readonly)

Returns This controls what happens after delivering the failure message to the customer.

  • true: End the call after delivering the failure message (default)

  • false: Keep the assistant on the call to continue handling the customer’s

request @default true.

Returns:

  • (Boolean)

    This controls what happens after delivering the failure message to the customer.

    • true: End the call after delivering the failure message (default)

    • false: Keep the assistant on the call to continue handling the customer’s

    request @default true



17
18
19
# File 'lib/vapi_server_sdk/types/transfer_fallback_plan.rb', line 17

def end_call_enabled
  @end_call_enabled
end

#messageVapi::TransferFallbackPlanMessage (readonly)

Returns This is the message the assistant will deliver to the customer if the transfer fails.

Returns:



11
12
13
# File 'lib/vapi_server_sdk/types/transfer_fallback_plan.rb', line 11

def message
  @message
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TransferFallbackPlan

Deserialize a JSON object to an instance of TransferFallbackPlan

Parameters:

  • json_object (String)

Returns:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vapi_server_sdk/types/transfer_fallback_plan.rb', line 48

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["message"].nil?
    message = nil
  else
    message = parsed_json["message"].to_json
    message = Vapi::TransferFallbackPlanMessage.from_json(json_object: message)
  end
  end_call_enabled = parsed_json["endCallEnabled"]
  new(
    message: message,
    end_call_enabled: end_call_enabled,
    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)


78
79
80
81
# File 'lib/vapi_server_sdk/types/transfer_fallback_plan.rb', line 78

def self.validate_raw(obj:)
  Vapi::TransferFallbackPlanMessage.validate_raw(obj: obj.message)
  obj.end_call_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.end_call_enabled is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TransferFallbackPlan to a JSON object

Returns:

  • (String)


68
69
70
# File 'lib/vapi_server_sdk/types/transfer_fallback_plan.rb', line 68

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