factpulse 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +28 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +74 -0
  5. data/LICENSE +21 -0
  6. data/README.md +207 -0
  7. data/Rakefile +10 -0
  8. data/docs/AFNORPDPPAApi.md +69 -0
  9. data/docs/AFNORPDPPADirectoryServiceApi.md +1313 -0
  10. data/docs/AFNORPDPPAFlowServiceApi.md +258 -0
  11. data/docs/APIError.md +22 -0
  12. data/docs/AdresseElectronique.md +20 -0
  13. data/docs/AdressePostale.md +26 -0
  14. data/docs/CadreDeFacturation.md +22 -0
  15. data/docs/CategorieTVA.md +15 -0
  16. data/docs/CertificateInfoResponse.md +40 -0
  17. data/docs/ChorusProApi.md +1125 -0
  18. data/docs/ChorusProCredentials.md +26 -0
  19. data/docs/CodeCadreFacturation.md +15 -0
  20. data/docs/CodeRaisonReduction.md +15 -0
  21. data/docs/ConsulterFactureRequest.md +20 -0
  22. data/docs/ConsulterFactureResponse.md +34 -0
  23. data/docs/ConsulterStructureRequest.md +22 -0
  24. data/docs/ConsulterStructureResponse.md +34 -0
  25. data/docs/CredentialsAFNOR.md +22 -0
  26. data/docs/CredentialsChorusPro.md +26 -0
  27. data/docs/Destinataire.md +28 -0
  28. data/docs/Destination.md +79 -0
  29. data/docs/DestinationAFNOR.md +24 -0
  30. data/docs/DestinationChorusPro.md +20 -0
  31. data/docs/DonneesFactureSimplifiees.md +34 -0
  32. data/docs/ErrorLevel.md +15 -0
  33. data/docs/ErrorSource.md +15 -0
  34. data/docs/FactureEnrichieInfo.md +32 -0
  35. data/docs/FactureFacturX.md +46 -0
  36. data/docs/FormatSortie.md +15 -0
  37. data/docs/Fournisseur.md +36 -0
  38. data/docs/GenerateCertificateRequest.md +38 -0
  39. data/docs/GenerateCertificateResponse.md +32 -0
  40. data/docs/HTTPValidationError.md +18 -0
  41. data/docs/InformationSignatureAPI.md +28 -0
  42. data/docs/LigneDePoste.md +46 -0
  43. data/docs/LigneDePosteMontantRemiseHt.md +15 -0
  44. data/docs/LigneDePosteTauxTvaManuel.md +15 -0
  45. data/docs/LigneDeTVA.md +26 -0
  46. data/docs/ModeDepot.md +15 -0
  47. data/docs/ModePaiement.md +15 -0
  48. data/docs/MontantAPayer.md +15 -0
  49. data/docs/MontantBaseHt.md +15 -0
  50. data/docs/MontantHtTotal.md +15 -0
  51. data/docs/MontantRemiseGlobaleTtc.md +15 -0
  52. data/docs/MontantTotal.md +30 -0
  53. data/docs/MontantTotalAcompte.md +15 -0
  54. data/docs/MontantTotalLigneHt.md +15 -0
  55. data/docs/MontantTtcTotal.md +15 -0
  56. data/docs/MontantTva.md +15 -0
  57. data/docs/MontantTvaLigne.md +15 -0
  58. data/docs/MontantTvaTotal.md +15 -0
  59. data/docs/MontantUnitaireHt.md +15 -0
  60. data/docs/Note.md +20 -0
  61. data/docs/ObtenirIdChorusProRequest.md +22 -0
  62. data/docs/ObtenirIdChorusProResponse.md +24 -0
  63. data/docs/OptionsProcessing.md +24 -0
  64. data/docs/PDFFacturXInfo.md +22 -0
  65. data/docs/ParametresSignature.md +34 -0
  66. data/docs/ParametresStructure.md +22 -0
  67. data/docs/PieceJointeComplementaire.md +26 -0
  68. data/docs/ProfilAPI.md +15 -0
  69. data/docs/Quantite.md +15 -0
  70. data/docs/RechercherServicesResponse.md +24 -0
  71. data/docs/RechercherStructureRequest.md +26 -0
  72. data/docs/RechercherStructureResponse.md +24 -0
  73. data/docs/References.md +32 -0
  74. data/docs/ReponseTache.md +18 -0
  75. data/docs/ReponseValidationErreur.md +18 -0
  76. data/docs/ReponseValidationSucces.md +18 -0
  77. data/docs/ResultatAFNOR.md +26 -0
  78. data/docs/ResultatChorusPro.md +22 -0
  79. data/docs/ResultatValidationPDFAPI.md +62 -0
  80. data/docs/SantApi.md +131 -0
  81. data/docs/SchemeID.md +15 -0
  82. data/docs/ServiceStructure.md +24 -0
  83. data/docs/SignatureInfo.md +22 -0
  84. data/docs/SoumettreFactureCompleteRequest.md +26 -0
  85. data/docs/SoumettreFactureCompleteResponse.md +34 -0
  86. data/docs/SoumettreFactureRequest.md +46 -0
  87. data/docs/SoumettreFactureResponse.md +24 -0
  88. data/docs/StatutCelery.md +15 -0
  89. data/docs/StatutFacture.md +22 -0
  90. data/docs/StatutTache.md +22 -0
  91. data/docs/StructureInfo.md +26 -0
  92. data/docs/Tauxmanuel.md +15 -0
  93. data/docs/TraitementFactureApi.md +831 -0
  94. data/docs/TypeFacture.md +15 -0
  95. data/docs/TypeTVA.md +15 -0
  96. data/docs/Unite.md +15 -0
  97. data/docs/UtilisateurApi.md +74 -0
  98. data/docs/ValidationError.md +22 -0
  99. data/docs/ValidationErrorDetail.md +26 -0
  100. data/docs/ValidationErrorLocInner.md +15 -0
  101. data/factpulse.gemspec +39 -0
  102. data/git_push.sh +57 -0
  103. data/lib/factpulse/api/afnorpdppa_api.rb +79 -0
  104. data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +1183 -0
  105. data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +256 -0
  106. data/lib/factpulse/api/chorus_pro_api.rb +1103 -0
  107. data/lib/factpulse/api/sant_api.rb +136 -0
  108. data/lib/factpulse/api/traitement_facture_api.rb +835 -0
  109. data/lib/factpulse/api/utilisateur_api.rb +79 -0
  110. data/lib/factpulse/api_client.rb +397 -0
  111. data/lib/factpulse/api_error.rb +58 -0
  112. data/lib/factpulse/api_model_base.rb +88 -0
  113. data/lib/factpulse/configuration.rb +308 -0
  114. data/lib/factpulse/helpers/client.rb +300 -0
  115. data/lib/factpulse/helpers/exceptions.rb +21 -0
  116. data/lib/factpulse/helpers.rb +13 -0
  117. data/lib/factpulse/models/adresse_electronique.rb +196 -0
  118. data/lib/factpulse/models/adresse_postale.rb +189 -0
  119. data/lib/factpulse/models/api_error.rb +205 -0
  120. data/lib/factpulse/models/cadre_de_facturation.rb +207 -0
  121. data/lib/factpulse/models/categorie_tva.rb +47 -0
  122. data/lib/factpulse/models/certificate_info_response.rb +446 -0
  123. data/lib/factpulse/models/chorus_pro_credentials.rb +259 -0
  124. data/lib/factpulse/models/code_cadre_facturation.rb +42 -0
  125. data/lib/factpulse/models/code_raison_reduction.rb +45 -0
  126. data/lib/factpulse/models/consulter_facture_request.rb +176 -0
  127. data/lib/factpulse/models/consulter_facture_response.rb +261 -0
  128. data/lib/factpulse/models/consulter_structure_request.rb +188 -0
  129. data/lib/factpulse/models/consulter_structure_response.rb +261 -0
  130. data/lib/factpulse/models/credentials_afnor.rb +169 -0
  131. data/lib/factpulse/models/credentials_chorus_pro.rb +191 -0
  132. data/lib/factpulse/models/destinataire.rb +215 -0
  133. data/lib/factpulse/models/destination.rb +56 -0
  134. data/lib/factpulse/models/destination_afnor.rb +228 -0
  135. data/lib/factpulse/models/destination_chorus_pro.rb +194 -0
  136. data/lib/factpulse/models/donnees_facture_simplifiees.rb +342 -0
  137. data/lib/factpulse/models/error_level.rb +40 -0
  138. data/lib/factpulse/models/error_source.rb +46 -0
  139. data/lib/factpulse/models/facture_enrichie_info.rb +348 -0
  140. data/lib/factpulse/models/facture_factur_x.rb +443 -0
  141. data/lib/factpulse/models/format_sortie.rb +40 -0
  142. data/lib/factpulse/models/fournisseur.rb +271 -0
  143. data/lib/factpulse/models/generate_certificate_request.rb +323 -0
  144. data/lib/factpulse/models/generate_certificate_response.rb +254 -0
  145. data/lib/factpulse/models/http_validation_error.rb +149 -0
  146. data/lib/factpulse/models/information_signature_api.rb +216 -0
  147. data/lib/factpulse/models/ligne_de_poste.rb +390 -0
  148. data/lib/factpulse/models/ligne_de_poste_montant_remise_ht.rb +104 -0
  149. data/lib/factpulse/models/ligne_de_poste_taux_tva_manuel.rb +104 -0
  150. data/lib/factpulse/models/ligne_de_tva.rb +242 -0
  151. data/lib/factpulse/models/mode_depot.rb +41 -0
  152. data/lib/factpulse/models/mode_paiement.rb +44 -0
  153. data/lib/factpulse/models/montant_a_payer.rb +104 -0
  154. data/lib/factpulse/models/montant_base_ht.rb +104 -0
  155. data/lib/factpulse/models/montant_ht_total.rb +104 -0
  156. data/lib/factpulse/models/montant_remise_globale_ttc.rb +104 -0
  157. data/lib/factpulse/models/montant_total.rb +272 -0
  158. data/lib/factpulse/models/montant_total_acompte.rb +104 -0
  159. data/lib/factpulse/models/montant_total_ligne_ht.rb +104 -0
  160. data/lib/factpulse/models/montant_ttc_total.rb +104 -0
  161. data/lib/factpulse/models/montant_tva.rb +104 -0
  162. data/lib/factpulse/models/montant_tva_ligne.rb +104 -0
  163. data/lib/factpulse/models/montant_tva_total.rb +104 -0
  164. data/lib/factpulse/models/montant_unitaire_ht.rb +104 -0
  165. data/lib/factpulse/models/note.rb +175 -0
  166. data/lib/factpulse/models/obtenir_id_chorus_pro_request.rb +188 -0
  167. data/lib/factpulse/models/obtenir_id_chorus_pro_response.rb +230 -0
  168. data/lib/factpulse/models/options_processing.rb +207 -0
  169. data/lib/factpulse/models/parametres_signature.rb +235 -0
  170. data/lib/factpulse/models/parametres_structure.rb +175 -0
  171. data/lib/factpulse/models/pdf_factur_x_info.rb +205 -0
  172. data/lib/factpulse/models/piece_jointe_complementaire.rb +269 -0
  173. data/lib/factpulse/models/profil_api.rb +42 -0
  174. data/lib/factpulse/models/quantite.rb +104 -0
  175. data/lib/factpulse/models/rechercher_services_response.rb +214 -0
  176. data/lib/factpulse/models/rechercher_structure_request.rb +191 -0
  177. data/lib/factpulse/models/rechercher_structure_response.rb +216 -0
  178. data/lib/factpulse/models/references.rb +290 -0
  179. data/lib/factpulse/models/reponse_tache.rb +165 -0
  180. data/lib/factpulse/models/reponse_validation_erreur.rb +167 -0
  181. data/lib/factpulse/models/reponse_validation_succes.rb +165 -0
  182. data/lib/factpulse/models/resultat_afnor.rb +240 -0
  183. data/lib/factpulse/models/resultat_chorus_pro.rb +186 -0
  184. data/lib/factpulse/models/resultat_validation_pdfapi.rb +523 -0
  185. data/lib/factpulse/models/scheme_id.rb +43 -0
  186. data/lib/factpulse/models/service_structure.rb +247 -0
  187. data/lib/factpulse/models/signature_info.rb +186 -0
  188. data/lib/factpulse/models/soumettre_facture_complete_request.rb +239 -0
  189. data/lib/factpulse/models/soumettre_facture_complete_response.rb +355 -0
  190. data/lib/factpulse/models/soumettre_facture_request.rb +388 -0
  191. data/lib/factpulse/models/soumettre_facture_response.rb +213 -0
  192. data/lib/factpulse/models/statut_celery.rb +43 -0
  193. data/lib/factpulse/models/statut_facture.rb +203 -0
  194. data/lib/factpulse/models/statut_tache.rb +226 -0
  195. data/lib/factpulse/models/structure_info.rb +274 -0
  196. data/lib/factpulse/models/tauxmanuel.rb +104 -0
  197. data/lib/factpulse/models/type_facture.rb +40 -0
  198. data/lib/factpulse/models/type_tva.rb +42 -0
  199. data/lib/factpulse/models/unite.rb +44 -0
  200. data/lib/factpulse/models/validation_error.rb +218 -0
  201. data/lib/factpulse/models/validation_error_detail.rb +245 -0
  202. data/lib/factpulse/models/validation_error_loc_inner.rb +103 -0
  203. data/lib/factpulse/version.rb +15 -0
  204. data/lib/factpulse.rb +133 -0
  205. metadata +345 -0
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #API REST FactPulse
3
+
4
+ # API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Paramètre optionnel `client_uid` :** Pour sélectionner les credentials d'un client spécifique (PA/PDP, Chorus Pro, certificats de signature), ajoutez `client_uid` : ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` Le `client_uid` sera inclus dans le JWT et permettra à l'API d'utiliser automatiquement : - Les credentials AFNOR/PDP configurés pour ce client - Les credentials Chorus Pro configurés pour ce client - Les certificats de signature électronique configurés pour ce client **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Représente une adresse de facturation électronique, composée d'un identifiant et de son schéma (SchemeID) conformément à la norme EN16931. Exemple: { \"identifiant\": \"123456789\", \"scheme_id\": \"0225\" }
18
+ class AdresseElectronique < ApiModelBase
19
+ attr_accessor :identifiant
20
+
21
+ attr_accessor :scheme_id
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'identifiant' => :'identifiant',
49
+ :'scheme_id' => :'schemeId'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'identifiant' => :'String',
67
+ :'scheme_id' => :'SchemeID'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::AdresseElectronique` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::AdresseElectronique`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'identifiant')
94
+ self.identifiant = attributes[:'identifiant']
95
+ else
96
+ self.identifiant = nil
97
+ end
98
+
99
+ if attributes.key?(:'scheme_id')
100
+ self.scheme_id = attributes[:'scheme_id']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @identifiant.nil?
110
+ invalid_properties.push('invalid value for "identifiant", identifiant cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @identifiant.nil?
121
+ true
122
+ end
123
+
124
+ # Custom attribute writer method with validation
125
+ # @param [Object] identifiant Value to be assigned
126
+ def identifiant=(identifiant)
127
+ if identifiant.nil?
128
+ fail ArgumentError, 'identifiant cannot be nil'
129
+ end
130
+
131
+ @identifiant = identifiant
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ identifiant == o.identifiant &&
140
+ scheme_id == o.scheme_id
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [identifiant, scheme_id].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ attributes = attributes.transform_keys(&:to_sym)
161
+ transformed_hash = {}
162
+ openapi_types.each_pair do |key, type|
163
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = nil
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[attribute_map[key]].is_a?(Array)
169
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
170
+ end
171
+ elsif !attributes[attribute_map[key]].nil?
172
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
173
+ end
174
+ end
175
+ new(transformed_hash)
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ end
195
+
196
+ end
@@ -0,0 +1,189 @@
1
+ =begin
2
+ #API REST FactPulse
3
+
4
+ # API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Paramètre optionnel `client_uid` :** Pour sélectionner les credentials d'un client spécifique (PA/PDP, Chorus Pro, certificats de signature), ajoutez `client_uid` : ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` Le `client_uid` sera inclus dans le JWT et permettra à l'API d'utiliser automatiquement : - Les credentials AFNOR/PDP configurés pour ce client - Les credentials Chorus Pro configurés pour ce client - Les certificats de signature électronique configurés pour ce client **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Représente une adresse postale.
18
+ class AdressePostale < ApiModelBase
19
+ attr_accessor :code_postal
20
+
21
+ attr_accessor :ligne_un
22
+
23
+ attr_accessor :ligne_deux
24
+
25
+ attr_accessor :nom_ville
26
+
27
+ attr_accessor :pays_code_iso
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'code_postal' => :'codePostal',
33
+ :'ligne_un' => :'ligneUn',
34
+ :'ligne_deux' => :'ligneDeux',
35
+ :'nom_ville' => :'nomVille',
36
+ :'pays_code_iso' => :'paysCodeIso'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'code_postal' => :'String',
54
+ :'ligne_un' => :'String',
55
+ :'ligne_deux' => :'String',
56
+ :'nom_ville' => :'String',
57
+ :'pays_code_iso' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ :'code_postal',
65
+ :'ligne_un',
66
+ :'ligne_deux',
67
+ :'nom_ville',
68
+ :'pays_code_iso'
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::AdressePostale` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::AdressePostale`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'code_postal')
89
+ self.code_postal = attributes[:'code_postal']
90
+ end
91
+
92
+ if attributes.key?(:'ligne_un')
93
+ self.ligne_un = attributes[:'ligne_un']
94
+ end
95
+
96
+ if attributes.key?(:'ligne_deux')
97
+ self.ligne_deux = attributes[:'ligne_deux']
98
+ end
99
+
100
+ if attributes.key?(:'nom_ville')
101
+ self.nom_ville = attributes[:'nom_ville']
102
+ end
103
+
104
+ if attributes.key?(:'pays_code_iso')
105
+ self.pays_code_iso = attributes[:'pays_code_iso']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
113
+ invalid_properties = Array.new
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ code_postal == o.code_postal &&
130
+ ligne_un == o.ligne_un &&
131
+ ligne_deux == o.ligne_deux &&
132
+ nom_ville == o.nom_ville &&
133
+ pays_code_iso == o.pays_code_iso
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [code_postal, ligne_un, ligne_deux, nom_ville, pays_code_iso].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ transformed_hash = {}
155
+ openapi_types.each_pair do |key, type|
156
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = nil
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[attribute_map[key]].is_a?(Array)
162
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
163
+ end
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
166
+ end
167
+ end
168
+ new(transformed_hash)
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ if value.nil?
178
+ is_nullable = self.class.openapi_nullable.include?(attr)
179
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
180
+ end
181
+
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ end
188
+
189
+ end
@@ -0,0 +1,205 @@
1
+ =begin
2
+ #API REST FactPulse
3
+
4
+ # API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Paramètre optionnel `client_uid` :** Pour sélectionner les credentials d'un client spécifique (PA/PDP, Chorus Pro, certificats de signature), ajoutez `client_uid` : ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` Le `client_uid` sera inclus dans le JWT et permettra à l'API d'utiliser automatiquement : - Les credentials AFNOR/PDP configurés pour ce client - Les credentials Chorus Pro configurés pour ce client - Les certificats de signature électronique configurés pour ce client **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Erreur API standardisée (alignée sur AFNOR Error schema). Format unifié pour toutes les réponses d'erreur HTTP.
18
+ class APIError < ApiModelBase
19
+ # Code alphanumérique identifiant précisément l'erreur
20
+ attr_accessor :error_code
21
+
22
+ # Message décrivant l'erreur (non destiné à l'utilisateur final)
23
+ attr_accessor :error_message
24
+
25
+ attr_accessor :details
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'error_code' => :'errorCode',
31
+ :'error_message' => :'errorMessage',
32
+ :'details' => :'details'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'error_code' => :'String',
50
+ :'error_message' => :'String',
51
+ :'details' => :'Array<ValidationErrorDetail>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'details'
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::APIError` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::APIError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'error_code')
79
+ self.error_code = attributes[:'error_code']
80
+ else
81
+ self.error_code = nil
82
+ end
83
+
84
+ if attributes.key?(:'error_message')
85
+ self.error_message = attributes[:'error_message']
86
+ else
87
+ self.error_message = nil
88
+ end
89
+
90
+ if attributes.key?(:'details')
91
+ if (value = attributes[:'details']).is_a?(Array)
92
+ self.details = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @error_code.nil?
103
+ invalid_properties.push('invalid value for "error_code", error_code cannot be nil.')
104
+ end
105
+
106
+ if @error_message.nil?
107
+ invalid_properties.push('invalid value for "error_message", error_message cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @error_code.nil?
118
+ return false if @error_message.nil?
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] error_code Value to be assigned
124
+ def error_code=(error_code)
125
+ if error_code.nil?
126
+ fail ArgumentError, 'error_code cannot be nil'
127
+ end
128
+
129
+ @error_code = error_code
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] error_message Value to be assigned
134
+ def error_message=(error_message)
135
+ if error_message.nil?
136
+ fail ArgumentError, 'error_message cannot be nil'
137
+ end
138
+
139
+ @error_message = error_message
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ error_code == o.error_code &&
148
+ error_message == o.error_message &&
149
+ details == o.details
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [error_code, error_message, details].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ attributes = attributes.transform_keys(&:to_sym)
170
+ transformed_hash = {}
171
+ openapi_types.each_pair do |key, type|
172
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = nil
174
+ elsif type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[attribute_map[key]].is_a?(Array)
178
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
179
+ end
180
+ elsif !attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
182
+ end
183
+ end
184
+ new(transformed_hash)
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ end
204
+
205
+ end