Class: Vellum::RejectedExecuteWorkflowWorkflowResultEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb

Overview

specifying what went wrong.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, state:, ts:, error:, additional_properties: nil) ⇒ Vellum::RejectedExecuteWorkflowWorkflowResultEvent

Parameters:

  • id (String)
  • state (String)
  • ts (DateTime)
  • error (Vellum::WorkflowEventError)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



33
34
35
36
37
38
39
40
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 33

def initialize(id:, state:, ts:, error:, additional_properties: nil)
  @id = id
  @state = state
  @ts = ts
  @error = error
  @additional_properties = additional_properties
  @_field_set = { "id": id, "state": state, "ts": ts, "error": error }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 20

def additional_properties
  @additional_properties
end

#errorVellum::WorkflowEventError (readonly)



18
19
20
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 18

def error
  @error
end

#idString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 12

def id
  @id
end

#stateString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 14

def state
  @state
end

#tsDateTime (readonly)

Returns:

  • (DateTime)


16
17
18
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 16

def ts
  @ts
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::RejectedExecuteWorkflowWorkflowResultEvent

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  state = parsed_json["state"]
  ts = unless parsed_json["ts"].nil?
  DateTime.parse(parsed_json["ts"])
else
  nil
end
  unless parsed_json["error"].nil?
    error = parsed_json["error"].to_json
    error = Vellum::WorkflowEventError.from_json(json_object: error)
  else
    error = nil
  end
  new(
    id: id,
    state: state,
    ts: ts,
    error: error,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


83
84
85
86
87
88
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 83

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.state.is_a?(String) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
  obj.ts.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
  Vellum::WorkflowEventError.validate_raw(obj: obj.error)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


74
75
76
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 74

def to_json
  @_field_set&.to_json
end