Class: Vellum::RejectedExecuteWorkflowWorkflowResultEvent

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

Overview

The unsuccessful response from the Workflow execution containing an error specifying what went wrong.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:

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

    Additional properties unmapped to the current class definition



17
18
19
20
21
22
23
24
25
26
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 17

def initialize(id:, ts:, error:, additional_properties: nil)
  # @type [String]
  @id = id
  # @type [DateTime]
  @ts = ts
  # @type [WorkflowEventError]
  @error = error
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



10
11
12
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 10

def additional_properties
  @additional_properties
end

#errorObject (readonly)

Returns the value of attribute error.



10
11
12
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 10

def error
  @error
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 10

def id
  @id
end

#tsObject (readonly)

Returns the value of attribute ts.



10
11
12
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 10

def ts
  @ts
end

Class Method Details

.from_json(json_object:) ⇒ RejectedExecuteWorkflowWorkflowResultEvent

Deserialize a JSON object to an instance of RejectedExecuteWorkflowWorkflowResultEvent

Parameters:

  • json_object (JSON)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = struct.id
  ts = DateTime.parse(parsed_json["ts"])
  if parsed_json["error"].nil?
    error = nil
  else
    error = parsed_json["error"].to_json
    error = WorkflowEventError.from_json(json_object: error)
  end
  new(id: id, ts: ts, error: error, 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)


57
58
59
60
61
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 57

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.ts.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
  WorkflowEventError.validate_raw(obj: obj.error)
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of RejectedExecuteWorkflowWorkflowResultEvent to a JSON object

Returns:

  • (JSON)


49
50
51
# File 'lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb', line 49

def to_json(*_args)
  { "id": @id, "ts": @ts, "error": @error }.to_json
end