ragie_ruby_sdk 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -6
- data/docs/BodyCreateDocument.md +1 -1
- data/docs/BodyUpdateDocumentFile.md +1 -1
- data/docs/DocumentUpdateWebhookPayload.md +1 -1
- data/docs/DocumentsApi.md +8 -8
- data/lib/ragie_ruby_sdk/api/documents_api.rb +14 -10
- data/lib/ragie_ruby_sdk/models/body_create_document.rb +1 -1
- data/lib/ragie_ruby_sdk/models/body_update_document_file.rb +1 -1
- data/lib/ragie_ruby_sdk/models/document_update_webhook_payload.rb +30 -6
- data/lib/ragie_ruby_sdk/version.rb +1 -1
- data/lib/ragie_ruby_sdk.rb +0 -2
- data/spec/api/documents_api_spec.rb +5 -5
- data/spec/models/document_update_webhook_payload_spec.rb +4 -0
- metadata +1 -9
- data/docs/MediaType.md +0 -15
- data/docs/Status.md +0 -15
- data/lib/ragie_ruby_sdk/models/media_type.rb +0 -104
- data/lib/ragie_ruby_sdk/models/status.rb +0 -103
- data/spec/models/media_type_spec.rb +0 -21
- data/spec/models/status_spec.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9531e8cc157c51a27d8c8dc4ae94a94baed69040efcfeed1f32b73bdf107ebde
|
|
4
|
+
data.tar.gz: 46cddc56b756a876155e325a6f5c528d727a75e2f9cdf8bb4f8d679b79dcac51
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea1bf7aa63d64b408f8d8a60c9ec4b33390ab4580e9873066be3bfcc34d357632d67fafdf021362219f1bf74ddedee2a0917e36862243973a8379f44fce5969b
|
|
7
|
+
data.tar.gz: d3f5305b9d95fb01b2d2d5e75b8694cf9611fbb38093c6b5fc2ebbb3090fbb48c33973f79b736de7cec67d340b95534c0b082a10f1d753a9d445592f4471e926
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ No description provided (generated by Openapi Generator https://github.com/opena
|
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
8
8
|
|
|
9
9
|
- API version: 1.0.0
|
|
10
|
-
- Package version: 1.0.
|
|
10
|
+
- Package version: 1.0.7
|
|
11
11
|
- Generator version: 7.16.0-SNAPSHOT
|
|
12
12
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
13
13
|
|
|
@@ -24,16 +24,16 @@ gem build ragie_ruby_sdk.gemspec
|
|
|
24
24
|
Then either install the gem locally:
|
|
25
25
|
|
|
26
26
|
```shell
|
|
27
|
-
gem install ./ragie_ruby_sdk-1.0.
|
|
27
|
+
gem install ./ragie_ruby_sdk-1.0.7.gem
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
(for development, run `gem install --dev ./ragie_ruby_sdk-1.0.
|
|
30
|
+
(for development, run `gem install --dev ./ragie_ruby_sdk-1.0.7.gem` to install the development dependencies)
|
|
31
31
|
|
|
32
32
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
33
33
|
|
|
34
34
|
Finally add this to the Gemfile:
|
|
35
35
|
|
|
36
|
-
gem 'ragie_ruby_sdk', '~> 1.0.
|
|
36
|
+
gem 'ragie_ruby_sdk', '~> 1.0.7'
|
|
37
37
|
|
|
38
38
|
### Install from Git
|
|
39
39
|
|
|
@@ -227,7 +227,6 @@ Class | Method | HTTP request | Description
|
|
|
227
227
|
- [RagieRubySdk::Link](docs/Link.md)
|
|
228
228
|
- [RagieRubySdk::ListConnectorSourceTypeInfo](docs/ListConnectorSourceTypeInfo.md)
|
|
229
229
|
- [RagieRubySdk::MediaModeParam](docs/MediaModeParam.md)
|
|
230
|
-
- [RagieRubySdk::MediaType](docs/MediaType.md)
|
|
231
230
|
- [RagieRubySdk::MetadataValue](docs/MetadataValue.md)
|
|
232
231
|
- [RagieRubySdk::MetadataValue1](docs/MetadataValue1.md)
|
|
233
232
|
- [RagieRubySdk::Mode](docs/Mode.md)
|
|
@@ -272,7 +271,6 @@ Class | Method | HTTP request | Description
|
|
|
272
271
|
- [RagieRubySdk::SharepointSiteData](docs/SharepointSiteData.md)
|
|
273
272
|
- [RagieRubySdk::SlackData](docs/SlackData.md)
|
|
274
273
|
- [RagieRubySdk::Source](docs/Source.md)
|
|
275
|
-
- [RagieRubySdk::Status](docs/Status.md)
|
|
276
274
|
- [RagieRubySdk::UpdateDocumentFromUrlParams](docs/UpdateDocumentFromUrlParams.md)
|
|
277
275
|
- [RagieRubySdk::UpdateDocumentRawParams](docs/UpdateDocumentRawParams.md)
|
|
278
276
|
- [RagieRubySdk::UpdateInstructionParams](docs/UpdateInstructionParams.md)
|
data/docs/BodyCreateDocument.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **mode** | **String** | Partition strategy for the document. Different strategies exist for textual, audio and video file types and you can set the strategy you want for each file type, or just for textual types. For textual documents the options are `'hi_res'` or `'fast'`. When set to `'hi_res'`, images and tables will be extracted from the document. `'fast'` will only extract text. `'fast'` may be up to 20x faster than `'hi_res'`. `hi_res` is only applicable for Word documents, PDFs, Images, and PowerPoints. Images will always be processed in `hi_res`. If `hi_res` is set for an unsupported document type, it will be processed and billed in `fast` mode. For audio files, the options are true or false. True if you want to process audio, false otherwise. For video files, the options are `'audio_only'`, `'video_only'`, `'audio_video'`. `'audio_only'` will extract just the audio part of the video. `'video_only'` will similarly just extract the video part, ignoring audio. `'audio_video'` will extract both audio and video. To process all media types at the highest quality, use `'all'`. When you specify audio or video stategies, the format must be a JSON object. In this case, textual documents are denoted by the key \"static\". If you omit a key, that document type won't be processd. See examples below. Examples Textual documents only \"fast\" Video documents only { \"video\": \"audio_video\" } Specify multiple document types { \"static\": \"hi_res\", \"audio\": true, \"video\": \"video_only\" } Specify only textual or audio document types { \"static\": \"fast\", \"audio\": true } Highest quality processing for all media types \"all\" | [optional][default to 'fast'] |
|
|
8
8
|
| **metadata** | **String** | Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`. | [optional][default to '{}'] |
|
|
9
|
-
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. | |
|
|
9
|
+
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode. | |
|
|
10
10
|
| **external_id** | **String** | An optional identifier for the document. A common value might be an id in an external system or the URL where the source file may be found. | [optional] |
|
|
11
11
|
| **partition** | **String** | An optional partition identifier. Documents can be scoped to a partition. Partitions must be lowercase alphanumeric and may only include the special characters `_` and `-`. A partition is created any time a document is created. | [optional] |
|
|
12
12
|
| **name** | **String** | An optional name for the document. If set, the document will have this name. Otherwise it will default to the file's name. | [optional] |
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **mode** | **String** | Partition strategy for the document. Different strategies exist for textual, audio and video file types and you can set the strategy you want for each file type, or just for textual types. For textual documents the options are `'hi_res'` or `'fast'`. When set to `'hi_res'`, images and tables will be extracted from the document. `'fast'` will only extract text. `'fast'` may be up to 20x faster than `'hi_res'`. `hi_res` is only applicable for Word documents, PDFs, Images, and PowerPoints. Images will always be processed in `hi_res`. If `hi_res` is set for an unsupported document type, it will be processed and billed in `fast` mode. For audio files, the options are true or false. True if you want to process audio, false otherwise. For video files, the options are `'audio_only'`, `'video_only'`, `'audio_video'`. `'audio_only'` will extract just the audio part of the video. `'video_only'` will similarly just extract the video part, ignoring audio. `'audio_video'` will extract both audio and video. To process all media types at the highest quality, use `'all'`. When you specify audio or video stategies, the format must be a JSON object. In this case, textual documents are denoted by the key \"static\". If you omit a key, that document type won't be processd. See examples below. Examples Textual documents only \"fast\" Video documents only { \"video\": \"audio_video\" } Specify multiple document types { \"static\": \"hi_res\", \"audio\": true, \"video\": \"video_only\" } Specify only textual or audio document types { \"static\": \"fast\", \"audio\": true } Highest quality processing for all media types \"all\" | [optional][default to 'fast'] |
|
|
8
|
-
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. | |
|
|
8
|
+
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode. | |
|
|
9
9
|
|
|
10
10
|
## Example
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **document_id** | **String** | | |
|
|
8
|
-
| **status** |
|
|
8
|
+
| **status** | **String** | | |
|
|
9
9
|
| **partition** | **String** | | |
|
|
10
10
|
| **metadata** | **Hash<String, Object>** | | |
|
|
11
11
|
| **external_id** | **String** | | |
|
data/docs/DocumentsApi.md
CHANGED
|
@@ -42,7 +42,7 @@ RagieRubySdk.configure do |config|
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
api_instance = RagieRubySdk::DocumentsApi.new
|
|
45
|
-
file = File.new('/path/to/some/file') # File | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
45
|
+
file = File.new('/path/to/some/file') # File | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
46
46
|
opts = {
|
|
47
47
|
mode: RagieRubySdk::Mode2OneOf.new, # Mode2 |
|
|
48
48
|
metadata: { key: nil}, # Hash<String, MetadataValue1> | Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`.
|
|
@@ -82,7 +82,7 @@ end
|
|
|
82
82
|
|
|
83
83
|
| Name | Type | Description | Notes |
|
|
84
84
|
| ---- | ---- | ----------- | ----- |
|
|
85
|
-
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. | |
|
|
85
|
+
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode. | |
|
|
86
86
|
| **mode** | [**Mode2**](Mode2.md) | | [optional] |
|
|
87
87
|
| **metadata** | [**Hash<String, MetadataValue1>**](Hash.md) | Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`. | [optional] |
|
|
88
88
|
| **external_id** | **String** | An optional identifier for the document. A common value might be an id in an external system or the URL where the source file may be found. | [optional] |
|
|
@@ -109,7 +109,7 @@ end
|
|
|
109
109
|
|
|
110
110
|
Create Document From Url
|
|
111
111
|
|
|
112
|
-
Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
112
|
+
Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
113
113
|
|
|
114
114
|
### Examples
|
|
115
115
|
|
|
@@ -644,7 +644,7 @@ end
|
|
|
644
644
|
api_instance = RagieRubySdk::DocumentsApi.new
|
|
645
645
|
document_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | The id of the document.
|
|
646
646
|
opts = {
|
|
647
|
-
media_type:
|
|
647
|
+
media_type: 'text/plain', # String | The desired media type of the content to return described as a mime type. An error will be returned if the requested media type is not supported for the document's type.
|
|
648
648
|
download: true, # Boolean | Whether to return the content as a file download or a raw stream. If set to `true`, the content will be returned as a named file for download.
|
|
649
649
|
partition: 'partition_example', # String | An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
650
650
|
range: 'range_example' # String |
|
|
@@ -682,7 +682,7 @@ end
|
|
|
682
682
|
| Name | Type | Description | Notes |
|
|
683
683
|
| ---- | ---- | ----------- | ----- |
|
|
684
684
|
| **document_id** | **String** | The id of the document. | |
|
|
685
|
-
| **media_type** |
|
|
685
|
+
| **media_type** | **String** | The desired media type of the content to return described as a mime type. An error will be returned if the requested media type is not supported for the document's type. | [optional] |
|
|
686
686
|
| **download** | **Boolean** | Whether to return the content as a file download or a raw stream. If set to `true`, the content will be returned as a named file for download. | [optional][default to false] |
|
|
687
687
|
| **partition** | **String** | An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition. | [optional] |
|
|
688
688
|
| **range** | **String** | | [optional] |
|
|
@@ -1016,7 +1016,7 @@ end
|
|
|
1016
1016
|
|
|
1017
1017
|
api_instance = RagieRubySdk::DocumentsApi.new
|
|
1018
1018
|
document_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | The id of the document.
|
|
1019
|
-
file = File.new('/path/to/some/file') # File | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
1019
|
+
file = File.new('/path/to/some/file') # File | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
1020
1020
|
opts = {
|
|
1021
1021
|
partition: 'partition_example', # String | An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
1022
1022
|
mode: RagieRubySdk::Mode2OneOf.new # Mode2 |
|
|
@@ -1054,7 +1054,7 @@ end
|
|
|
1054
1054
|
| Name | Type | Description | Notes |
|
|
1055
1055
|
| ---- | ---- | ----------- | ----- |
|
|
1056
1056
|
| **document_id** | **String** | The id of the document. | |
|
|
1057
|
-
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. | |
|
|
1057
|
+
| **file** | **File** | The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode. | |
|
|
1058
1058
|
| **partition** | **String** | An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition. | [optional] |
|
|
1059
1059
|
| **mode** | [**Mode2**](Mode2.md) | | [optional] |
|
|
1060
1060
|
|
|
@@ -1078,7 +1078,7 @@ end
|
|
|
1078
1078
|
|
|
1079
1079
|
Update Document Url
|
|
1080
1080
|
|
|
1081
|
-
Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
1081
|
+
Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
1082
1082
|
|
|
1083
1083
|
### Examples
|
|
1084
1084
|
|
|
@@ -21,7 +21,7 @@ module RagieRubySdk
|
|
|
21
21
|
end
|
|
22
22
|
# Create Document
|
|
23
23
|
# On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
24
|
-
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
24
|
+
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @option opts [Mode2] :mode
|
|
27
27
|
# @option opts [Hash<String, MetadataValue1>] :metadata Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`.
|
|
@@ -36,7 +36,7 @@ module RagieRubySdk
|
|
|
36
36
|
|
|
37
37
|
# Create Document
|
|
38
38
|
# On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
39
|
-
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
39
|
+
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
40
40
|
# @param [Hash] opts the optional parameters
|
|
41
41
|
# @option opts [Mode2] :mode
|
|
42
42
|
# @option opts [Hash<String, MetadataValue1>] :metadata Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`.
|
|
@@ -104,7 +104,7 @@ module RagieRubySdk
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
# Create Document From Url
|
|
107
|
-
# Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
107
|
+
# Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
108
108
|
# @param create_document_from_url_params [CreateDocumentFromUrlParams]
|
|
109
109
|
# @param [Hash] opts the optional parameters
|
|
110
110
|
# @return [Document]
|
|
@@ -114,7 +114,7 @@ module RagieRubySdk
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
# Create Document From Url
|
|
117
|
-
# Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
117
|
+
# Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
118
118
|
# @param create_document_from_url_params [CreateDocumentFromUrlParams]
|
|
119
119
|
# @param [Hash] opts the optional parameters
|
|
120
120
|
# @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers
|
|
@@ -617,7 +617,7 @@ module RagieRubySdk
|
|
|
617
617
|
# Get the content of a document. The `media_type` parameter can be used to request the content in a different format. When requesting as `application/json` additional metadata about the document will be included. If the original document contained content such as images or other non-textual media, this response will include a text description of that media instead of the original file data. Using mime types such as `audio/mpeg` or `video/mp4` will stream the file in a format that can be provided to an audio video player.
|
|
618
618
|
# @param document_id [String] The id of the document.
|
|
619
619
|
# @param [Hash] opts the optional parameters
|
|
620
|
-
# @option opts [
|
|
620
|
+
# @option opts [String] :media_type The desired media type of the content to return described as a mime type. An error will be returned if the requested media type is not supported for the document's type.
|
|
621
621
|
# @option opts [Boolean] :download Whether to return the content as a file download or a raw stream. If set to `true`, the content will be returned as a named file for download. (default to false)
|
|
622
622
|
# @option opts [String] :partition An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
623
623
|
# @option opts [String] :range
|
|
@@ -631,7 +631,7 @@ module RagieRubySdk
|
|
|
631
631
|
# Get the content of a document. The `media_type` parameter can be used to request the content in a different format. When requesting as `application/json` additional metadata about the document will be included. If the original document contained content such as images or other non-textual media, this response will include a text description of that media instead of the original file data. Using mime types such as `audio/mpeg` or `video/mp4` will stream the file in a format that can be provided to an audio video player.
|
|
632
632
|
# @param document_id [String] The id of the document.
|
|
633
633
|
# @param [Hash] opts the optional parameters
|
|
634
|
-
# @option opts [
|
|
634
|
+
# @option opts [String] :media_type The desired media type of the content to return described as a mime type. An error will be returned if the requested media type is not supported for the document's type.
|
|
635
635
|
# @option opts [Boolean] :download Whether to return the content as a file download or a raw stream. If set to `true`, the content will be returned as a named file for download. (default to false)
|
|
636
636
|
# @option opts [String] :partition An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
637
637
|
# @option opts [String] :range
|
|
@@ -644,6 +644,10 @@ module RagieRubySdk
|
|
|
644
644
|
if @api_client.config.client_side_validation && document_id.nil?
|
|
645
645
|
fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_content"
|
|
646
646
|
end
|
|
647
|
+
allowable_values = ["text/plain", "audio/mpeg", "video/mp4", "image/webp", "image/heic", "image/bmp", "image/png", "image/jpeg", "image/tiff", "application/json"]
|
|
648
|
+
if @api_client.config.client_side_validation && opts[:'media_type'] && !allowable_values.include?(opts[:'media_type'])
|
|
649
|
+
fail ArgumentError, "invalid value for \"media_type\", must be one of #{allowable_values}"
|
|
650
|
+
end
|
|
647
651
|
# resource path
|
|
648
652
|
local_var_path = '/documents/{document_id}/content'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))
|
|
649
653
|
|
|
@@ -974,7 +978,7 @@ module RagieRubySdk
|
|
|
974
978
|
|
|
975
979
|
# Update Document File
|
|
976
980
|
# @param document_id [String] The id of the document.
|
|
977
|
-
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
981
|
+
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
978
982
|
# @param [Hash] opts the optional parameters
|
|
979
983
|
# @option opts [String] :partition An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
980
984
|
# @option opts [Mode2] :mode
|
|
@@ -986,7 +990,7 @@ module RagieRubySdk
|
|
|
986
990
|
|
|
987
991
|
# Update Document File
|
|
988
992
|
# @param document_id [String] The id of the document.
|
|
989
|
-
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
993
|
+
# @param file [File] The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
990
994
|
# @param [Hash] opts the optional parameters
|
|
991
995
|
# @option opts [String] :partition An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
992
996
|
# @option opts [Mode2] :mode
|
|
@@ -1052,7 +1056,7 @@ module RagieRubySdk
|
|
|
1052
1056
|
end
|
|
1053
1057
|
|
|
1054
1058
|
# Update Document Url
|
|
1055
|
-
# Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
1059
|
+
# Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
1056
1060
|
# @param document_id [String] The id of the document.
|
|
1057
1061
|
# @param update_document_from_url_params [UpdateDocumentFromUrlParams]
|
|
1058
1062
|
# @param [Hash] opts the optional parameters
|
|
@@ -1064,7 +1068,7 @@ module RagieRubySdk
|
|
|
1064
1068
|
end
|
|
1065
1069
|
|
|
1066
1070
|
# Update Document Url
|
|
1067
|
-
# Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
1071
|
+
# Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
1068
1072
|
# @param document_id [String] The id of the document.
|
|
1069
1073
|
# @param update_document_from_url_params [UpdateDocumentFromUrlParams]
|
|
1070
1074
|
# @param [Hash] opts the optional parameters
|
|
@@ -21,7 +21,7 @@ module RagieRubySdk
|
|
|
21
21
|
# Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`.
|
|
22
22
|
attr_accessor :metadata
|
|
23
23
|
|
|
24
|
-
# The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
24
|
+
# The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
25
25
|
attr_accessor :file
|
|
26
26
|
|
|
27
27
|
# An optional identifier for the document. A common value might be an id in an external system or the URL where the source file may be found.
|
|
@@ -18,7 +18,7 @@ module RagieRubySdk
|
|
|
18
18
|
# Partition strategy for the document. Different strategies exist for textual, audio and video file types and you can set the strategy you want for each file type, or just for textual types. For textual documents the options are `'hi_res'` or `'fast'`. When set to `'hi_res'`, images and tables will be extracted from the document. `'fast'` will only extract text. `'fast'` may be up to 20x faster than `'hi_res'`. `hi_res` is only applicable for Word documents, PDFs, Images, and PowerPoints. Images will always be processed in `hi_res`. If `hi_res` is set for an unsupported document type, it will be processed and billed in `fast` mode. For audio files, the options are true or false. True if you want to process audio, false otherwise. For video files, the options are `'audio_only'`, `'video_only'`, `'audio_video'`. `'audio_only'` will extract just the audio part of the video. `'video_only'` will similarly just extract the video part, ignoring audio. `'audio_video'` will extract both audio and video. To process all media types at the highest quality, use `'all'`. When you specify audio or video stategies, the format must be a JSON object. In this case, textual documents are denoted by the key \"static\". If you omit a key, that document type won't be processd. See examples below. Examples Textual documents only \"fast\" Video documents only { \"video\": \"audio_video\" } Specify multiple document types { \"static\": \"hi_res\", \"audio\": true, \"video\": \"video_only\" } Specify only textual or audio document types { \"static\": \"fast\", \"audio\": true } Highest quality processing for all media types \"all\"
|
|
19
19
|
attr_accessor :mode
|
|
20
20
|
|
|
21
|
-
# The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
21
|
+
# The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
22
22
|
attr_accessor :file
|
|
23
23
|
|
|
24
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -33,6 +33,28 @@ module RagieRubySdk
|
|
|
33
33
|
|
|
34
34
|
attr_accessor :error
|
|
35
35
|
|
|
36
|
+
class EnumAttributeValidator
|
|
37
|
+
attr_reader :datatype
|
|
38
|
+
attr_reader :allowable_values
|
|
39
|
+
|
|
40
|
+
def initialize(datatype, allowable_values)
|
|
41
|
+
@allowable_values = allowable_values.map do |value|
|
|
42
|
+
case datatype.to_s
|
|
43
|
+
when /Integer/i
|
|
44
|
+
value.to_i
|
|
45
|
+
when /Float/i
|
|
46
|
+
value.to_f
|
|
47
|
+
else
|
|
48
|
+
value
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def valid?(value)
|
|
54
|
+
!value || allowable_values.include?(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
36
58
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
59
|
def self.attribute_map
|
|
38
60
|
{
|
|
@@ -62,7 +84,7 @@ module RagieRubySdk
|
|
|
62
84
|
def self.openapi_types
|
|
63
85
|
{
|
|
64
86
|
:'document_id' => :'String',
|
|
65
|
-
:'status' => :'
|
|
87
|
+
:'status' => :'String',
|
|
66
88
|
:'partition' => :'String',
|
|
67
89
|
:'metadata' => :'Hash<String, Object>',
|
|
68
90
|
:'external_id' => :'String',
|
|
@@ -190,6 +212,8 @@ module RagieRubySdk
|
|
|
190
212
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
191
213
|
return false if @document_id.nil?
|
|
192
214
|
return false if @status.nil?
|
|
215
|
+
status_validator = EnumAttributeValidator.new('String', ["ready", "failed", "indexed", "keyword_indexed"])
|
|
216
|
+
return false unless status_validator.valid?(@status)
|
|
193
217
|
return false if @partition.nil?
|
|
194
218
|
return false if @metadata.nil?
|
|
195
219
|
return false if @name.nil?
|
|
@@ -206,13 +230,13 @@ module RagieRubySdk
|
|
|
206
230
|
@document_id = document_id
|
|
207
231
|
end
|
|
208
232
|
|
|
209
|
-
# Custom attribute writer method
|
|
210
|
-
# @param [Object] status
|
|
233
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
234
|
+
# @param [Object] status Object to be assigned
|
|
211
235
|
def status=(status)
|
|
212
|
-
|
|
213
|
-
|
|
236
|
+
validator = EnumAttributeValidator.new('String', ["ready", "failed", "indexed", "keyword_indexed"])
|
|
237
|
+
unless validator.valid?(status)
|
|
238
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
214
239
|
end
|
|
215
|
-
|
|
216
240
|
@status = status
|
|
217
241
|
end
|
|
218
242
|
|
data/lib/ragie_ruby_sdk.rb
CHANGED
|
@@ -101,7 +101,6 @@ require 'ragie_ruby_sdk/models/intercom_data'
|
|
|
101
101
|
require 'ragie_ruby_sdk/models/link'
|
|
102
102
|
require 'ragie_ruby_sdk/models/list_connector_source_type_info'
|
|
103
103
|
require 'ragie_ruby_sdk/models/media_mode_param'
|
|
104
|
-
require 'ragie_ruby_sdk/models/media_type'
|
|
105
104
|
require 'ragie_ruby_sdk/models/metadata_value'
|
|
106
105
|
require 'ragie_ruby_sdk/models/metadata_value1'
|
|
107
106
|
require 'ragie_ruby_sdk/models/mode'
|
|
@@ -146,7 +145,6 @@ require 'ragie_ruby_sdk/models/sharepoint_file_data'
|
|
|
146
145
|
require 'ragie_ruby_sdk/models/sharepoint_site_data'
|
|
147
146
|
require 'ragie_ruby_sdk/models/slack_data'
|
|
148
147
|
require 'ragie_ruby_sdk/models/source'
|
|
149
|
-
require 'ragie_ruby_sdk/models/status'
|
|
150
148
|
require 'ragie_ruby_sdk/models/update_document_from_url_params'
|
|
151
149
|
require 'ragie_ruby_sdk/models/update_document_raw_params'
|
|
152
150
|
require 'ragie_ruby_sdk/models/update_instruction_params'
|
|
@@ -35,7 +35,7 @@ describe 'DocumentsApi' do
|
|
|
35
35
|
# unit tests for create_document
|
|
36
36
|
# Create Document
|
|
37
37
|
# On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
38
|
-
# @param file The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
38
|
+
# @param file The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
39
39
|
# @param [Hash] opts the optional parameters
|
|
40
40
|
# @option opts [Mode2] :mode
|
|
41
41
|
# @option opts [Hash<String, MetadataValue1>] :metadata Metadata for the document. Keys must be strings. Values may be strings, numbers, booleans, or lists of strings. Numbers may be integers or floating point and will be converted to 64 bit floating point. 1000 total values are allowed. Each item in an array counts towards the total. The following keys are reserved for internal use: `document_id`, `document_type`, `document_source`, `document_name`, `document_uploaded_at`, `start_time`, `end_time`.
|
|
@@ -51,7 +51,7 @@ describe 'DocumentsApi' do
|
|
|
51
51
|
|
|
52
52
|
# unit tests for create_document_from_url
|
|
53
53
|
# Create Document From Url
|
|
54
|
-
# Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
54
|
+
# Ingest a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
55
55
|
# @param create_document_from_url_params
|
|
56
56
|
# @param [Hash] opts the optional parameters
|
|
57
57
|
# @return [Document]
|
|
@@ -151,7 +151,7 @@ describe 'DocumentsApi' do
|
|
|
151
151
|
# Get the content of a document. The `media_type` parameter can be used to request the content in a different format. When requesting as `application/json` additional metadata about the document will be included. If the original document contained content such as images or other non-textual media, this response will include a text description of that media instead of the original file data. Using mime types such as `audio/mpeg` or `video/mp4` will stream the file in a format that can be provided to an audio video player.
|
|
152
152
|
# @param document_id The id of the document.
|
|
153
153
|
# @param [Hash] opts the optional parameters
|
|
154
|
-
# @option opts [
|
|
154
|
+
# @option opts [String] :media_type The desired media type of the content to return described as a mime type. An error will be returned if the requested media type is not supported for the document's type.
|
|
155
155
|
# @option opts [Boolean] :download Whether to return the content as a file download or a raw stream. If set to `true`, the content will be returned as a named file for download.
|
|
156
156
|
# @option opts [String] :partition An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
157
157
|
# @option opts [String] :range
|
|
@@ -219,7 +219,7 @@ describe 'DocumentsApi' do
|
|
|
219
219
|
# unit tests for update_document_file
|
|
220
220
|
# Update Document File
|
|
221
221
|
# @param document_id The id of the document.
|
|
222
|
-
# @param file The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`.
|
|
222
|
+
# @param file The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: `.eml` `.html` `.json` `.md` `.msg` `.rst` `.rtf` `.txt` `.xml` Images: `.png` `.webp` `.jpg` `.jpeg` `.tiff` `.bmp` `.heic` Documents: `.csv` `.doc` `.docx` `.epub` `.epub+zip` `.odt` `.pdf` `.ppt` `.pptx` `.tsv` `.xlsx` `.xls`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
223
223
|
# @param [Hash] opts the optional parameters
|
|
224
224
|
# @option opts [String] :partition An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.
|
|
225
225
|
# @option opts [Mode2] :mode
|
|
@@ -232,7 +232,7 @@ describe 'DocumentsApi' do
|
|
|
232
232
|
|
|
233
233
|
# unit tests for update_document_from_url
|
|
234
234
|
# Update Document Url
|
|
235
|
-
# Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`.
|
|
235
|
+
# Updates a document from a publicly accessible URL. On ingest, the document goes through a series of steps before it is ready for retrieval. Each step is reflected in the status of the document which can be one of [`pending`, `partitioning`, `partitioned`, `refined`, `chunked`, `indexed`, `summary_indexed`, `keyword_indexed`, `ready`, `failed`]. The document is available for retrieval once it is in ready state. The summary index step can take a few seconds. You can optionally use the document for retrieval once it is in `indexed` state. However the summary will only be available once the state has changed to `summary_indexed` or `ready`. PDF files over 2000 pages are not supported in hi_res mode.
|
|
236
236
|
# @param document_id The id of the document.
|
|
237
237
|
# @param update_document_from_url_params
|
|
238
238
|
# @param [Hash] opts the optional parameters
|
|
@@ -36,6 +36,10 @@ describe RagieRubySdk::DocumentUpdateWebhookPayload do
|
|
|
36
36
|
describe 'test attribute "status"' do
|
|
37
37
|
it 'should work' do
|
|
38
38
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
39
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["ready", "failed", "indexed", "keyword_indexed"])
|
|
40
|
+
# validator.allowable_values.each do |value|
|
|
41
|
+
# expect { instance.status = value }.not_to raise_error
|
|
42
|
+
# end
|
|
39
43
|
end
|
|
40
44
|
end
|
|
41
45
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ragie_ruby_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenAPI-Generator
|
|
@@ -178,7 +178,6 @@ files:
|
|
|
178
178
|
- docs/Link.md
|
|
179
179
|
- docs/ListConnectorSourceTypeInfo.md
|
|
180
180
|
- docs/MediaModeParam.md
|
|
181
|
-
- docs/MediaType.md
|
|
182
181
|
- docs/MetadataValue.md
|
|
183
182
|
- docs/MetadataValue1.md
|
|
184
183
|
- docs/Mode.md
|
|
@@ -225,7 +224,6 @@ files:
|
|
|
225
224
|
- docs/SharepointSiteData.md
|
|
226
225
|
- docs/SlackData.md
|
|
227
226
|
- docs/Source.md
|
|
228
|
-
- docs/Status.md
|
|
229
227
|
- docs/UpdateDocumentFromUrlParams.md
|
|
230
228
|
- docs/UpdateDocumentRawParams.md
|
|
231
229
|
- docs/UpdateInstructionParams.md
|
|
@@ -333,7 +331,6 @@ files:
|
|
|
333
331
|
- lib/ragie_ruby_sdk/models/link.rb
|
|
334
332
|
- lib/ragie_ruby_sdk/models/list_connector_source_type_info.rb
|
|
335
333
|
- lib/ragie_ruby_sdk/models/media_mode_param.rb
|
|
336
|
-
- lib/ragie_ruby_sdk/models/media_type.rb
|
|
337
334
|
- lib/ragie_ruby_sdk/models/metadata_value.rb
|
|
338
335
|
- lib/ragie_ruby_sdk/models/metadata_value1.rb
|
|
339
336
|
- lib/ragie_ruby_sdk/models/mode.rb
|
|
@@ -378,7 +375,6 @@ files:
|
|
|
378
375
|
- lib/ragie_ruby_sdk/models/sharepoint_site_data.rb
|
|
379
376
|
- lib/ragie_ruby_sdk/models/slack_data.rb
|
|
380
377
|
- lib/ragie_ruby_sdk/models/source.rb
|
|
381
|
-
- lib/ragie_ruby_sdk/models/status.rb
|
|
382
378
|
- lib/ragie_ruby_sdk/models/update_document_from_url_params.rb
|
|
383
379
|
- lib/ragie_ruby_sdk/models/update_document_raw_params.rb
|
|
384
380
|
- lib/ragie_ruby_sdk/models/update_instruction_params.rb
|
|
@@ -483,7 +479,6 @@ files:
|
|
|
483
479
|
- spec/models/link_spec.rb
|
|
484
480
|
- spec/models/list_connector_source_type_info_spec.rb
|
|
485
481
|
- spec/models/media_mode_param_spec.rb
|
|
486
|
-
- spec/models/media_type_spec.rb
|
|
487
482
|
- spec/models/metadata_value1_spec.rb
|
|
488
483
|
- spec/models/metadata_value_spec.rb
|
|
489
484
|
- spec/models/mode1_spec.rb
|
|
@@ -528,7 +523,6 @@ files:
|
|
|
528
523
|
- spec/models/sharepoint_site_data_spec.rb
|
|
529
524
|
- spec/models/slack_data_spec.rb
|
|
530
525
|
- spec/models/source_spec.rb
|
|
531
|
-
- spec/models/status_spec.rb
|
|
532
526
|
- spec/models/update_document_from_url_params_spec.rb
|
|
533
527
|
- spec/models/update_document_raw_params_spec.rb
|
|
534
528
|
- spec/models/update_instruction_params_spec.rb
|
|
@@ -654,7 +648,6 @@ test_files:
|
|
|
654
648
|
- spec/models/link_spec.rb
|
|
655
649
|
- spec/models/list_connector_source_type_info_spec.rb
|
|
656
650
|
- spec/models/media_mode_param_spec.rb
|
|
657
|
-
- spec/models/media_type_spec.rb
|
|
658
651
|
- spec/models/metadata_value1_spec.rb
|
|
659
652
|
- spec/models/metadata_value_spec.rb
|
|
660
653
|
- spec/models/mode1_spec.rb
|
|
@@ -699,7 +692,6 @@ test_files:
|
|
|
699
692
|
- spec/models/sharepoint_site_data_spec.rb
|
|
700
693
|
- spec/models/slack_data_spec.rb
|
|
701
694
|
- spec/models/source_spec.rb
|
|
702
|
-
- spec/models/status_spec.rb
|
|
703
695
|
- spec/models/update_document_from_url_params_spec.rb
|
|
704
696
|
- spec/models/update_document_raw_params_spec.rb
|
|
705
697
|
- spec/models/update_instruction_params_spec.rb
|
data/docs/MediaType.md
DELETED
data/docs/Status.md
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#Ragie API
|
|
3
|
-
|
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.16.0-SNAPSHOT
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'date'
|
|
14
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module RagieRubySdk
|
|
17
|
-
# The desired media type of the content to return described as a mime type. An error will be returned if the requested media type is not supported for the document's type.
|
|
18
|
-
module MediaType
|
|
19
|
-
class << self
|
|
20
|
-
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
-
def openapi_any_of
|
|
22
|
-
[
|
|
23
|
-
:'String'
|
|
24
|
-
]
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Builds the object
|
|
28
|
-
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
29
|
-
# @return [Object] Returns the model or the data itself
|
|
30
|
-
def build(data)
|
|
31
|
-
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
32
|
-
# Note:
|
|
33
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
34
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
35
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
36
|
-
# - TODO: logging when debugging is set.
|
|
37
|
-
openapi_any_of.each do |klass|
|
|
38
|
-
begin
|
|
39
|
-
next if klass == :AnyType # "nullable: true"
|
|
40
|
-
typed_data = find_and_cast_into_type(klass, data)
|
|
41
|
-
return typed_data if typed_data
|
|
42
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
openapi_any_of.include?(:AnyType) ? data : nil
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
SchemaMismatchError = Class.new(StandardError)
|
|
52
|
-
|
|
53
|
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
54
|
-
def find_and_cast_into_type(klass, data)
|
|
55
|
-
return if data.nil?
|
|
56
|
-
|
|
57
|
-
case klass.to_s
|
|
58
|
-
when 'Boolean'
|
|
59
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
60
|
-
when 'Float'
|
|
61
|
-
return data if data.instance_of?(Float)
|
|
62
|
-
when 'Integer'
|
|
63
|
-
return data if data.instance_of?(Integer)
|
|
64
|
-
when 'Time'
|
|
65
|
-
return Time.parse(data)
|
|
66
|
-
when 'Date'
|
|
67
|
-
return Date.iso8601(data)
|
|
68
|
-
when 'String'
|
|
69
|
-
return data if data.instance_of?(String)
|
|
70
|
-
when 'Object' # "type: object"
|
|
71
|
-
return data if data.instance_of?(Hash)
|
|
72
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
73
|
-
if data.instance_of?(Array)
|
|
74
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
75
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
76
|
-
end
|
|
77
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
78
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
79
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
81
|
-
end
|
|
82
|
-
else # model
|
|
83
|
-
const = RagieRubySdk.const_get(klass)
|
|
84
|
-
if const
|
|
85
|
-
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
86
|
-
model = const.build(data)
|
|
87
|
-
return model if model
|
|
88
|
-
else
|
|
89
|
-
# raise if data contains keys that are not known to the model
|
|
90
|
-
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
|
-
model = const.build_from_hash(data)
|
|
92
|
-
return model if model
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
raise # if no match by now, raise
|
|
98
|
-
rescue
|
|
99
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
end
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#Ragie API
|
|
3
|
-
|
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.16.0-SNAPSHOT
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'date'
|
|
14
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module RagieRubySdk
|
|
17
|
-
module Status
|
|
18
|
-
class << self
|
|
19
|
-
# List of class defined in anyOf (OpenAPI v3)
|
|
20
|
-
def openapi_any_of
|
|
21
|
-
[
|
|
22
|
-
:'String'
|
|
23
|
-
]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Builds the object
|
|
27
|
-
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
28
|
-
# @return [Object] Returns the model or the data itself
|
|
29
|
-
def build(data)
|
|
30
|
-
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
31
|
-
# Note:
|
|
32
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
33
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
34
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
35
|
-
# - TODO: logging when debugging is set.
|
|
36
|
-
openapi_any_of.each do |klass|
|
|
37
|
-
begin
|
|
38
|
-
next if klass == :AnyType # "nullable: true"
|
|
39
|
-
typed_data = find_and_cast_into_type(klass, data)
|
|
40
|
-
return typed_data if typed_data
|
|
41
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
openapi_any_of.include?(:AnyType) ? data : nil
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
SchemaMismatchError = Class.new(StandardError)
|
|
51
|
-
|
|
52
|
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
53
|
-
def find_and_cast_into_type(klass, data)
|
|
54
|
-
return if data.nil?
|
|
55
|
-
|
|
56
|
-
case klass.to_s
|
|
57
|
-
when 'Boolean'
|
|
58
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
59
|
-
when 'Float'
|
|
60
|
-
return data if data.instance_of?(Float)
|
|
61
|
-
when 'Integer'
|
|
62
|
-
return data if data.instance_of?(Integer)
|
|
63
|
-
when 'Time'
|
|
64
|
-
return Time.parse(data)
|
|
65
|
-
when 'Date'
|
|
66
|
-
return Date.iso8601(data)
|
|
67
|
-
when 'String'
|
|
68
|
-
return data if data.instance_of?(String)
|
|
69
|
-
when 'Object' # "type: object"
|
|
70
|
-
return data if data.instance_of?(Hash)
|
|
71
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
72
|
-
if data.instance_of?(Array)
|
|
73
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
74
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
75
|
-
end
|
|
76
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
77
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
78
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
79
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
80
|
-
end
|
|
81
|
-
else # model
|
|
82
|
-
const = RagieRubySdk.const_get(klass)
|
|
83
|
-
if const
|
|
84
|
-
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
85
|
-
model = const.build(data)
|
|
86
|
-
return model if model
|
|
87
|
-
else
|
|
88
|
-
# raise if data contains keys that are not known to the model
|
|
89
|
-
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
90
|
-
model = const.build_from_hash(data)
|
|
91
|
-
return model if model
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
raise # if no match by now, raise
|
|
97
|
-
rescue
|
|
98
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#Ragie API
|
|
3
|
-
|
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.16.0-SNAPSHOT
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'spec_helper'
|
|
14
|
-
require 'json'
|
|
15
|
-
require 'date'
|
|
16
|
-
|
|
17
|
-
# Unit tests for RagieRubySdk::MediaType
|
|
18
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
-
# Please update as you see appropriate
|
|
20
|
-
describe RagieRubySdk::MediaType do
|
|
21
|
-
end
|
data/spec/models/status_spec.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#Ragie API
|
|
3
|
-
|
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.16.0-SNAPSHOT
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'spec_helper'
|
|
14
|
-
require 'json'
|
|
15
|
-
require 'date'
|
|
16
|
-
|
|
17
|
-
# Unit tests for RagieRubySdk::Status
|
|
18
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
-
# Please update as you see appropriate
|
|
20
|
-
describe RagieRubySdk::Status do
|
|
21
|
-
end
|