Class: Vellum::DocumentDocumentToDocumentIndex
- Inherits:
-
Object
- Object
- Vellum::DocumentDocumentToDocumentIndex
- Defined in:
- lib/vellum_ai/types/document_document_to_document_index.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#document_index_id ⇒ Object
readonly
Returns the value of attribute document_index_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#indexing_state ⇒ Object
readonly
Returns the value of attribute indexing_state.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ DocumentDocumentToDocumentIndex
Deserialize a JSON object to an instance of DocumentDocumentToDocumentIndex.
-
.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:, document_index_id:, indexing_state: nil, additional_properties: nil) ⇒ DocumentDocumentToDocumentIndex constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of DocumentDocumentToDocumentIndex to a JSON object.
Constructor Details
#initialize(id:, document_index_id:, indexing_state: nil, additional_properties: nil) ⇒ DocumentDocumentToDocumentIndex
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 20 def initialize(id:, document_index_id:, indexing_state: nil, additional_properties: nil) # @type [String] Vellum-generated ID that uniquely identifies this link. @id = id # @type [String] Vellum-generated ID that uniquely identifies the index this document is included in. @document_index_id = document_index_id # @type [INDEXING_STATE_ENUM] An enum value representing where this document is along its indexing lifecycle for this index. # - `AWAITING_PROCESSING` - Awaiting Processing # - `QUEUED` - Queued # - `INDEXING` - Indexing # - `INDEXED` - Indexed # - `FAILED` - Failed @indexing_state = indexing_state # @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.
8 9 10 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 8 def additional_properties @additional_properties end |
#document_index_id ⇒ Object (readonly)
Returns the value of attribute document_index_id.
8 9 10 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 8 def document_index_id @document_index_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 8 def id @id end |
#indexing_state ⇒ Object (readonly)
Returns the value of attribute indexing_state.
8 9 10 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 8 def indexing_state @indexing_state end |
Class Method Details
.from_json(json_object:) ⇒ DocumentDocumentToDocumentIndex
Deserialize a JSON object to an instance of DocumentDocumentToDocumentIndex
40 41 42 43 44 45 46 47 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id document_index_id = struct.document_index_id indexing_state = INDEXING_STATE_ENUM.key(parsed_json["indexing_state"]) || parsed_json["indexing_state"] new(id: id, document_index_id: document_index_id, indexing_state: indexing_state, 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.
64 65 66 67 68 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 64 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.document_index_id.is_a?(String) != false || raise("Passed value for field obj.document_index_id is not the expected type, validation failed.") obj.indexing_state&.is_a?(INDEXING_STATE_ENUM) != false || raise("Passed value for field obj.indexing_state is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of DocumentDocumentToDocumentIndex to a JSON object
52 53 54 55 56 57 58 |
# File 'lib/vellum_ai/types/document_document_to_document_index.rb', line 52 def to_json(*_args) { "id": @id, "document_index_id": @document_index_id, "indexing_state": INDEXING_STATE_ENUM[@indexing_state] || @indexing_state }.to_json end |