Class: SyncteraRubySdk::DocumentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/synctera_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/synctera_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/synctera_ruby_sdk/api/documents_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

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

Create a document Docs

Parameters:

  • file (File)

    The file contents

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

    the optional parameters

Options Hash (opts):

  • :description (String)

    A description of the attached document

  • :encryption (Encryption) — default: default to 'NOT_REQUIRED'
  • :metadata (Object)

    Optional field to store additional information about the resource. Intended to be used by the integrator to store non-sensitive data.

  • :name (String)

    A user-friendly name for the document

  • :related_resource_id (String)

    The ID of the resource related to the document

  • :related_resource_type (RelatedResourceType)
  • :type (DocumentType)

Returns:



34
35
36
37
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 34

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

#create_document_version(document_id, file, opts = {}) ⇒ Document

Create a new document version Docs

Parameters:

  • document_id (String)

    The unique identifier of the document.

  • file (File)

    The file contents

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

    the optional parameters

Options Hash (opts):

  • :description (String)

    A description of the attached document

  • :encryption (Encryption) — default: default to 'NOT_REQUIRED'
  • :name (String)

    A user-friendly name for the document

  • :type (DocumentType)

Returns:



122
123
124
125
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 122

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

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

Create a new document version Docs

Parameters:

  • document_id (String)

    The unique identifier of the document.

  • file (File)

    The file contents

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

    the optional parameters

Options Hash (opts):

  • :description (String)

    A description of the attached document

  • :encryption (Encryption) — default: default to 'NOT_REQUIRED'
  • :name (String)

    A user-friendly name for the document

  • :type (DocumentType)

Returns:

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

    Document data, response status code and response headers



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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 137

def create_document_version_with_http_info(document_id, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.create_document_version ...'
  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.create_document_version"
  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_version"
  end
  # resource path
  local_var_path = '/documents/{document_id}/versions'.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', 'application/problem+json'])
  # 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['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['encryption'] = opts[:'encryption'] if !opts[:'encryption'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['type'] = opts[:'type'] if !opts[:'type'].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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.create_document_version",
    :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_version\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 a document Docs

Parameters:

  • file (File)

    The file contents

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

    the optional parameters

Options Hash (opts):

  • :description (String)

    A description of the attached document

  • :encryption (Encryption) — default: default to 'NOT_REQUIRED'
  • :metadata (Object)

    Optional field to store additional information about the resource. Intended to be used by the integrator to store non-sensitive data.

  • :name (String)

    A user-friendly name for the document

  • :related_resource_id (String)

    The ID of the resource related to the document

  • :related_resource_type (RelatedResourceType)
  • :type (DocumentType)

Returns:

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

    Document data, response status code and response headers



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
105
106
107
108
109
110
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 51

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', 'application/problem+json'])
  # 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['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['encryption'] = opts[:'encryption'] if !opts[:'encryption'].nil?
  form_params['metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['related_resource_id'] = opts[:'related_resource_id'] if !opts[:'related_resource_id'].nil?
  form_params['related_resource_type'] = opts[:'related_resource_type'] if !opts[:'related_resource_type'].nil?
  form_params['type'] = opts[:'type'] if !opts[:'type'].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] || ['bearerAuth']

  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

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

Get a document Returns the document attributes. Use /documents/document_id/contents to get the contents.

Parameters:

  • document_id (String)

    The unique identifier of the document.

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

    the optional parameters

Returns:



204
205
206
207
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 204

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

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

Get contents of latest document version Returns the bytes of the requested document.

Parameters:

  • document_id (String)

    The unique identifier of the document.

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

    the optional parameters

Returns:

  • (File)


267
268
269
270
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 267

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

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

Get contents of latest document version Returns the bytes of the requested document.

Parameters:

  • document_id (String)

    The unique identifier of the document.

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 277

def get_document_contents_with_http_info(document_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_contents ...'
  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_contents"
  end
  # resource path
  local_var_path = '/documents/{document_id}/contents'.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/problem+json'])

  # 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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_contents",
    :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_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_version(document_id, document_version, opts = {}) ⇒ Document

Get a document by version Returns the document (attributes). Use /documents/document_id/versions/version/contents to get the contents.

Parameters:

  • document_id (String)

    The unique identifier of the document.

  • document_version (Integer)

    The document version.

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

    the optional parameters

Returns:



331
332
333
334
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 331

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

#get_document_version_contents(document_id, document_version, opts = {}) ⇒ File

Get document contents by version Returns the bytes of the requested document.

Parameters:

  • document_id (String)

    The unique identifier of the document.

  • document_version (Integer)

    The document version.

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

    the optional parameters

Returns:

  • (File)


400
401
402
403
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 400

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

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

Get document contents by version Returns the bytes of the requested document.

Parameters:

  • document_id (String)

    The unique identifier of the document.

  • document_version (Integer)

    The document version.

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 411

def get_document_version_contents_with_http_info(document_id, document_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_version_contents ...'
  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_version_contents"
  end
  # verify the required parameter 'document_version' is set
  if @api_client.config.client_side_validation && document_version.nil?
    fail ArgumentError, "Missing the required parameter 'document_version' when calling DocumentsApi.get_document_version_contents"
  end
  # resource path
  local_var_path = '/documents/{document_id}/versions/{document_version}/contents'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)).sub('{' + 'document_version' + '}', CGI.escape(document_version.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/problem+json'])

  # 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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_version_contents",
    :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_version_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document_version_with_http_info(document_id, document_version, opts = {}) ⇒ Array<(Document, Integer, Hash)>

Get a document by version Returns the document (attributes). Use /documents/document_id/versions/version/contents to get the contents.

Parameters:

  • document_id (String)

    The unique identifier of the document.

  • document_version (Integer)

    The document version.

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

    the optional parameters

Returns:

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

    Document data, response status code and response headers



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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 342

def get_document_version_with_http_info(document_id, document_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.get_document_version ...'
  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_version"
  end
  # verify the required parameter 'document_version' is set
  if @api_client.config.client_side_validation && document_version.nil?
    fail ArgumentError, "Missing the required parameter 'document_version' when calling DocumentsApi.get_document_version"
  end
  # resource path
  local_var_path = '/documents/{document_id}/versions/{document_version}'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)).sub('{' + 'document_version' + '}', CGI.escape(document_version.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', 'application/problem+json'])

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

  # 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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DocumentsApi.get_document_version",
    :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_version\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<(Document, Integer, Hash)>

Get a document Returns the document attributes. Use /documents/document_id/contents to get the contents.

Parameters:

  • document_id (String)

    The unique identifier of the document.

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

    the optional parameters

Returns:

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

    Document data, response status code and response headers



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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 214

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', 'application/problem+json'])

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

  # 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] || ['bearerAuth']

  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 Returns a paginated list of documents (metadata only, not contents).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :id (Array<String>)

    Unique resource identifier

  • :limit (Integer) — default: default to 100
  • :page_token (String)
  • :related_resource_type (RelatedResourceType)

    Return documents that are related to resources of the specified type

  • :related_resource_id (String)

    Return documents that are related to resources with the specified ID

  • :encryption (String)

    Whether the file should be encrypted and access restricted, e.g. if the file contains PII

  • :type (DocumentType)

    The type of documents

Returns:



474
475
476
477
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 474

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 Returns a paginated list of documents (metadata only, not contents).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :id (Array<String>)

    Unique resource identifier

  • :limit (Integer) — default: default to 100
  • :page_token (String)
  • :related_resource_type (RelatedResourceType)

    Return documents that are related to resources of the specified type

  • :related_resource_id (String)

    Return documents that are related to resources with the specified ID

  • :encryption (String)

    Whether the file should be encrypted and access restricted, e.g. if the file contains PII

  • :type (DocumentType)

    The type of documents

Returns:

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

    DocumentList data, response status code and response headers



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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 490

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[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DocumentsApi.list_documents, must be greater than or equal to 1.'
  end

  allowable_values = ["REQUIRED", "NOT_REQUIRED"]
  if @api_client.config.client_side_validation && opts[:'encryption'] && !allowable_values.include?(opts[:'encryption'])
    fail ArgumentError, "invalid value for \"encryption\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/documents'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :csv) if !opts[:'id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].nil?
  query_params[:'related_resource_type'] = opts[:'related_resource_type'] if !opts[:'related_resource_type'].nil?
  query_params[:'related_resource_id'] = opts[:'related_resource_id'] if !opts[:'related_resource_id'].nil?
  query_params[:'encryption'] = opts[:'encryption'] if !opts[:'encryption'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

  # 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] || ['bearerAuth']

  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

#update_document(document_id, patch_document, opts = {}) ⇒ Document

Update a document Update attributes of the latest document version.

Parameters:

  • document_id (String)

    The unique identifier of the document.

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

    the optional parameters

Returns:



555
556
557
558
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 555

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

#update_document_with_http_info(document_id, patch_document, opts = {}) ⇒ Array<(Document, Integer, Hash)>

Update a document Update attributes of the latest document version.

Parameters:

  • document_id (String)

    The unique identifier of the document.

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

    the optional parameters

Returns:

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

    Document data, response status code and response headers



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
615
616
617
618
619
620
621
# File 'lib/synctera_ruby_sdk/api/documents_api.rb', line 566

def update_document_with_http_info(document_id, patch_document, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocumentsApi.update_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.update_document"
  end
  # verify the required parameter 'patch_document' is set
  if @api_client.config.client_side_validation && patch_document.nil?
    fail ArgumentError, "Missing the required parameter 'patch_document' when calling DocumentsApi.update_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', 'application/problem+json'])
  # 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(patch_document)

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

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

  new_options = opts.merge(
    :operation => :"DocumentsApi.update_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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentsApi#update_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end