Class: Vapi::CreateWorkflowDto

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/create_workflow_dto.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, nodes:, name:, edges:, additional_properties: nil) ⇒ Vapi::CreateWorkflowDto

Parameters:

  • type (String)
  • nodes (Array<Vapi::CreateWorkflowDtoNodesItem>)
  • name (String)
  • edges (Array<Vapi::Edge>)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
39
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 32

def initialize(type:, nodes:, name:, edges:, additional_properties: nil)
  @type = type
  @nodes = nodes
  @name = name
  @edges = edges
  @additional_properties = additional_properties
  @_field_set = { "type": type, "nodes": nodes, "name": name, "edges": edges }
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



19
20
21
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 19

def additional_properties
  @additional_properties
end

#edges ⇒ Array<Vapi::Edge> (readonly)

Returns:



17
18
19
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 17

def edges
  @edges
end

#name ⇒ String (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 15

def name
  @name
end

#nodes ⇒ Array<Vapi::CreateWorkflowDtoNodesItem> (readonly)



13
14
15
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 13

def nodes
  @nodes
end

#type ⇒ String (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 11

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateWorkflowDto

Deserialize a JSON object to an instance of CreateWorkflowDto

Parameters:

  • json_object (String)

Returns:



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/create_workflow_dto.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"]
  nodes = parsed_json["nodes"]&.map do |item|
    item = item.to_json
    Vapi::CreateWorkflowDtoNodesItem.from_json(json_object: item)
  end
  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,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


80
81
82
83
84
85
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 80

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.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 CreateWorkflowDto to a JSON object

Returns:

  • (String)


70
71
72
# File 'lib/vapi_server_sdk/types/create_workflow_dto.rb', line 70

def to_json(*_args)
  @_field_set&.to_json
end