Class: Vapi::RuleBasedCondition

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operator:, left_side:, right_side:, additional_properties: nil) ⇒ Vapi::RuleBasedCondition

Parameters:

  • operator (Vapi::RuleBasedConditionOperator)

    This is the operator you want to use to compare the left side and right side. The operation becomes ‘(leftSide) operator (rightSide)`.

  • left_side (String)

    This is the left side of the operation. You can reference any variable in the context of the current block execution (step):

    • “Vapi::RuleBasedCondition.{output{output.your-property-name}” for current step’s output

    • “Vapi::RuleBasedCondition.{input{input.your-property-name}” for current step’s input

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in

    the same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the

    same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input

    • “Vapi::RuleBasedCondition.{global{global.your-property-name}” for the global context

    Or, you can use a constant:

    • “1”

    • “text”

    • “true”

    • “false”

    Or, you can mix and match with string interpolation:

    • “{your-property-name}-Vapi::RuleBasedCondition.{input{input.your-property-name-2}-1”

    Caveats:

    1. a workflow can execute a step multiple times. example, if a loop is used in

    the graph. Vapi::RuleBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.

    1. a workflow can execute a block multiple times. example, if a step is called

    multiple times or if a block is used in multiple steps. Vapi::RuleBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.

  • right_side (String)

    This is the right side of the operation. You can reference any variable in the context of the current block execution (step):

    • “Vapi::RuleBasedCondition.{output{output.your-property-name}” for current step’s output

    • “Vapi::RuleBasedCondition.{input{input.your-property-name}” for current step’s input

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in

    the same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the

    same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input

    • “Vapi::RuleBasedCondition.{global{global.your-property-name}” for the global context

    Or, you can use a constant:

    • “1”

    • “text”

    • “true”

    • “false”

    Or, you can mix and match with string interpolation:

    • “{your-property-name}-Vapi::RuleBasedCondition.{input{input.your-property-name-2}-1”

    Caveats:

    1. a workflow can execute a step multiple times. example, if a loop is used in

    the graph. Vapi::RuleBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.

    1. a workflow can execute a block multiple times. example, if a step is called

    multiple times or if a block is used in multiple steps. Vapi::RuleBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



150
151
152
153
154
155
156
# File 'lib/vapi_server_sdk/types/rule_based_condition.rb', line 150

def initialize(operator:, left_side:, right_side:, additional_properties: nil)
  @operator = operator
  @left_side = left_side
  @right_side = right_side
  @additional_properties = additional_properties
  @_field_set = { "operator": operator, "leftSide": left_side, "rightSide": right_side }
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



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

def additional_properties
  @additional_properties
end

#left_sideString (readonly)

Returns This is the left side of the operation. You can reference any variable in the context of the current block execution (step):

  • “Vapi::RuleBasedCondition.{output{output.your-property-name}” for current step’s output

  • “Vapi::RuleBasedCondition.{input{input.your-property-name}” for current step’s input

  • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in

the same workflow; read caveat #1)

  • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the

same workflow; read caveat #1)

  • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in

the same workflow; read caveat #2)

  • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in

the same workflow; read caveat #2)

  • “Vapi::RuleBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input

  • “Vapi::RuleBasedCondition.{global{global.your-property-name}” for the global context

Or, you can use a constant:

  • “1”

  • “text”

  • “true”

  • “false”

Or, you can mix and match with string interpolation:

  • “{your-property-name}-Vapi::RuleBasedCondition.{input{input.your-property-name-2}-1”

Caveats:

  1. a workflow can execute a step multiple times. example, if a loop is used in

the graph. Vapi::RuleBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.

  1. a workflow can execute a block multiple times. example, if a step is called

multiple times or if a block is used in multiple steps. Vapi::RuleBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.

Returns:

  • (String)

    This is the left side of the operation. You can reference any variable in the context of the current block execution (step):

    • “Vapi::RuleBasedCondition.{output{output.your-property-name}” for current step’s output

    • “Vapi::RuleBasedCondition.{input{input.your-property-name}” for current step’s input

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in

    the same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the

    same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input

    • “Vapi::RuleBasedCondition.{global{global.your-property-name}” for the global context

    Or, you can use a constant:

    • “1”

    • “text”

    • “true”

    • “false”

    Or, you can mix and match with string interpolation:

    • “{your-property-name}-Vapi::RuleBasedCondition.{input{input.your-property-name-2}-1”

    Caveats:

    1. a workflow can execute a step multiple times. example, if a loop is used in

    the graph. Vapi::RuleBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.

    1. a workflow can execute a block multiple times. example, if a step is called

    multiple times or if a block is used in multiple steps. Vapi::RuleBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.



43
44
45
# File 'lib/vapi_server_sdk/types/rule_based_condition.rb', line 43

def left_side
  @left_side
end

#operatorVapi::RuleBasedConditionOperator (readonly)

Returns This is the operator you want to use to compare the left side and right side. The operation becomes ‘(leftSide) operator (rightSide)`.

Returns:

  • (Vapi::RuleBasedConditionOperator)

    This is the operator you want to use to compare the left side and right side. The operation becomes ‘(leftSide) operator (rightSide)`.



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

def operator
  @operator
end

#right_sideString (readonly)

Returns This is the right side of the operation. You can reference any variable in the context of the current block execution (step):

  • “Vapi::RuleBasedCondition.{output{output.your-property-name}” for current step’s output

  • “Vapi::RuleBasedCondition.{input{input.your-property-name}” for current step’s input

  • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in

the same workflow; read caveat #1)

  • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the

same workflow; read caveat #1)

  • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in

the same workflow; read caveat #2)

  • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in

the same workflow; read caveat #2)

  • “Vapi::RuleBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input

  • “Vapi::RuleBasedCondition.{global{global.your-property-name}” for the global context

Or, you can use a constant:

  • “1”

  • “text”

  • “true”

  • “false”

Or, you can mix and match with string interpolation:

  • “{your-property-name}-Vapi::RuleBasedCondition.{input{input.your-property-name-2}-1”

Caveats:

  1. a workflow can execute a step multiple times. example, if a loop is used in

the graph. Vapi::RuleBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.

  1. a workflow can execute a block multiple times. example, if a step is called

multiple times or if a block is used in multiple steps. Vapi::RuleBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.

Returns:

  • (String)

    This is the right side of the operation. You can reference any variable in the context of the current block execution (step):

    • “Vapi::RuleBasedCondition.{output{output.your-property-name}” for current step’s output

    • “Vapi::RuleBasedCondition.{input{input.your-property-name}” for current step’s input

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in

    the same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the

    same workflow; read caveat #1)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in

    the same workflow; read caveat #2)

    • “Vapi::RuleBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input

    • “Vapi::RuleBasedCondition.{global{global.your-property-name}” for the global context

    Or, you can use a constant:

    • “1”

    • “text”

    • “true”

    • “false”

    Or, you can mix and match with string interpolation:

    • “{your-property-name}-Vapi::RuleBasedCondition.{input{input.your-property-name-2}-1”

    Caveats:

    1. a workflow can execute a step multiple times. example, if a loop is used in

    the graph. Vapi::RuleBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.

    1. a workflow can execute a block multiple times. example, if a step is called

    multiple times or if a block is used in multiple steps. Vapi::RuleBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.



75
76
77
# File 'lib/vapi_server_sdk/types/rule_based_condition.rb', line 75

def right_side
  @right_side
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::RuleBasedCondition

Deserialize a JSON object to an instance of RuleBasedCondition

Parameters:

  • json_object (String)

Returns:



162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/vapi_server_sdk/types/rule_based_condition.rb', line 162

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


189
190
191
192
193
# File 'lib/vapi_server_sdk/types/rule_based_condition.rb', line 189

def self.validate_raw(obj:)
  obj.operator.is_a?(Vapi::RuleBasedConditionOperator) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.")
  obj.left_side.is_a?(String) != false || raise("Passed value for field obj.left_side is not the expected type, validation failed.")
  obj.right_side.is_a?(String) != false || raise("Passed value for field obj.right_side is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RuleBasedCondition to a JSON object

Returns:

  • (String)


179
180
181
# File 'lib/vapi_server_sdk/types/rule_based_condition.rb', line 179

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