Class: Vellum::SlimWorkflowDeployment
- Inherits:
-
Object
- Object
- Vellum::SlimWorkflowDeployment
- Defined in:
- lib/vellum_ai/types/slim_workflow_deployment.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#input_variables ⇒ Object
readonly
Returns the value of attribute input_variables.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#last_deployed_on ⇒ Object
readonly
Returns the value of attribute last_deployed_on.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_variables ⇒ Object
readonly
Returns the value of attribute output_variables.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ SlimWorkflowDeployment
Deserialize a JSON object to an instance of SlimWorkflowDeployment.
-
.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(id:, name:, label:, created:, last_deployed_on:, input_variables:, output_variables:, status: nil, environment: nil, additional_properties: nil) ⇒ SlimWorkflowDeployment constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of SlimWorkflowDeployment to a JSON object.
Constructor Details
#initialize(id:, name:, label:, created:, last_deployed_on:, input_variables:, output_variables:, status: nil, environment: nil, additional_properties: nil) ⇒ SlimWorkflowDeployment
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 30 def initialize(id:, name:, label:, created:, last_deployed_on:, input_variables:, output_variables:, status: nil, environment: nil, additional_properties: nil) # @type [String] @id = id # @type [String] A name that uniquely identifies this workflow deployment within its workspace @name = name # @type [String] A human-readable label for the workflow deployment @label = label # @type [ENTITY_STATUS] The current status of the workflow deployment # - `ACTIVE` - Active # - `ARCHIVED` - Archived @status = status # @type [ENVIRONMENT_ENUM] The environment this workflow deployment is used in # - `DEVELOPMENT` - Development # - `STAGING` - Staging # - `PRODUCTION` - Production @environment = environment # @type [DateTime] @created = created # @type [DateTime] @last_deployed_on = last_deployed_on # @type [Array<VellumVariable>] The input variables this Workflow Deployment expects to receive values for when it is executed. @input_variables = input_variables # @type [Array<VellumVariable>] The output variables this Workflow Deployment will produce when it is executed. @output_variables = output_variables # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def additional_properties @additional_properties end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def created @created end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def id @id end |
#input_variables ⇒ Object (readonly)
Returns the value of attribute input_variables.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def input_variables @input_variables end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def label @label end |
#last_deployed_on ⇒ Object (readonly)
Returns the value of attribute last_deployed_on.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def last_deployed_on @last_deployed_on end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def name @name end |
#output_variables ⇒ Object (readonly)
Returns the value of attribute output_variables.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def output_variables @output_variables end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
11 12 13 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 11 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ SlimWorkflowDeployment
Deserialize a JSON object to an instance of SlimWorkflowDeployment
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 63 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id name = struct.name label = struct.label status = ENTITY_STATUS.key(parsed_json["status"]) || parsed_json["status"] environment = ENVIRONMENT_ENUM.key(parsed_json["environment"]) || parsed_json["environment"] created = DateTime.parse(parsed_json["created"]) last_deployed_on = DateTime.parse(parsed_json["last_deployed_on"]) input_variables = parsed_json["input_variables"].map do |v| v = v.to_json VellumVariable.from_json(json_object: v) end output_variables = parsed_json["output_variables"].map do |v| v = v.to_json VellumVariable.from_json(json_object: v) end new(id: id, name: name, label: label, status: status, environment: environment, created: created, last_deployed_on: last_deployed_on, input_variables: input_variables, output_variables: output_variables, 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.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 106 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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.status&.is_a?(ENTITY_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.environment&.is_a?(ENVIRONMENT_ENUM) != false || raise("Passed value for field obj.environment is not the expected type, validation failed.") obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.") obj.last_deployed_on.is_a?(DateTime) != false || raise("Passed value for field obj.last_deployed_on is not the expected type, validation failed.") obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.") obj.output_variables.is_a?(Array) != false || raise("Passed value for field obj.output_variables is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of SlimWorkflowDeployment to a JSON object
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/vellum_ai/types/slim_workflow_deployment.rb', line 88 def to_json(*_args) { "id": @id, "name": @name, "label": @label, "status": ENTITY_STATUS[@status] || @status, "environment": ENVIRONMENT_ENUM[@environment] || @environment, "created": @created, "last_deployed_on": @last_deployed_on, "input_variables": @input_variables, "output_variables": @output_variables }.to_json end |