Class: Vapi::StepDestination
- Inherits:
-
Object
- Object
- Vapi::StepDestination
- Defined in:
- lib/vapi_server_sdk/types/step_destination.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#conditions ⇒ Array<Vapi::StepDestinationConditionsItem>
readonly
This is an optional array of conditions that must be met for this destination to be triggered.
- #step_name ⇒ String readonly
- #type ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::StepDestination
Deserialize a JSON object to an instance of StepDestination.
-
.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(type:, step_name:, conditions: OMIT, additional_properties: nil) ⇒ Vapi::StepDestination constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of StepDestination to a JSON object.
Constructor Details
#initialize(type:, step_name:, conditions: OMIT, additional_properties: nil) ⇒ Vapi::StepDestination
32 33 34 35 36 37 38 39 40 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 32 def initialize(type:, step_name:, conditions: OMIT, additional_properties: nil) @type = type @conditions = conditions if conditions != OMIT @step_name = step_name @additional_properties = additional_properties @_field_set = { "type": type, "conditions": conditions, "stepName": step_name }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 18 def additional_properties @additional_properties end |
#conditions ⇒ Array<Vapi::StepDestinationConditionsItem> (readonly)
Returns This is an optional array of conditions that must be met for this destination to be triggered. If empty, this is the default destination that the step transfers to.
14 15 16 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 14 def conditions @conditions end |
#step_name ⇒ String (readonly)
16 17 18 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 16 def step_name @step_name end |
#type ⇒ String (readonly)
10 11 12 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 10 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::StepDestination
Deserialize a JSON object to an instance of StepDestination
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) type = parsed_json["type"] conditions = parsed_json["conditions"]&.map do |item| item = item.to_json Vapi::StepDestinationConditionsItem.from_json(json_object: item) end step_name = parsed_json["stepName"] new( type: type, conditions: conditions, step_name: step_name, 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.
76 77 78 79 80 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 76 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.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") obj.step_name.is_a?(String) != false || raise("Passed value for field obj.step_name is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of StepDestination to a JSON object
66 67 68 |
# File 'lib/vapi_server_sdk/types/step_destination.rb', line 66 def to_json(*_args) @_field_set&.to_json end |