Class: Vellum::VellumValueLogicalConditionRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/vellum_value_logical_condition_request.rb

Overview

A basic condition comparing two Vellum values.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, lhs_variable:, operator:, rhs_variable:, additional_properties: nil) ⇒ Vellum::VellumValueLogicalConditionRequest

Parameters:



32
33
34
35
36
37
38
39
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 32

def initialize(type:, lhs_variable:, operator:, rhs_variable:, additional_properties: nil)
  @type = type
  @lhs_variable = lhs_variable
  @operator = operator
  @rhs_variable = rhs_variable
  @additional_properties = additional_properties
  @_field_set = { "type": type, "lhs_variable": lhs_variable, "operator": operator, "rhs_variable": rhs_variable }
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/vellum_ai/types/vellum_value_logical_condition_request.rb', line 19

def additional_properties
  @additional_properties
end

#lhs_variableVellum::VellumValueRequest (readonly)



13
14
15
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 13

def lhs_variable
  @lhs_variable
end

#operatorVellum::LogicalOperator (readonly)



15
16
17
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 15

def operator
  @operator
end

#rhs_variableVellum::VellumValueRequest (readonly)



17
18
19
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 17

def rhs_variable
  @rhs_variable
end

#typeString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 11

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::VellumValueLogicalConditionRequest

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  unless parsed_json["lhs_variable"].nil?
    lhs_variable = parsed_json["lhs_variable"].to_json
    lhs_variable = Vellum::VellumValueRequest.from_json(json_object: lhs_variable)
  else
    lhs_variable = nil
  end
  operator = parsed_json["operator"]
  unless parsed_json["rhs_variable"].nil?
    rhs_variable = parsed_json["rhs_variable"].to_json
    rhs_variable = Vellum::VellumValueRequest.from_json(json_object: rhs_variable)
  else
    rhs_variable = nil
  end
  new(
    type: type,
    lhs_variable: lhs_variable,
    operator: operator,
    rhs_variable: rhs_variable,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


81
82
83
84
85
86
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 81

def self.validate_raw(obj:)
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  Vellum::VellumValueRequest.validate_raw(obj: obj.lhs_variable)
  obj.operator.is_a?(Vellum::LogicalOperator) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.")
  Vellum::VellumValueRequest.validate_raw(obj: obj.rhs_variable)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


72
73
74
# File 'lib/vellum_ai/types/vellum_value_logical_condition_request.rb', line 72

def to_json
  @_field_set&.to_json
end