Class: RagieRubySdk::DocumentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ragie_ruby_sdk/api/documents_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DocumentsApi

Returns a new instance of DocumentsApi.



19
20
21
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_document(file, opts = {}) ⇒ Document

Create Document 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`.

Parameters:

  • 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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mode (Mode2)
  • :metadata (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: &#x60;document_id&#x60;, &#x60;document_type&#x60;, &#x60;document_source&#x60;, &#x60;document_name&#x60;, &#x60;document_uploaded_at&#x60;, &#x60;start_time&#x60;, &#x60;end_time&#x60;.

  • :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.

  • :name (String)

    An optional name for the document. If set, the document will have this name. Otherwise it will default to the file&#39;s name.

  • :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 &#x60;_&#x60; and &#x60;-&#x60;. A partition is created any time a document is created.

Returns:



32
33
34
35
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 32

def create_document(file, opts = {})
  data, _status_code, _headers = create_document_with_http_info(file, opts)
  data
end

#create_document_from_url(create_document_from_url_params, opts = {}) ⇒ Document

Create Document From Url 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.

Parameters:

Returns:



111
112
113
114
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 111

def create_document_from_url(create_document_from_url_params, opts = {})
  data, _status_code, _headers = create_document_from_url_with_http_info(create_document_from_url_params, opts)
  data
end

#create_document_from_url_with_http_info(create_document_from_url_params, opts = {}) ⇒ Array<(Document, Integer, Hash)>

Create Document From Url 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 [&#x60;pending&#x60;, &#x60;partitioning&#x60;, &#x60;partitioned&#x60;, &#x60;refined&#x60;, &#x60;chunked&#x60;, &#x60;indexed&#x60;, &#x60;summary_indexed&#x60;, &#x60;keyword_indexed&#x60;, &#x60;ready&#x60;, &#x60;failed&#x60;]. 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 &#x60;indexed&#x60; state. However the summary will only be available once the state has changed to &#x60;summary_indexed&#x60; or &#x60;ready&#x60;. PDF files over 2000 pages are not supported in hi_res mode.

Parameters:

Returns:

  • (Array<(Document, Integer, Hash)>)

    Document data, response status code and response headers



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 121

def create_document_from_url_with_http_info(create_document_from_url_params, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.create_document_from_url ...'
  end
  # verify the required parameter 'create_document_from_url_params' is set
  if @api_client.config.client_side_validation && create_document_from_url_params.nil?
    fail ArgumentError, "Missing the required parameter 'create_document_from_url_params' when calling DocumentsApi.create_document_from_url"
  end
  # resource path
  local_var_path = '/documents/url'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_document_from_url_params)

  # return_type
  return_type = opts[:debug_return_type] || 'Document'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.create_document_from_url",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#create_document_from_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_document_raw(create_document_raw_params, opts = {}) ⇒ Document

Create Document Raw Ingest a document as raw text. 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`.

Parameters:

Returns:



179
180
181
182
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 179

def create_document_raw(create_document_raw_params, opts = {})
  data, _status_code, _headers = create_document_raw_with_http_info(create_document_raw_params, opts)
  data
end

#create_document_raw_with_http_info(create_document_raw_params, opts = {}) ⇒ Array<(Document, Integer, Hash)>

Create Document Raw Ingest a document as raw text. 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 [&#x60;pending&#x60;, &#x60;partitioning&#x60;, &#x60;partitioned&#x60;, &#x60;refined&#x60;, &#x60;chunked&#x60;, &#x60;indexed&#x60;, &#x60;summary_indexed&#x60;, &#x60;keyword_indexed&#x60;, &#x60;ready&#x60;, &#x60;failed&#x60;]. 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 &#x60;indexed&#x60; state. However the summary will only be available once the state has changed to &#x60;summary_indexed&#x60; or &#x60;ready&#x60;.

Parameters:

Returns:

  • (Array<(Document, Integer, Hash)>)

    Document data, response status code and response headers



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 189

def create_document_raw_with_http_info(create_document_raw_params, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.create_document_raw ...'
  end
  # verify the required parameter 'create_document_raw_params' is set
  if @api_client.config.client_side_validation && create_document_raw_params.nil?
    fail ArgumentError, "Missing the required parameter 'create_document_raw_params' when calling DocumentsApi.create_document_raw"
  end
  # resource path
  local_var_path = '/documents/raw'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_document_raw_params)

  # return_type
  return_type = opts[:debug_return_type] || 'Document'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.create_document_raw",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#create_document_raw\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_document_with_http_info(file, opts = {}) ⇒ Array<(Document, Integer, Hash)>

Create Document 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 [&#x60;pending&#x60;, &#x60;partitioning&#x60;, &#x60;partitioned&#x60;, &#x60;refined&#x60;, &#x60;chunked&#x60;, &#x60;indexed&#x60;, &#x60;summary_indexed&#x60;, &#x60;keyword_indexed&#x60;, &#x60;ready&#x60;, &#x60;failed&#x60;]. 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 &#x60;indexed&#x60; state. However the summary will only be available once the state has changed to &#x60;summary_indexed&#x60; or &#x60;ready&#x60;.

Parameters:

  • file (File)

    The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: &#x60;.eml&#x60; &#x60;.html&#x60; &#x60;.json&#x60; &#x60;.md&#x60; &#x60;.msg&#x60; &#x60;.rst&#x60; &#x60;.rtf&#x60; &#x60;.txt&#x60; &#x60;.xml&#x60; Images: &#x60;.png&#x60; &#x60;.webp&#x60; &#x60;.jpg&#x60; &#x60;.jpeg&#x60; &#x60;.tiff&#x60; &#x60;.bmp&#x60; &#x60;.heic&#x60; Documents: &#x60;.csv&#x60; &#x60;.doc&#x60; &#x60;.docx&#x60; &#x60;.epub&#x60; &#x60;.epub+zip&#x60; &#x60;.odt&#x60; &#x60;.pdf&#x60; &#x60;.ppt&#x60; &#x60;.pptx&#x60; &#x60;.tsv&#x60; &#x60;.xlsx&#x60; &#x60;.xls&#x60;. PDF files over 2000 pages are not supported in hi_res mode.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mode (Mode2)
  • :metadata (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: &#x60;document_id&#x60;, &#x60;document_type&#x60;, &#x60;document_source&#x60;, &#x60;document_name&#x60;, &#x60;document_uploaded_at&#x60;, &#x60;start_time&#x60;, &#x60;end_time&#x60;.

  • :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.

  • :name (String)

    An optional name for the document. If set, the document will have this name. Otherwise it will default to the file&#39;s name.

  • :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 &#x60;_&#x60; and &#x60;-&#x60;. A partition is created any time a document is created.

Returns:

  • (Array<(Document, Integer, Hash)>)

    Document data, response status code and response headers



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 47

def create_document_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.create_document ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling DocumentsApi.create_document"
  end
  # resource path
  local_var_path = '/documents'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['mode'] = opts[:'mode'] if !opts[:'mode'].nil?
  form_params['metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?
  form_params['external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Document'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.create_document",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#create_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_document(document_id, opts = {}) ⇒ DocumentDelete

Delete Document

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :async (Boolean)

    If true, performs document deletion asynchronously

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



248
249
250
251
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 248

def delete_document(document_id, opts = {})
  data, _status_code, _headers = delete_document_with_http_info(document_id, opts)
  data
end

#delete_document_with_http_info(document_id, opts = {}) ⇒ Array<(DocumentDelete, Integer, Hash)>

Delete Document

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :async (Boolean)

    If true, performs document deletion asynchronously

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentDelete, Integer, Hash)>)

    DocumentDelete data, response status code and response headers



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 259

def delete_document_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.delete_document ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.delete_document"
  end
  # resource path
  local_var_path = '/documents/{document_id}'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'async'] = opts[:'async'] if !opts[:'async'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentDelete'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.delete_document",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#delete_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document(document_id, opts = {}) ⇒ DocumentGet

Get Document

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



314
315
316
317
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 314

def get_document(document_id, opts = {})
  data, _status_code, _headers = get_document_with_http_info(document_id, opts)
  data
end

#get_document_chunk(document_id, chunk_id, opts = {}) ⇒ DocumentChunkDetail

Get Document Chunk Gets a document chunk by its document and chunk ID.

Parameters:

  • document_id (String)

    The id of the document.

  • chunk_id (String)

    The ID of the chunk.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



380
381
382
383
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 380

def get_document_chunk(document_id, chunk_id, opts = {})
  data, _status_code, _headers = get_document_chunk_with_http_info(document_id, chunk_id, opts)
  data
end

#get_document_chunk_content(document_id, chunk_id, opts = {}) ⇒ Object

Get Document Chunk Content Returns the content of a document chunk in the requested format. Can be used to stream media of the content for audio/video documents.

Parameters:

  • document_id (String)

    The id of the document.

  • chunk_id (String)

    The ID of the chunk.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 chunk&#39;s document type.

  • :download (Boolean)

    Whether to return the content as a file download or a raw stream. If set to &#x60;true&#x60;, the content will be returned as a named file for download. (default to false)

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

  • :range (String)

Returns:

  • (Object)


455
456
457
458
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 455

def get_document_chunk_content(document_id, chunk_id, opts = {})
  data, _status_code, _headers = get_document_chunk_content_with_http_info(document_id, chunk_id, opts)
  data
end

#get_document_chunk_content_with_http_info(document_id, chunk_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get Document Chunk Content Returns the content of a document chunk in the requested format. Can be used to stream media of the content for audio/video documents.

Parameters:

  • document_id (String)

    The id of the document.

  • chunk_id (String)

    The ID of the chunk.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 chunk&#39;s document type.

  • :download (Boolean)

    Whether to return the content as a file download or a raw stream. If set to &#x60;true&#x60;, the content will be returned as a named file for download. (default to false)

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

  • :range (String)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 470

def get_document_chunk_content_with_http_info(document_id, chunk_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_chunk_content ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_chunk_content"
  end
  # verify the required parameter 'chunk_id' is set
  if @api_client.config.client_side_validation && chunk_id.nil?
    fail ArgumentError, "Missing the required parameter 'chunk_id' when calling DocumentsApi.get_document_chunk_content"
  end
  allowable_values = ["text/plain", "audio/mpeg", "video/mp4", "image/webp", "image/heic", "image/bmp", "image/png", "image/jpeg", "image/tiff"]
  if @api_client.config.client_side_validation && opts[:'media_type'] && !allowable_values.include?(opts[:'media_type'])
    fail ArgumentError, "invalid value for \"media_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/documents/{document_id}/chunks/{chunk_id}/content'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)).sub('{' + 'chunk_id' + '}', CGI.escape(chunk_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'media_type'] = opts[:'media_type'] if !opts[:'media_type'].nil?
  query_params[:'download'] = opts[:'download'] if !opts[:'download'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/octet-stream', 'audio/mpeg', 'text/plain']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?
  header_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_chunk_content",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document_chunk_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_chunk_with_http_info(document_id, chunk_id, opts = {}) ⇒ Array<(DocumentChunkDetail, Integer, Hash)>

Get Document Chunk Gets a document chunk by its document and chunk ID.

Parameters:

  • document_id (String)

    The id of the document.

  • chunk_id (String)

    The ID of the chunk.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentChunkDetail, Integer, Hash)>)

    DocumentChunkDetail data, response status code and response headers



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 392

def get_document_chunk_with_http_info(document_id, chunk_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_chunk ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_chunk"
  end
  # verify the required parameter 'chunk_id' is set
  if @api_client.config.client_side_validation && chunk_id.nil?
    fail ArgumentError, "Missing the required parameter 'chunk_id' when calling DocumentsApi.get_document_chunk"
  end
  # resource path
  local_var_path = '/documents/{document_id}/chunks/{chunk_id}'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)).sub('{' + 'chunk_id' + '}', CGI.escape(chunk_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentChunkDetail'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_chunk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_chunks(document_id, opts = {}) ⇒ DocumentChunkList

Get Document Chunks List all document chunks sorted by index in ascending order. May be limited to a range of chunk indices with the ‘start_index` and `end_index` parameters. Documents created prior to 9/18/2024, which have not been updated since, have chunks which do not include an index and their index will be returned as -1. They will be sorted by their ID instead. Updating the document using the `Update Document File` or `Update Document Raw` endpoint will regenerate document chunks, including their index. Results are paginated with a max limit of 100. When more chunks are available, a `cursor` will be provided. Use the `cursor` parameter to retrieve the subsequent page.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_index (Integer)

    The inclusive starting index of the chunk range to list. If omitted and &#x60;end_index&#x60; is present effectively limits results to at most one chunk matching &#x60;end_index&#x60;. If both &#x60;start_index&#x60; and &#x60;end_index&#x60; are omitted, results are not limited by index.

  • :end_index (Integer)

    The inclusive ending index of the chunk range to list. If omitted and &#x60;start_index&#x60; is present effectively limits results to at most one chunk matching &#x60;start_index&#x60;. If both &#x60;start_index&#x60; and &#x60;end_index&#x60; are omitted, results are not limited by index.

  • :cursor (String)

    An opaque cursor for pagination

  • :page_size (Integer)

    The number of items per page (must be greater than 0 and less than or equal to 100) (default to 10)

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



540
541
542
543
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 540

def get_document_chunks(document_id, opts = {})
  data, _status_code, _headers = get_document_chunks_with_http_info(document_id, opts)
  data
end

#get_document_chunks_with_http_info(document_id, opts = {}) ⇒ Array<(DocumentChunkList, Integer, Hash)>

Get Document Chunks List all document chunks sorted by index in ascending order. May be limited to a range of chunk indices with the &#x60;start_index&#x60; and &#x60;end_index&#x60; parameters. Documents created prior to 9/18/2024, which have not been updated since, have chunks which do not include an index and their index will be returned as -1. They will be sorted by their ID instead. Updating the document using the &#x60;Update Document File&#x60; or &#x60;Update Document Raw&#x60; endpoint will regenerate document chunks, including their index. Results are paginated with a max limit of 100. When more chunks are available, a &#x60;cursor&#x60; will be provided. Use the &#x60;cursor&#x60; parameter to retrieve the subsequent page.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_index (Integer)

    The inclusive starting index of the chunk range to list. If omitted and &#x60;end_index&#x60; is present effectively limits results to at most one chunk matching &#x60;end_index&#x60;. If both &#x60;start_index&#x60; and &#x60;end_index&#x60; are omitted, results are not limited by index.

  • :end_index (Integer)

    The inclusive ending index of the chunk range to list. If omitted and &#x60;start_index&#x60; is present effectively limits results to at most one chunk matching &#x60;start_index&#x60;. If both &#x60;start_index&#x60; and &#x60;end_index&#x60; are omitted, results are not limited by index.

  • :cursor (String)

    An opaque cursor for pagination

  • :page_size (Integer)

    The number of items per page (must be greater than 0 and less than or equal to 100) (default to 10)

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentChunkList, Integer, Hash)>)

    DocumentChunkList data, response status code and response headers



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 555

def get_document_chunks_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_chunks ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_chunks"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DocumentsApi.get_document_chunks, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DocumentsApi.get_document_chunks, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/documents/{document_id}/chunks'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_index'] = opts[:'start_index'] if !opts[:'start_index'].nil?
  query_params[:'end_index'] = opts[:'end_index'] if !opts[:'end_index'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentChunkList'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_chunks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document_chunks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_content(document_id, opts = {}) ⇒ DocumentWithContent

Get Document Content 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.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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&#39;s type.

  • :download (Boolean)

    Whether to return the content as a file download or a raw stream. If set to &#x60;true&#x60;, the content will be returned as a named file for download. (default to false)

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

  • :range (String)

Returns:



625
626
627
628
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 625

def get_document_content(document_id, opts = {})
  data, _status_code, _headers = get_document_content_with_http_info(document_id, opts)
  data
end

#get_document_content_with_http_info(document_id, opts = {}) ⇒ Array<(DocumentWithContent, Integer, Hash)>

Get Document Content Get the content of a document. The &#x60;media_type&#x60; parameter can be used to request the content in a different format. When requesting as &#x60;application/json&#x60; 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 &#x60;audio/mpeg&#x60; or &#x60;video/mp4&#x60; will stream the file in a format that can be provided to an audio video player.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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&#39;s type.

  • :download (Boolean)

    Whether to return the content as a file download or a raw stream. If set to &#x60;true&#x60;, the content will be returned as a named file for download. (default to false)

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

  • :range (String)

Returns:

  • (Array<(DocumentWithContent, Integer, Hash)>)

    DocumentWithContent data, response status code and response headers



639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 639

def get_document_content_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_content ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_content"
  end
  allowable_values = ["text/plain", "audio/mpeg", "video/mp4", "image/webp", "image/heic", "image/bmp", "image/png", "image/jpeg", "image/tiff", "application/json"]
  if @api_client.config.client_side_validation && opts[:'media_type'] && !allowable_values.include?(opts[:'media_type'])
    fail ArgumentError, "invalid value for \"media_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/documents/{document_id}/content'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'media_type'] = opts[:'media_type'] if !opts[:'media_type'].nil?
  query_params[:'download'] = opts[:'download'] if !opts[:'download'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?
  header_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentWithContent'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_content",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_source(document_id, opts = {}) ⇒ File

Get Document Source Get the source file of a document. The source file is the original file that was uploaded to create the document. If the document was created from a URL, the source file will be the content of the URL. If the document was created by a connection, the source file will vary based on the type of the connection. For example, a Google Drive connection will return the file that was synced from the Google Drive, while a SalesForce connection would return a JSON file of the data synced from SalesForce.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (File)


701
702
703
704
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 701

def get_document_source(document_id, opts = {})
  data, _status_code, _headers = get_document_source_with_http_info(document_id, opts)
  data
end

#get_document_source_with_http_info(document_id, opts = {}) ⇒ Array<(File, Integer, Hash)>

Get Document Source Get the source file of a document. The source file is the original file that was uploaded to create the document. If the document was created from a URL, the source file will be the content of the URL. If the document was created by a connection, the source file will vary based on the type of the connection. For example, a Google Drive connection will return the file that was synced from the Google Drive, while a SalesForce connection would return a JSON file of the data synced from SalesForce.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(File, Integer, Hash)>)

    File data, response status code and response headers



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 712

def get_document_source_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_source ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_source"
  end
  # resource path
  local_var_path = '/documents/{document_id}/source'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'File'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_source",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_summary(document_id, opts = {}) ⇒ DocumentSummary

Get Document Summary Get a LLM generated summary of the document. The summary is created when the document is first created or updated. Documents of types [‘xls’, ‘xlsx’, ‘csv’, ‘json’] are not supported for summarization. Documents greater than 1M in token length are not supported. This feature is in beta and may change in the future.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



767
768
769
770
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 767

def get_document_summary(document_id, opts = {})
  data, _status_code, _headers = get_document_summary_with_http_info(document_id, opts)
  data
end

#get_document_summary_with_http_info(document_id, opts = {}) ⇒ Array<(DocumentSummary, Integer, Hash)>

Get Document Summary Get a LLM generated summary of the document. The summary is created when the document is first created or updated. Documents of types [&#39;xls&#39;, &#39;xlsx&#39;, &#39;csv&#39;, &#39;json&#39;] are not supported for summarization. Documents greater than 1M in token length are not supported. This feature is in beta and may change in the future.

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentSummary, Integer, Hash)>)

    DocumentSummary data, response status code and response headers



778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 778

def get_document_summary_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_summary ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document_summary"
  end
  # resource path
  local_var_path = '/documents/{document_id}/summary'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentSummary'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_summary",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_with_http_info(document_id, opts = {}) ⇒ Array<(DocumentGet, Integer, Hash)>

Get Document

Parameters:

  • document_id (String)

    The id of the document.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentGet, Integer, Hash)>)

    DocumentGet data, response status code and response headers



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 324

def get_document_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document"
  end
  # resource path
  local_var_path = '/documents/{document_id}'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentGet'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#get_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_documents(opts = {}) ⇒ DocumentList

List Documents List all documents sorted by created_at in descending order. Results are paginated with a max limit of 100. When more documents are available, a ‘cursor` will be provided. Use the `cursor` parameter to retrieve the subsequent page.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :cursor (String)

    An opaque cursor for pagination

  • :page_size (Integer)

    The number of items per page (must be greater than 0 and less than or equal to 100) (default to 10)

  • :filter (String)

    The metadata search filter. Returns only items which match the filter. The following filter operators are supported: $eq - Equal to (number, string, boolean), $ne - Not equal to (number, string, boolean), $gt - Greater than (number), $gte - Greater than or equal to (number), $lt - Less than (number), $lte - Less than or equal to (number), $in - In array (string or number), $nin - Not in array (string or number). The operators can be combined with AND and OR. Read [Metadata &amp; Filters guide](docs.ragie.ai/docs/metadata-filters) for more details and examples.

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



835
836
837
838
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 835

def list_documents(opts = {})
  data, _status_code, _headers = list_documents_with_http_info(opts)
  data
end

#list_documents_with_http_info(opts = {}) ⇒ Array<(DocumentList, Integer, Hash)>

List Documents List all documents sorted by created_at in descending order. Results are paginated with a max limit of 100. When more documents are available, a &#x60;cursor&#x60; will be provided. Use the &#x60;cursor&#x60; parameter to retrieve the subsequent page.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :cursor (String)

    An opaque cursor for pagination

  • :page_size (Integer)

    The number of items per page (must be greater than 0 and less than or equal to 100) (default to 10)

  • :filter (String)

    The metadata search filter. Returns only items which match the filter. The following filter operators are supported: $eq - Equal to (number, string, boolean), $ne - Not equal to (number, string, boolean), $gt - Greater than (number), $gte - Greater than or equal to (number), $lt - Less than (number), $lte - Less than or equal to (number), $in - In array (string or number), $nin - Not in array (string or number). The operators can be combined with AND and OR. Read [Metadata &amp; Filters guide](docs.ragie.ai/docs/metadata-filters) for more details and examples.

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentList, Integer, Hash)>)

    DocumentList data, response status code and response headers



848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 848

def list_documents_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.list_documents ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DocumentsApi.list_documents, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DocumentsApi.list_documents, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/documents'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentList'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.list_documents",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#list_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_document_metadata(document_id, patch_document_metadata_params, opts = {}) ⇒ ResponsePatchdocumentmetadata

Patch Document Metadata

Parameters:

  • document_id (String)

    The id of the document.

  • patch_document_metadata_params (PatchDocumentMetadataParams)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



910
911
912
913
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 910

def (document_id, , opts = {})
  data, _status_code, _headers = (document_id, , opts)
  data
end

#patch_document_metadata_with_http_info(document_id, patch_document_metadata_params, opts = {}) ⇒ Array<(ResponsePatchdocumentmetadata, Integer, Hash)>

Patch Document Metadata

Parameters:

  • document_id (String)

    The id of the document.

  • patch_document_metadata_params (PatchDocumentMetadataParams)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 921

def (document_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.patch_document_metadata ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.patch_document_metadata"
  end
  # verify the required parameter 'patch_document_metadata_params' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'patch_document_metadata_params' when calling DocumentsApi.patch_document_metadata"
  end
  # resource path
  local_var_path = '/documents/{document_id}/metadata'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body()

  # return_type
  return_type = opts[:debug_return_type] || 'ResponsePatchdocumentmetadata'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.patch_document_metadata",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#patch_document_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_document_file(document_id, file, opts = {}) ⇒ DocumentFileUpdate

Update Document File

Parameters:

  • document_id (String)

    The id of the document.

  • file (File)

    The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: &#x60;.eml&#x60; &#x60;.html&#x60; &#x60;.json&#x60; &#x60;.md&#x60; &#x60;.msg&#x60; &#x60;.rst&#x60; &#x60;.rtf&#x60; &#x60;.txt&#x60; &#x60;.xml&#x60; Images: &#x60;.png&#x60; &#x60;.webp&#x60; &#x60;.jpg&#x60; &#x60;.jpeg&#x60; &#x60;.tiff&#x60; &#x60;.bmp&#x60; &#x60;.heic&#x60; Documents: &#x60;.csv&#x60; &#x60;.doc&#x60; &#x60;.docx&#x60; &#x60;.epub&#x60; &#x60;.epub+zip&#x60; &#x60;.odt&#x60; &#x60;.pdf&#x60; &#x60;.ppt&#x60; &#x60;.pptx&#x60; &#x60;.tsv&#x60; &#x60;.xlsx&#x60; &#x60;.xls&#x60;. PDF files over 2000 pages are not supported in hi_res mode.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

  • :mode (Mode2)

Returns:



986
987
988
989
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 986

def update_document_file(document_id, file, opts = {})
  data, _status_code, _headers = update_document_file_with_http_info(document_id, file, opts)
  data
end

#update_document_file_with_http_info(document_id, file, opts = {}) ⇒ Array<(DocumentFileUpdate, Integer, Hash)>

Update Document File

Parameters:

  • document_id (String)

    The id of the document.

  • file (File)

    The binary file to upload, extract, and index for retrieval. The following file types are supported: Plain Text: &#x60;.eml&#x60; &#x60;.html&#x60; &#x60;.json&#x60; &#x60;.md&#x60; &#x60;.msg&#x60; &#x60;.rst&#x60; &#x60;.rtf&#x60; &#x60;.txt&#x60; &#x60;.xml&#x60; Images: &#x60;.png&#x60; &#x60;.webp&#x60; &#x60;.jpg&#x60; &#x60;.jpeg&#x60; &#x60;.tiff&#x60; &#x60;.bmp&#x60; &#x60;.heic&#x60; Documents: &#x60;.csv&#x60; &#x60;.doc&#x60; &#x60;.docx&#x60; &#x60;.epub&#x60; &#x60;.epub+zip&#x60; &#x60;.odt&#x60; &#x60;.pdf&#x60; &#x60;.ppt&#x60; &#x60;.pptx&#x60; &#x60;.tsv&#x60; &#x60;.xlsx&#x60; &#x60;.xls&#x60;. PDF files over 2000 pages are not supported in hi_res mode.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

  • :mode (Mode2)

Returns:

  • (Array<(DocumentFileUpdate, Integer, Hash)>)

    DocumentFileUpdate data, response status code and response headers



998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 998

def update_document_file_with_http_info(document_id, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.update_document_file ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.update_document_file"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling DocumentsApi.update_document_file"
  end
  # resource path
  local_var_path = '/documents/{document_id}/file'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['mode'] = opts[:'mode'] if !opts[:'mode'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentFileUpdate'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.update_document_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#update_document_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_document_from_url(document_id, update_document_from_url_params, opts = {}) ⇒ DocumentUrlUpdate

Update Document Url 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.

Parameters:

  • document_id (String)

    The id of the document.

  • update_document_from_url_params (UpdateDocumentFromUrlParams)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



1065
1066
1067
1068
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 1065

def update_document_from_url(document_id, update_document_from_url_params, opts = {})
  data, _status_code, _headers = update_document_from_url_with_http_info(document_id, update_document_from_url_params, opts)
  data
end

#update_document_from_url_with_http_info(document_id, update_document_from_url_params, opts = {}) ⇒ Array<(DocumentUrlUpdate, Integer, Hash)>

Update Document Url 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 [&#x60;pending&#x60;, &#x60;partitioning&#x60;, &#x60;partitioned&#x60;, &#x60;refined&#x60;, &#x60;chunked&#x60;, &#x60;indexed&#x60;, &#x60;summary_indexed&#x60;, &#x60;keyword_indexed&#x60;, &#x60;ready&#x60;, &#x60;failed&#x60;]. 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 &#x60;indexed&#x60; state. However the summary will only be available once the state has changed to &#x60;summary_indexed&#x60; or &#x60;ready&#x60;. PDF files over 2000 pages are not supported in hi_res mode.

Parameters:

  • document_id (String)

    The id of the document.

  • update_document_from_url_params (UpdateDocumentFromUrlParams)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentUrlUpdate, Integer, Hash)>)

    DocumentUrlUpdate data, response status code and response headers



1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 1077

def update_document_from_url_with_http_info(document_id, update_document_from_url_params, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.update_document_from_url ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.update_document_from_url"
  end
  # verify the required parameter 'update_document_from_url_params' is set
  if @api_client.config.client_side_validation && update_document_from_url_params.nil?
    fail ArgumentError, "Missing the required parameter 'update_document_from_url_params' when calling DocumentsApi.update_document_from_url"
  end
  # resource path
  local_var_path = '/documents/{document_id}/url'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_document_from_url_params)

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentUrlUpdate'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.update_document_from_url",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#update_document_from_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_document_raw(document_id, update_document_raw_params, opts = {}) ⇒ DocumentRawUpdate

Update Document Raw

Parameters:

  • document_id (String)

    The id of the document.

  • update_document_raw_params (UpdateDocumentRawParams)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:



1141
1142
1143
1144
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 1141

def update_document_raw(document_id, update_document_raw_params, opts = {})
  data, _status_code, _headers = update_document_raw_with_http_info(document_id, update_document_raw_params, opts)
  data
end

#update_document_raw_with_http_info(document_id, update_document_raw_params, opts = {}) ⇒ Array<(DocumentRawUpdate, Integer, Hash)>

Update Document Raw

Parameters:

  • document_id (String)

    The id of the document.

  • update_document_raw_params (UpdateDocumentRawParams)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :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 [email protected]. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

Returns:

  • (Array<(DocumentRawUpdate, Integer, Hash)>)

    DocumentRawUpdate data, response status code and response headers



1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
# File 'lib/ragie_ruby_sdk/api/documents_api.rb', line 1152

def update_document_raw_with_http_info(document_id, update_document_raw_params, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.update_document_raw ...'
  end
  # verify the required parameter 'document_id' is set
  if @api_client.config.client_side_validation && document_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.update_document_raw"
  end
  # verify the required parameter 'update_document_raw_params' is set
  if @api_client.config.client_side_validation && update_document_raw_params.nil?
    fail ArgumentError, "Missing the required parameter 'update_document_raw_params' when calling DocumentsApi.update_document_raw"
  end
  # resource path
  local_var_path = '/documents/{document_id}/raw'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'partition'] = opts[:'partition'] if !opts[:'partition'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_document_raw_params)

  # return_type
  return_type = opts[:debug_return_type] || 'DocumentRawUpdate'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['auth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.update_document_raw",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#update_document_raw\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end