Class: Vapi::WorkflowOverrides

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variable_values: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowOverrides

Parameters:

  • variable_values (Hash{String => Object}) (defaults to: OMIT)

    These are values that will be used to replace the template variables in the workflow messages and other text-based fields. This uses LiquidJS syntax. liquidjs.com/tutorials/intro-to-liquid.html So for example, ‘name }` will be replaced with the value of `name` in `variableValues`. `| date: “%b %d, %Y, %I:%M %p”, “America/New_York”}` will be replaced with the current date and time in New York. Some VAPI reserved defaults:

    • customer - the customer object

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
# File 'lib/vapi_server_sdk/types/workflow_overrides.rb', line 37

def initialize(variable_values: OMIT, additional_properties: nil)
  @variable_values = variable_values if variable_values != OMIT
  @additional_properties = additional_properties
  @_field_set = { "variableValues": variable_values }.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/workflow_overrides.rb', line 19

def additional_properties
  @additional_properties
end

#variable_valuesHash{String => Object} (readonly)

Returns These are values that will be used to replace the template variables in the workflow messages and other text-based fields. This uses LiquidJS syntax. liquidjs.com/tutorials/intro-to-liquid.html So for example, ‘name }` will be replaced with the value of `name` in `variableValues`. `| date: “%b %d, %Y, %I:%M %p”, “America/New_York”}` will be replaced with the current date and time in New York. Some VAPI reserved defaults:

  • customer - the customer object.

Returns:

  • (Hash{String => Object})

    These are values that will be used to replace the template variables in the workflow messages and other text-based fields. This uses LiquidJS syntax. liquidjs.com/tutorials/intro-to-liquid.html So for example, ‘name }` will be replaced with the value of `name` in `variableValues`. `| date: “%b %d, %Y, %I:%M %p”, “America/New_York”}` will be replaced with the current date and time in New York. Some VAPI reserved defaults:

    • customer - the customer object



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

def variable_values
  @variable_values
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::WorkflowOverrides

Deserialize a JSON object to an instance of WorkflowOverrides

Parameters:

  • json_object (String)

Returns:



49
50
51
52
53
54
# File 'lib/vapi_server_sdk/types/workflow_overrides.rb', line 49

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


69
70
71
# File 'lib/vapi_server_sdk/types/workflow_overrides.rb', line 69

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of WorkflowOverrides to a JSON object

Returns:

  • (String)


59
60
61
# File 'lib/vapi_server_sdk/types/workflow_overrides.rb', line 59

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