Class: Vapi::Condition
- Inherits:
-
Object
- Object
- Vapi::Condition
- Defined in:
- lib/vapi_server_sdk/types/condition.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#operator ⇒ Vapi::ConditionOperator
readonly
This is the operator you want to use to compare the parameter and value.
-
#param ⇒ String
readonly
This is the name of the parameter that you want to check.
-
#value ⇒ String
readonly
This is the value you want to compare against the parameter.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Condition
Deserialize a JSON object to an instance of Condition.
-
.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.
Instance Method Summary collapse
- #initialize(value:, operator:, param:, additional_properties: nil) ⇒ Vapi::Condition constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Condition to a JSON object.
Constructor Details
#initialize(value:, operator:, param:, additional_properties: nil) ⇒ Vapi::Condition
28 29 30 31 32 33 34 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 28 def initialize(value:, operator:, param:, additional_properties: nil) @value = value @operator = operator @param = param @additional_properties = additional_properties @_field_set = { "value": value, "operator": operator, "param": param } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 16 def additional_properties @additional_properties end |
#operator ⇒ Vapi::ConditionOperator (readonly)
Returns This is the operator you want to use to compare the parameter and value.
12 13 14 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 12 def operator @operator end |
#param ⇒ String (readonly)
Returns This is the name of the parameter that you want to check.
14 15 16 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 14 def param @param end |
#value ⇒ String (readonly)
Returns This is the value you want to compare against the parameter.
10 11 12 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 10 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Condition
Deserialize a JSON object to an instance of Condition
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) value = parsed_json["value"] operator = parsed_json["operator"] param = parsed_json["param"] new( value: value, operator: operator, param: param, 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.
67 68 69 70 71 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 67 def self.validate_raw(obj:) obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.operator.is_a?(Vapi::ConditionOperator) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.") obj.param.is_a?(String) != false || raise("Passed value for field obj.param is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Condition to a JSON object
57 58 59 |
# File 'lib/vapi_server_sdk/types/condition.rb', line 57 def to_json(*_args) @_field_set&.to_json end |