Class: Vapi::HangupNode
- Inherits:
-
Object
- Object
- Vapi::HangupNode
- Defined in:
- lib/vapi_server_sdk/types/hangup_node.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#is_start ⇒ Boolean
readonly
This is whether or not the node is the start of the workflow.
-
#metadata ⇒ Hash{String => Object}
readonly
This is for metadata you want to store on the task.
- #name ⇒ String readonly
- #type ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::HangupNode
Deserialize a JSON object to an instance of HangupNode.
-
.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:, name:, is_start: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vapi::HangupNode constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of HangupNode to a JSON object.
Constructor Details
#initialize(type:, name:, is_start: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vapi::HangupNode
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 30 def initialize(type:, name:, is_start: OMIT, metadata: OMIT, additional_properties: nil) @type = type @name = name @is_start = is_start if is_start != OMIT @metadata = if != OMIT @additional_properties = additional_properties @_field_set = { "type": type, "name": name, "isStart": is_start, "metadata": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 17 def additional_properties @additional_properties end |
#is_start ⇒ Boolean (readonly)
Returns This is whether or not the node is the start of the workflow.
13 14 15 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 13 def is_start @is_start end |
#metadata ⇒ Hash{String => Object} (readonly)
Returns This is for metadata you want to store on the task.
15 16 17 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 15 def @metadata end |
#name ⇒ String (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 11 def name @name end |
#type ⇒ String (readonly)
9 10 11 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 9 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::HangupNode
Deserialize a JSON object to an instance of HangupNode
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) type = parsed_json["type"] name = parsed_json["name"] is_start = parsed_json["isStart"] = parsed_json["metadata"] new( type: type, name: name, is_start: is_start, metadata: , 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.
74 75 76 77 78 79 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 74 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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.is_start&.is_a?(Boolean) != false || raise("Passed value for field obj.is_start is not the expected type, validation failed.") obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of HangupNode to a JSON object
64 65 66 |
# File 'lib/vapi_server_sdk/types/hangup_node.rb', line 64 def to_json(*_args) @_field_set&.to_json end |