Class: FactPulse::DocumentConversionApi
- Inherits:
-
Object
- Object
- FactPulse::DocumentConversionApi
- Defined in:
- lib/factpulse/api/document_conversion_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#convert_document_api_v1_convert_post(file, opts = {}) ⇒ ConvertSuccessResponse
Convertir un document en Factur-X Convertit un document (PDF, DOCX, XLSX, image) en Factur-X conforme.
-
#convert_document_api_v1_convert_post_with_http_info(file, opts = {}) ⇒ Array<(ConvertSuccessResponse, Integer, Hash)>
Convertir un document en Factur-X Convertit un document (PDF, DOCX, XLSX, image) en Factur-X conforme.
-
#convert_document_async_api_v1_convert_async_post(file, opts = {}) ⇒ Object
Convertir un document en Factur-X (mode asynchrone) Lance une conversion asynchrone via Celery.
-
#convert_document_async_api_v1_convert_async_post_with_http_info(file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Convertir un document en Factur-X (mode asynchrone) Lance une conversion asynchrone via Celery.
-
#download_file_api_v1_convert_conversion_id_download_filename_get(conversion_id, filename, opts = {}) ⇒ Object
Télécharger un fichier généré Télécharge le fichier Factur-X PDF ou XML généré.
-
#download_file_api_v1_convert_conversion_id_download_filename_get_with_http_info(conversion_id, filename, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Télécharger un fichier généré Télécharge le fichier Factur-X PDF ou XML généré.
-
#get_conversion_status_api_v1_convert_conversion_id_status_get(conversion_id, opts = {}) ⇒ Hash<String, Object>
Vérifier le statut d'une conversion Retourne le statut actuel d'une conversion asynchrone.
-
#get_conversion_status_api_v1_convert_conversion_id_status_get_with_http_info(conversion_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Vérifier le statut d'une conversion Retourne le statut actuel d'une conversion asynchrone.
-
#initialize(api_client = ApiClient.default) ⇒ DocumentConversionApi
constructor
A new instance of DocumentConversionApi.
-
#resume_conversion_api_v1_convert_conversion_id_resume_post(conversion_id, convert_resume_request, opts = {}) ⇒ ConvertSuccessResponse
Reprendre une conversion avec corrections Reprend une conversion après complétion des données manquantes ou correction des erreurs.
-
#resume_conversion_api_v1_convert_conversion_id_resume_post_with_http_info(conversion_id, convert_resume_request, opts = {}) ⇒ Array<(ConvertSuccessResponse, Integer, Hash)>
Reprendre une conversion avec corrections Reprend une conversion après complétion des données manquantes ou correction des erreurs.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ DocumentConversionApi
Returns a new instance of DocumentConversionApi.
19 20 21 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#convert_document_api_v1_convert_post(file, opts = {}) ⇒ ConvertSuccessResponse
Convertir un document en Factur-X Convertit un document (PDF, DOCX, XLSX, image) en Factur-X conforme. ## Workflow 1. Upload : Le document est envoyé en multipart/form-data 2. Extraction OCR + Classification : Mistral OCR extrait les données et classifie le document en un seul appel 3. Enrichissement : Les données sont enrichies via SIRENE (SIRET → raison sociale) 4. Validation : Les règles Schematron sont appliquées 5. Génération : Le Factur-X PDF/A-3 est généré ## Réponses possibles - 200 : Conversion réussie, fichiers disponibles - 202 : Données manquantes, complétion requise - 422 : Validation échouée, corrections nécessaires - 400 : Fichier invalide - 429 : Quota dépassé
29 30 31 32 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 29 def convert_document_api_v1_convert_post(file, opts = {}) data, _status_code, _headers = convert_document_api_v1_convert_post_with_http_info(file, opts) data end |
#convert_document_api_v1_convert_post_with_http_info(file, opts = {}) ⇒ Array<(ConvertSuccessResponse, Integer, Hash)>
Convertir un document en Factur-X Convertit un document (PDF, DOCX, XLSX, image) en Factur-X conforme. ## Workflow 1. Upload : Le document est envoyé en multipart/form-data 2. Extraction OCR + Classification : Mistral OCR extrait les données et classifie le document en un seul appel 3. Enrichissement : Les données sont enrichies via SIRENE (SIRET → raison sociale) 4. Validation : Les règles Schematron sont appliquées 5. Génération : Le Factur-X PDF/A-3 est généré ## Réponses possibles - 200 : Conversion réussie, fichiers disponibles - 202 : Données manquantes, complétion requise - 422 : Validation échouée, corrections nécessaires - 400 : Fichier invalide - 429 : Quota dépassé
41 42 43 44 45 46 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 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 41 def convert_document_api_v1_convert_post_with_http_info(file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DocumentConversionApi.convert_document_api_v1_convert_post ...' 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 DocumentConversionApi.convert_document_api_v1_convert_post" end # resource path local_var_path = '/api/v1/convert' # 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['output'] = opts[:'output'] if !opts[:'output'].nil? form_params['callback_url'] = opts[:'callback_url'] if !opts[:'callback_url'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ConvertSuccessResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"DocumentConversionApi.convert_document_api_v1_convert_post", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentConversionApi#convert_document_api_v1_convert_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#convert_document_async_api_v1_convert_async_post(file, opts = {}) ⇒ Object
Convertir un document en Factur-X (mode asynchrone) Lance une conversion asynchrone via Celery. ## Workflow 1. Upload : Le document est envoyé en multipart/form-data 2. Task Celery : La tâche est mise en file d'attente 3. Callback : Notification par webhook à la fin ## Réponses possibles - 202 : Tâche acceptée, en cours de traitement - 400 : Fichier invalide
104 105 106 107 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 104 def convert_document_async_api_v1_convert_async_post(file, opts = {}) data, _status_code, _headers = convert_document_async_api_v1_convert_async_post_with_http_info(file, opts) data end |
#convert_document_async_api_v1_convert_async_post_with_http_info(file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Convertir un document en Factur-X (mode asynchrone) Lance une conversion asynchrone via Celery. ## Workflow 1. Upload : Le document est envoyé en multipart/form-data 2. Task Celery : La tâche est mise en file d'attente 3. Callback : Notification par webhook à la fin ## Réponses possibles - 202 : Tâche acceptée, en cours de traitement - 400 : Fichier invalide
116 117 118 119 120 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 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 116 def convert_document_async_api_v1_convert_async_post_with_http_info(file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DocumentConversionApi.convert_document_async_api_v1_convert_async_post ...' 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 DocumentConversionApi.convert_document_async_api_v1_convert_async_post" end # resource path local_var_path = '/api/v1/convert/async' # 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['output'] = opts[:'output'] if !opts[:'output'].nil? form_params['callback_url'] = opts[:'callback_url'] if !opts[:'callback_url'].nil? # 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] || ['HTTPBearer'] = opts.merge( :operation => :"DocumentConversionApi.convert_document_async_api_v1_convert_async_post", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentConversionApi#convert_document_async_api_v1_convert_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#download_file_api_v1_convert_conversion_id_download_filename_get(conversion_id, filename, opts = {}) ⇒ Object
Télécharger un fichier généré
Télécharge le fichier Factur-X PDF ou XML généré. ## Fichiers disponibles - facturx.pdf : PDF/A-3 avec XML embarqué - facturx.xml : XML CII seul (Cross Industry Invoice) Les fichiers sont disponibles pendant 24 heures après génération.
178 179 180 181 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 178 def download_file_api_v1_convert_conversion_id_download_filename_get(conversion_id, filename, opts = {}) data, _status_code, _headers = download_file_api_v1_convert_conversion_id_download_filename_get_with_http_info(conversion_id, filename, opts) data end |
#download_file_api_v1_convert_conversion_id_download_filename_get_with_http_info(conversion_id, filename, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Télécharger un fichier généré Télécharge le fichier Factur-X PDF ou XML généré. ## Fichiers disponibles - `facturx.pdf` : PDF/A-3 avec XML embarqué - `facturx.xml` : XML CII seul (Cross Industry Invoice) Les fichiers sont disponibles pendant 24 heures après génération.
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 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 189 def download_file_api_v1_convert_conversion_id_download_filename_get_with_http_info(conversion_id, filename, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get ...' end # verify the required parameter 'conversion_id' is set if @api_client.config.client_side_validation && conversion_id.nil? fail ArgumentError, "Missing the required parameter 'conversion_id' when calling DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get" end # verify the required parameter 'filename' is set if @api_client.config.client_side_validation && filename.nil? fail ArgumentError, "Missing the required parameter 'filename' when calling DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get" end # resource path local_var_path = '/api/v1/convert/{conversion_id}/download/{filename}'.sub('{' + 'conversion_id' + '}', CGI.escape(conversion_id.to_s)).sub('{' + 'filename' + '}', CGI.escape(filename.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'] # 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] || ['HTTPBearer'] = opts.merge( :operation => :"DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentConversionApi#download_file_api_v1_convert_conversion_id_download_filename_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_conversion_status_api_v1_convert_conversion_id_status_get(conversion_id, opts = {}) ⇒ Hash<String, Object>
Vérifier le statut d'une conversion Retourne le statut actuel d'une conversion asynchrone.
246 247 248 249 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 246 def get_conversion_status_api_v1_convert_conversion_id_status_get(conversion_id, opts = {}) data, _status_code, _headers = get_conversion_status_api_v1_convert_conversion_id_status_get_with_http_info(conversion_id, opts) data end |
#get_conversion_status_api_v1_convert_conversion_id_status_get_with_http_info(conversion_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Vérifier le statut d'une conversion Retourne le statut actuel d'une conversion asynchrone.
256 257 258 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 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 256 def get_conversion_status_api_v1_convert_conversion_id_status_get_with_http_info(conversion_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DocumentConversionApi.get_conversion_status_api_v1_convert_conversion_id_status_get ...' end # verify the required parameter 'conversion_id' is set if @api_client.config.client_side_validation && conversion_id.nil? fail ArgumentError, "Missing the required parameter 'conversion_id' when calling DocumentConversionApi.get_conversion_status_api_v1_convert_conversion_id_status_get" end # resource path local_var_path = '/api/v1/convert/{conversion_id}/status'.sub('{' + 'conversion_id' + '}', CGI.escape(conversion_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'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"DocumentConversionApi.get_conversion_status_api_v1_convert_conversion_id_status_get", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentConversionApi#get_conversion_status_api_v1_convert_conversion_id_status_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#resume_conversion_api_v1_convert_conversion_id_resume_post(conversion_id, convert_resume_request, opts = {}) ⇒ ConvertSuccessResponse
Reprendre une conversion avec corrections Reprend une conversion après complétion des données manquantes ou correction des erreurs. L'extraction OCR est conservée, les données sont mises à jour avec les corrections, puis une nouvelle validation Schematron est effectuée.
310 311 312 313 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 310 def resume_conversion_api_v1_convert_conversion_id_resume_post(conversion_id, convert_resume_request, opts = {}) data, _status_code, _headers = resume_conversion_api_v1_convert_conversion_id_resume_post_with_http_info(conversion_id, convert_resume_request, opts) data end |
#resume_conversion_api_v1_convert_conversion_id_resume_post_with_http_info(conversion_id, convert_resume_request, opts = {}) ⇒ Array<(ConvertSuccessResponse, Integer, Hash)>
Reprendre une conversion avec corrections Reprend une conversion après complétion des données manquantes ou correction des erreurs. L'extraction OCR est conservée, les données sont mises à jour avec les corrections, puis une nouvelle validation Schematron est effectuée.
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 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 |
# File 'lib/factpulse/api/document_conversion_api.rb', line 321 def resume_conversion_api_v1_convert_conversion_id_resume_post_with_http_info(conversion_id, convert_resume_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post ...' end # verify the required parameter 'conversion_id' is set if @api_client.config.client_side_validation && conversion_id.nil? fail ArgumentError, "Missing the required parameter 'conversion_id' when calling DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post" end # verify the required parameter 'convert_resume_request' is set if @api_client.config.client_side_validation && convert_resume_request.nil? fail ArgumentError, "Missing the required parameter 'convert_resume_request' when calling DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post" end # resource path local_var_path = '/api/v1/convert/{conversion_id}/resume'.sub('{' + 'conversion_id' + '}', CGI.escape(conversion_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 # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(convert_resume_request) # return_type return_type = opts[:debug_return_type] || 'ConvertSuccessResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentConversionApi#resume_conversion_api_v1_convert_conversion_id_resume_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |