Class: Vapi::NodeArtifact
- Inherits:
-
Object
- Object
- Vapi::NodeArtifact
- Defined in:
- lib/vapi_server_sdk/types/node_artifact.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#messages ⇒ Array<Vapi::NodeArtifactMessagesItem>
readonly
These are the messages that were spoken during the node.
-
#node_name ⇒ String
readonly
This is the node name.
-
#variable_values ⇒ Hash{String => Object}
readonly
These are the variable values that were extracted from the node.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::NodeArtifact
Deserialize a JSON object to an instance of NodeArtifact.
-
.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(messages: OMIT, node_name: OMIT, variable_values: OMIT, additional_properties: nil) ⇒ Vapi::NodeArtifact constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of NodeArtifact to a JSON object.
Constructor Details
#initialize(messages: OMIT, node_name: OMIT, variable_values: OMIT, additional_properties: nil) ⇒ Vapi::NodeArtifact
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vapi_server_sdk/types/node_artifact.rb', line 28 def initialize(messages: OMIT, node_name: OMIT, variable_values: OMIT, additional_properties: nil) @messages = if != OMIT @node_name = node_name if node_name != OMIT @variable_values = variable_values if variable_values != OMIT @additional_properties = additional_properties @_field_set = { "messages": , "nodeName": node_name, "variableValues": variable_values }.reject do |_k, v| v == OMIT end 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/node_artifact.rb', line 16 def additional_properties @additional_properties end |
#messages ⇒ Array<Vapi::NodeArtifactMessagesItem> (readonly)
Returns These are the messages that were spoken during the node.
10 11 12 |
# File 'lib/vapi_server_sdk/types/node_artifact.rb', line 10 def @messages end |
#node_name ⇒ String (readonly)
Returns This is the node name.
12 13 14 |
# File 'lib/vapi_server_sdk/types/node_artifact.rb', line 12 def node_name @node_name end |
#variable_values ⇒ Hash{String => Object} (readonly)
Returns These are the variable values that were extracted from the node.
14 15 16 |
# File 'lib/vapi_server_sdk/types/node_artifact.rb', line 14 def variable_values @variable_values end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::NodeArtifact
Deserialize a JSON object to an instance of NodeArtifact
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vapi_server_sdk/types/node_artifact.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["messages"]&.map do |item| item = item.to_json Vapi::NodeArtifactMessagesItem.from_json(json_object: item) end node_name = parsed_json["nodeName"] variable_values = parsed_json["variableValues"] new( messages: , node_name: node_name, variable_values: variable_values, 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/node_artifact.rb', line 76 def self.validate_raw(obj:) obj.&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.node_name&.is_a?(String) != false || raise("Passed value for field obj.node_name is not the expected type, validation failed.") obj.variable_values&.is_a?(Hash) != false || raise("Passed value for field obj.variable_values is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of NodeArtifact to a JSON object
66 67 68 |
# File 'lib/vapi_server_sdk/types/node_artifact.rb', line 66 def to_json(*_args) @_field_set&.to_json end |