Class: TreezorClient::DocumentApi

Inherits:
Object
  • Object
show all
Defined in:
lib/treezor_client/api/document_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DocumentApi



19
20
21
# File 'lib/treezor_client/api/document_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/treezor_client/api/document_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_documents(user_id, document_type_id, name, file_content_base64, opts = {}) ⇒ InlineResponse20011

create a document Search for documents.

Options Hash (opts):

  • :access_signature (String)

    Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](agent.treezor.com/security-authentication).

  • :access_tag (String)

    Access tag is used for idem potency query. More info [here](agent.treezor.com/basics).

  • :access_user_id (Integer)

    Access user's id is used for user's action restriction. More info [here](agent.treezor.com/basics).

  • :access_user_ip (String)

    Access user's ip is used for user's action restriction. More info [here](agent.treezor.com/basics).

  • :document_tag (Integer)

    Custom data.



36
37
38
39
# File 'lib/treezor_client/api/document_api.rb', line 36

def create_documents(user_id, document_type_id, name, file_content_base64, opts = {})
  data, _status_code, _headers = create_documents_with_http_info(user_id, document_type_id, name, file_content_base64, opts)
  return data
end

#create_documents_with_http_info(user_id, document_type_id, name, file_content_base64, opts = {}) ⇒ Array<(InlineResponse20011, Fixnum, Hash)>

create a document Search for documents.

Options Hash (opts):

  • :access_signature (String)

    Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](agent.treezor.com/security-authentication).

  • :access_tag (String)

    Access tag is used for idem potency query. More info [here](agent.treezor.com/basics).

  • :access_user_id (Integer)

    Access user&#39;s id is used for user&#39;s action restriction. More info [here](agent.treezor.com/basics).

  • :access_user_ip (String)

    Access user&#39;s ip is used for user&#39;s action restriction. More info [here](agent.treezor.com/basics).

  • :document_tag (Integer)

    Custom data.



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
111
112
113
# File 'lib/treezor_client/api/document_api.rb', line 54

def create_documents_with_http_info(user_id, document_type_id, name, file_content_base64, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DocumentApi.create_documents ..."
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling DocumentApi.create_documents"
  end
  # verify the required parameter 'document_type_id' is set
  if @api_client.config.client_side_validation && document_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'document_type_id' when calling DocumentApi.create_documents"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling DocumentApi.create_documents"
  end
  # verify the required parameter 'file_content_base64' is set
  if @api_client.config.client_side_validation && file_content_base64.nil?
    fail ArgumentError, "Missing the required parameter 'file_content_base64' when calling DocumentApi.create_documents"
  end
  # resource path
  local_var_path = "/documents"

  # query parameters
  query_params = {}
  query_params[:'userId'] = user_id
  query_params[:'documentTypeId'] = document_type_id
  query_params[:'name'] = name
  query_params[:'fileContentBase64'] = file_content_base64
  query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?
  query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?
  query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?
  query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?
  query_params[:'documentTag'] = opts[:'document_tag'] if !opts[:'document_tag'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20011')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentApi#create_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_document(id, opts = {}) ⇒ InlineResponse20011

delete document Remove a document from the system.



120
121
122
123
# File 'lib/treezor_client/api/document_api.rb', line 120

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

#delete_document_with_http_info(id, opts = {}) ⇒ Array<(InlineResponse20011, Fixnum, Hash)>

delete document Remove a document from the system.



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
# File 'lib/treezor_client/api/document_api.rb', line 130

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

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20011')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentApi#delete_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_document(id, opts = {}) ⇒ InlineResponse20011

get a document get a document



175
176
177
178
# File 'lib/treezor_client/api/document_api.rb', line 175

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

#get_document_with_http_info(id, opts = {}) ⇒ Array<(InlineResponse20011, Fixnum, Hash)>

get a document get a document



185
186
187
188
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
# File 'lib/treezor_client/api/document_api.rb', line 185

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

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20011')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentApi#get_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_documents(opts = {}) ⇒ InlineResponse20011

search documents Search for documents.

Options Hash (opts):

  • :access_signature (String)

    Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](agent.treezor.com/security-authentication).

  • :access_tag (String)

    Access tag is used for idem potency query. More info [here](agent.treezor.com/basics).

  • :access_user_id (Integer)

    Access user&#39;s id is used for user&#39;s action restriction. More info [here](agent.treezor.com/basics).

  • :access_user_ip (String)

    Access user&#39;s ip is used for user&#39;s action restriction. More info [here](agent.treezor.com/basics).

  • :document_id (Integer)

    Document&#39;s unique id.

  • :document_tag (String)

    Custom data.

  • :document_status (String)

    The status of the document. Possible values: * PENDING * CANCELED * VALIDATED

  • :document_type_id (Integer)

    Document type id.

  • :document_type (String)

    Document&#39;s type.

  • :user_id (Integer)

    Document user&#39;s id.

  • :user_name (String)

    Document user&#39;s name.

  • :user_email (String)

    Document user&#39;s email.

  • :file_name (String)

    Document&#39;s name.

  • :file_size (Integer)

    Document&#39;s size.

  • :file_type (Integer)

    Document&#39;s type.

  • :is_agent (String)

    is agent field.

  • :page_number (Integer)

    Pagination page number. More info [here](agent.treezor.com/lists).

  • :page_count (Integer)

    The number of items per page. More info [here](agent.treezor.com/lists).

  • :sort_by (String)

    The transaction element you want to sort the list with. Default value : createdDate. More info [here](agent.treezor.com/lists).

  • :sort_order (String)

    The order you want to sort the list. * DESC for a descending sort * ASC for a ascending sort. Default value : DESC. More info [here](agent.treezor.com/lists).

  • :created_date_from (DateTime)

    The creation date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)

  • :created_date_to (DateTime)

    The creation date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)

  • :updated_date_from (DateTime)

    The modification date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)

  • :updated_date_to (DateTime)

    The modification date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)



253
254
255
256
# File 'lib/treezor_client/api/document_api.rb', line 253

def get_documents(opts = {})
  data, _status_code, _headers = get_documents_with_http_info(opts)
  return data
end

#get_documents_with_http_info(opts = {}) ⇒ Array<(InlineResponse20011, Fixnum, Hash)>

search documents Search for documents.

Options Hash (opts):

  • :access_signature (String)

    Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](agent.treezor.com/security-authentication).

  • :access_tag (String)

    Access tag is used for idem potency query. More info [here](agent.treezor.com/basics).

  • :access_user_id (Integer)

    Access user&#39;s id is used for user&#39;s action restriction. More info [here](agent.treezor.com/basics).

  • :access_user_ip (String)

    Access user&#39;s ip is used for user&#39;s action restriction. More info [here](agent.treezor.com/basics).

  • :document_id (Integer)

    Document&#39;s unique id.

  • :document_tag (String)

    Custom data.

  • :document_status (String)

    The status of the document. Possible values: * PENDING * CANCELED * VALIDATED

  • :document_type_id (Integer)

    Document type id.

  • :document_type (String)

    Document&#39;s type.

  • :user_id (Integer)

    Document user&#39;s id.

  • :user_name (String)

    Document user&#39;s name.

  • :user_email (String)

    Document user&#39;s email.

  • :file_name (String)

    Document&#39;s name.

  • :file_size (Integer)

    Document&#39;s size.

  • :file_type (Integer)

    Document&#39;s type.

  • :is_agent (String)

    is agent field.

  • :page_number (Integer)

    Pagination page number. More info [here](agent.treezor.com/lists).

  • :page_count (Integer)

    The number of items per page. More info [here](agent.treezor.com/lists).

  • :sort_by (String)

    The transaction element you want to sort the list with. Default value : createdDate. More info [here](agent.treezor.com/lists).

  • :sort_order (String)

    The order you want to sort the list. * DESC for a descending sort * ASC for a ascending sort. Default value : DESC. More info [here](agent.treezor.com/lists).

  • :created_date_from (DateTime)

    The creation date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)

  • :created_date_to (DateTime)

    The creation date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)

  • :updated_date_from (DateTime)

    The modification date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)

  • :updated_date_to (DateTime)

    The modification date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](agent.treezor.com/lists)



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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/treezor_client/api/document_api.rb', line 286

def get_documents_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DocumentApi.get_documents ..."
  end
  if @api_client.config.client_side_validation && opts[:'document_status'] && !['PENDING', 'CANCELED', 'VALIDATED'].include?(opts[:'document_status'])
    fail ArgumentError, 'invalid value for "document_status", must be one of PENDING, CANCELED, VALIDATED'
  end
  # resource path
  local_var_path = "/documents"

  # query parameters
  query_params = {}
  query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?
  query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?
  query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?
  query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?
  query_params[:'documentId'] = opts[:'document_id'] if !opts[:'document_id'].nil?
  query_params[:'documentTag'] = opts[:'document_tag'] if !opts[:'document_tag'].nil?
  query_params[:'documentStatus'] = opts[:'document_status'] if !opts[:'document_status'].nil?
  query_params[:'documentTypeId'] = opts[:'document_type_id'] if !opts[:'document_type_id'].nil?
  query_params[:'documentType'] = opts[:'document_type'] if !opts[:'document_type'].nil?
  query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'userName'] = opts[:'user_name'] if !opts[:'user_name'].nil?
  query_params[:'userEmail'] = opts[:'user_email'] if !opts[:'user_email'].nil?
  query_params[:'fileName'] = opts[:'file_name'] if !opts[:'file_name'].nil?
  query_params[:'fileSize'] = opts[:'file_size'] if !opts[:'file_size'].nil?
  query_params[:'fileType'] = opts[:'file_type'] if !opts[:'file_type'].nil?
  query_params[:'isAgent'] = opts[:'is_agent'] if !opts[:'is_agent'].nil?
  query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?
  query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
  query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
  query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?
  query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?
  query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?
  query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20011')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentApi#get_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_document(id, opts = {}) ⇒ InlineResponse20011

update a document Update a document.



354
355
356
357
# File 'lib/treezor_client/api/document_api.rb', line 354

def put_document(id, opts = {})
  data, _status_code, _headers = put_document_with_http_info(id, opts)
  return data
end

#put_document_with_http_info(id, opts = {}) ⇒ Array<(InlineResponse20011, Fixnum, Hash)>

update a document Update a document.



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
393
394
395
396
397
398
399
400
401
402
# File 'lib/treezor_client/api/document_api.rb', line 364

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

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20011')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocumentApi#put_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end