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 = {}) ⇒ InlineResponse20012

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.

  • :access_tag (String)

    Access tag is used for idem potency query. More info here.

  • :access_user_id (Integer)

    Access user's id is used for user's action restriction. More info here.

  • :access_user_ip (String)

    Access user's ip is used for user's action restriction. More info here.

  • :document_tag (Integer)

    Custom data.

  • :residence_id (Integer)

    Document residence Id. The field is mandatory when the document is of type id 24 or 25. Otherwise it should not be provided.



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)
  data
end

#create_documents_with_http_info(user_id, document_type_id, name, file_content_base64, opts = {}) ⇒ Array<(InlineResponse20012, 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.

  • :access_tag (String)

    Access tag is used for idem potency query. More info here.

  • :access_user_id (Integer)

    Access user's id is used for user's action restriction. More info here.

  • :access_user_ip (String)

    Access user's ip is used for user's action restriction. More info here.

  • :document_tag (Integer)

    Custom data.

  • :residence_id (Integer)

    Document residence Id. The field is mandatory when the document is of type id 24 or 25. Otherwise it should not be provided.



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
114
115
116
117
118
119
# File 'lib/treezor_client/api/document_api.rb', line 55

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
  if @api_client.config.client_side_validation && !opts[:'residence_id'].nil? && opts[:'residence_id'] < 1
    fail ArgumentError, 'invalid value for "opts[:"residence_id"]" when calling DocumentApi.create_documents, must be greater than or equal to 1.'
  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[:'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?
  query_params[:'residenceId'] = opts[:'residence_id'] if !opts[:'residence_id'].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/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params['fileContentBase64'] = file_content_base64

  # 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 => 'InlineResponse20012')
  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 = {}) ⇒ InlineResponse20012

delete document Remove a document from the system.



125
126
127
128
# File 'lib/treezor_client/api/document_api.rb', line 125

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

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

delete document Remove a document from the system.



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

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 => 'InlineResponse20012')
  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 = {}) ⇒ InlineResponse20012

get a document get a document



179
180
181
182
# File 'lib/treezor_client/api/document_api.rb', line 179

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

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

get a document get a document



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

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 => 'InlineResponse20012')
  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 = {}) ⇒ InlineResponse20012

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.

  • :access_tag (String)

    Access tag is used for idem potency query. More info here.

  • :access_user_id (Integer)

    Access user's id is used for user's action restriction. More info here.

  • :access_user_ip (String)

    Access user's ip is used for user's action restriction. More info here.

  • :document_id (Integer)

    Document's unique id.

  • :document_tag (String)

    Custom data.

  • :document_status (String)

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

  • :document_type_id (Integer)

    Document type id.

  • :document_type (String)

    Document's type.

  • :user_id (Integer)

    Document user's id.

  • :user_name (String)

    Document user's name.

  • :user_email (String)

    Document user's email.

  • :file_name (String)

    Document's name.

  • :file_size (Integer)

    Document's size.

  • :file_type (Integer)

    Document's type.

  • :is_agent (String)

    is agent field.

  • :page_number (Integer)

    Pagination page number. More info here.

  • :page_count (Integer)

    The number of items per page. More info here.

  • :sort_by (String)

    The transaction element you want to sort the list with. Default value : createdDate. More info here.

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

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

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

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

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



256
257
258
259
# File 'lib/treezor_client/api/document_api.rb', line 256

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

#get_documents_with_http_info(opts = {}) ⇒ Array<(InlineResponse20012, 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.

  • :access_tag (String)

    Access tag is used for idem potency query. More info here.

  • :access_user_id (Integer)

    Access user's id is used for user's action restriction. More info here.

  • :access_user_ip (String)

    Access user's ip is used for user's action restriction. More info here.

  • :document_id (Integer)

    Document's unique id.

  • :document_tag (String)

    Custom data.

  • :document_status (String)

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

  • :document_type_id (Integer)

    Document type id.

  • :document_type (String)

    Document's type.

  • :user_id (Integer)

    Document user's id.

  • :user_name (String)

    Document user's name.

  • :user_email (String)

    Document user's email.

  • :file_name (String)

    Document's name.

  • :file_size (Integer)

    Document's size.

  • :file_type (Integer)

    Document's type.

  • :is_agent (String)

    is agent field.

  • :page_number (Integer)

    Pagination page number. More info here.

  • :page_count (Integer)

    The number of items per page. More info here.

  • :sort_by (String)

    The transaction element you want to sort the list with. Default value : createdDate. More info here.

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

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

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

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

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



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

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', 'REFUSED'].include?(opts[:'document_status'])
    fail ArgumentError, 'invalid value for "document_status", must be one of PENDING, CANCELED, VALIDATED, REFUSED'
  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 => 'InlineResponse20012')
  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 = {}) ⇒ InlineResponse20012

update a document Update a document.



356
357
358
359
# File 'lib/treezor_client/api/document_api.rb', line 356

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

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

update a document Update a document.



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

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 => 'InlineResponse20012')
  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