Class: Vapi::KeypadInputPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled: OMIT, timeout_seconds: OMIT, delimiters: OMIT, additional_properties: nil) ⇒ Vapi::KeypadInputPlan

Parameters:

  • enabled (Boolean) (defaults to: OMIT)

    This keeps track of whether the user has enabled keypad input. By default, it is off. @default false

  • timeout_seconds (Float) (defaults to: OMIT)

    This is the time in seconds to wait before processing the input. If the input is not received within this time, the input will be ignored. If set to “off”, the input will be processed when the user enters a delimiter or immediately if no delimiter is used. @default 2

  • delimiters (Vapi::KeypadInputPlanDelimiters) (defaults to: OMIT)

    This is the delimiter(s) that will be used to process the input. Can be ‘#’, ‘*’, or an empty array.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/vapi_server_sdk/types/keypad_input_plan.rb', line 42

def initialize(enabled: OMIT, timeout_seconds: OMIT, delimiters: OMIT, additional_properties: nil)
  @enabled = enabled if enabled != OMIT
  @timeout_seconds = timeout_seconds if timeout_seconds != OMIT
  @delimiters = delimiters if delimiters != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "enabled": enabled,
    "timeoutSeconds": timeout_seconds,
    "delimiters": delimiters
  }.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/keypad_input_plan.rb', line 23

def additional_properties
  @additional_properties
end

#delimitersVapi::KeypadInputPlanDelimiters (readonly)

Returns This is the delimiter(s) that will be used to process the input. Can be ‘#’, ‘*’, or an empty array.

Returns:



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

def delimiters
  @delimiters
end

#enabledBoolean (readonly)

Returns This keeps track of whether the user has enabled keypad input. By default, it is off. @default false.

Returns:

  • (Boolean)

    This keeps track of whether the user has enabled keypad input. By default, it is off. @default false



12
13
14
# File 'lib/vapi_server_sdk/types/keypad_input_plan.rb', line 12

def enabled
  @enabled
end

#timeout_secondsFloat (readonly)

Returns This is the time in seconds to wait before processing the input. If the input is not received within this time, the input will be ignored. If set to “off”, the input will be processed when the user enters a delimiter or immediately if no delimiter is used. @default 2.

Returns:

  • (Float)

    This is the time in seconds to wait before processing the input. If the input is not received within this time, the input will be ignored. If set to “off”, the input will be processed when the user enters a delimiter or immediately if no delimiter is used. @default 2



18
19
20
# File 'lib/vapi_server_sdk/types/keypad_input_plan.rb', line 18

def timeout_seconds
  @timeout_seconds
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::KeypadInputPlan

Deserialize a JSON object to an instance of KeypadInputPlan

Parameters:

  • json_object (String)

Returns:



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vapi_server_sdk/types/keypad_input_plan.rb', line 60

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  enabled = parsed_json["enabled"]
  timeout_seconds = parsed_json["timeoutSeconds"]
  delimiters = parsed_json["delimiters"]
  new(
    enabled: enabled,
    timeout_seconds: timeout_seconds,
    delimiters: delimiters,
    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)


87
88
89
90
91
# File 'lib/vapi_server_sdk/types/keypad_input_plan.rb', line 87

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of KeypadInputPlan to a JSON object

Returns:

  • (String)


77
78
79
# File 'lib/vapi_server_sdk/types/keypad_input_plan.rb', line 77

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