Class: Vapi::Workflow
- Inherits:
-
Object
- Object
- Vapi::Workflow
- Defined in:
- lib/vapi_server_sdk/types/workflow.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #created_at ⇒ DateTime readonly
- #edges ⇒ Array<Vapi::Edge> readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #nodes ⇒ Array<Vapi::WorkflowNodesItem> readonly
- #org_id ⇒ String readonly
- #type ⇒ String readonly
- #updated_at ⇒ DateTime readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Workflow
Deserialize a JSON object to an instance of Workflow.
-
.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:, nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, additional_properties: nil) ⇒ Vapi::Workflow constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Workflow to a JSON object.
Constructor Details
#initialize(type:, nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, additional_properties: nil) ⇒ Vapi::Workflow
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 45 def initialize(type:, nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, additional_properties: nil) @type = type @nodes = nodes @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at @name = name @edges = edges @additional_properties = additional_properties @_field_set = { "type": type, "nodes": nodes, "id": id, "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, "name": name, "edges": edges } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
28 29 30 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 28 def additional_properties @additional_properties end |
#created_at ⇒ DateTime (readonly)
20 21 22 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 20 def created_at @created_at end |
#edges ⇒ Array<Vapi::Edge> (readonly)
26 27 28 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 26 def edges @edges end |
#id ⇒ String (readonly)
16 17 18 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 16 def id @id end |
#name ⇒ String (readonly)
24 25 26 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 24 def name @name end |
#nodes ⇒ Array<Vapi::WorkflowNodesItem> (readonly)
14 15 16 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 14 def nodes @nodes end |
#org_id ⇒ String (readonly)
18 19 20 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 18 def org_id @org_id end |
#type ⇒ String (readonly)
12 13 14 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 12 def type @type end |
#updated_at ⇒ DateTime (readonly)
22 23 24 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 22 def updated_at @updated_at end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Workflow
Deserialize a JSON object to an instance of Workflow
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 71 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) type = parsed_json["type"] nodes = parsed_json["nodes"]&.map do |item| item = item.to_json Vapi::WorkflowNodesItem.from_json(json_object: item) end id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) name = parsed_json["name"] edges = parsed_json["edges"]&.map do |item| item = item.to_json Vapi::Edge.from_json(json_object: item) end new( type: type, nodes: nodes, id: id, org_id: org_id, created_at: created_at, updated_at: updated_at, name: name, edges: edges, 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.
114 115 116 117 118 119 120 121 122 123 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 114 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.nodes.is_a?(Array) != false || raise("Passed value for field obj.nodes is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at 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.edges.is_a?(Array) != false || raise("Passed value for field obj.edges is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Workflow to a JSON object
104 105 106 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 104 def to_json(*_args) @_field_set&.to_json end |