Class: Vellum::DocumentIndexRead
- Inherits:
-
Object
- Object
- Vellum::DocumentIndexRead
- Defined in:
- lib/vellum_ai/types/document_index_read.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.
-
#indexing_config ⇒ Object
readonly
Returns the value of attribute indexing_config.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ DocumentIndexRead
Deserialize a JSON object to an instance of DocumentIndexRead.
-
.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:, created:, label:, name:, indexing_config:, status: nil, environment: nil, additional_properties: nil) ⇒ DocumentIndexRead constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of DocumentIndexRead to a JSON object.
Constructor Details
#initialize(id:, created:, label:, name:, indexing_config:, status: nil, environment: nil, additional_properties: nil) ⇒ DocumentIndexRead
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 26 def initialize(id:, created:, label:, name:, indexing_config:, status: nil, environment: nil, additional_properties: nil) # @type [String] @id = id # @type [DateTime] @created = created # @type [String] A human-readable label for the document index @label = label # @type [String] A name that uniquely identifies this index within its workspace @name = name # @type [ENTITY_STATUS] The current status of the document index # - `ACTIVE` - Active # - `ARCHIVED` - Archived @status = status # @type [ENVIRONMENT_ENUM] The environment this document index is used in # - `DEVELOPMENT` - Development # - `STAGING` - Staging # - `PRODUCTION` - Production @environment = environment # @type [Hash{String => String}] Configuration representing how documents should be indexed @indexing_config = indexing_config # @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.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def additional_properties @additional_properties end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def created @created end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def id @id end |
#indexing_config ⇒ Object (readonly)
Returns the value of attribute indexing_config.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def indexing_config @indexing_config end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 10 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ DocumentIndexRead
Deserialize a JSON object to an instance of DocumentIndexRead
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 55 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id created = DateTime.parse(parsed_json["created"]) label = struct.label name = struct.name status = ENTITY_STATUS.key(parsed_json["status"]) || parsed_json["status"] environment = ENVIRONMENT_ENUM.key(parsed_json["environment"]) || parsed_json["environment"] indexing_config = struct.indexing_config new(id: id, created: created, label: label, name: name, status: status, environment: environment, indexing_config: indexing_config, 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.
88 89 90 91 92 93 94 95 96 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 88 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.created.is_a?(DateTime) != false || raise("Passed value for field obj.created 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.name.is_a?(String) != false || raise("Passed value for field obj.name 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.indexing_config.is_a?(Hash) != false || raise("Passed value for field obj.indexing_config is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of DocumentIndexRead to a JSON object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/vellum_ai/types/document_index_read.rb', line 72 def to_json(*_args) { "id": @id, "created": @created, "label": @label, "name": @name, "status": ENTITY_STATUS[@status] || @status, "environment": ENVIRONMENT_ENUM[@environment] || @environment, "indexing_config": @indexing_config }.to_json end |