factpulse 3.0.32 β†’ 3.0.33

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -17
  3. data/Gemfile.lock +1 -1
  4. data/docs/ActionCodeInfo.md +22 -0
  5. data/docs/ActionCodesResponse.md +22 -0
  6. data/docs/BodySubmitCdarApiV1CdarSubmitPost.md +20 -0
  7. data/docs/BodySubmitCdarXmlApiV1CdarSubmitXmlPost.md +20 -0
  8. data/docs/CDARCycleDeVieApi.md +489 -0
  9. data/docs/ChorusProCredentials.md +8 -8
  10. data/docs/ChorusProDestination.md +1 -1
  11. data/docs/CreateCDARRequest.md +52 -0
  12. data/docs/Encaisseamount.md +15 -0
  13. data/docs/Encaisseamount1.md +15 -0
  14. data/docs/FactureElectroniqueRestApiSchemasChorusProChorusProCredentials.md +26 -0
  15. data/docs/FactureElectroniqueRestApiSchemasValidationValidationErrorResponse.md +18 -0
  16. data/docs/GenerateCDARResponse.md +26 -0
  17. data/docs/GetChorusProIdRequest.md +1 -1
  18. data/docs/GetInvoiceRequest.md +1 -1
  19. data/docs/GetStructureRequest.md +1 -1
  20. data/docs/ReasonCodeInfo.md +22 -0
  21. data/docs/ReasonCodesResponse.md +22 -0
  22. data/docs/RecipientInput.md +26 -0
  23. data/docs/SearchStructureRequest.md +1 -1
  24. data/docs/StatusCodeInfo.md +22 -0
  25. data/docs/StatusCodesResponse.md +22 -0
  26. data/docs/SubmitCDARRequest.md +54 -0
  27. data/docs/SubmitCDARResponse.md +24 -0
  28. data/docs/SubmitCDARXMLRequest.md +22 -0
  29. data/docs/SubmitInvoiceRequest.md +1 -1
  30. data/docs/ValidateCDARRequest.md +32 -0
  31. data/docs/ValidateCDARResponse.md +22 -0
  32. data/docs/ValidationErrorResponse.md +8 -2
  33. data/lib/factpulse/api/cdar_cycle_de_vie_api.rb +491 -0
  34. data/lib/factpulse/helpers/client.rb +1 -1
  35. data/lib/factpulse/models/action_code_info.rb +220 -0
  36. data/lib/factpulse/models/action_codes_response.rb +207 -0
  37. data/lib/factpulse/models/body_submit_cdar_api_v1_cdar_submit_post.rb +174 -0
  38. data/lib/factpulse/models/body_submit_cdar_xml_api_v1_cdar_submit_xml_post.rb +174 -0
  39. data/lib/factpulse/models/chorus_pro_credentials.rb +26 -94
  40. data/lib/factpulse/models/chorus_pro_destination.rb +1 -1
  41. data/lib/factpulse/models/create_cdar_request.rb +414 -0
  42. data/lib/factpulse/models/encaisseamount.rb +104 -0
  43. data/lib/factpulse/models/encaisseamount1.rb +103 -0
  44. data/lib/factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.rb +259 -0
  45. data/lib/factpulse/models/facture_electronique_rest_api_schemas_validation_validation_error_response.rb +168 -0
  46. data/lib/factpulse/models/generate_cdar_response.rb +273 -0
  47. data/lib/factpulse/models/get_chorus_pro_id_request.rb +1 -1
  48. data/lib/factpulse/models/get_invoice_request.rb +1 -1
  49. data/lib/factpulse/models/get_structure_request.rb +1 -1
  50. data/lib/factpulse/models/reason_code_info.rb +220 -0
  51. data/lib/factpulse/models/reason_codes_response.rb +207 -0
  52. data/lib/factpulse/models/recipient_input.rb +191 -0
  53. data/lib/factpulse/models/search_structure_request.rb +1 -1
  54. data/lib/factpulse/models/status_code_info.rb +220 -0
  55. data/lib/factpulse/models/status_codes_response.rb +207 -0
  56. data/lib/factpulse/models/submit_cdar_request.rb +426 -0
  57. data/lib/factpulse/models/submit_cdar_response.rb +213 -0
  58. data/lib/factpulse/models/submit_cdarxml_request.rb +188 -0
  59. data/lib/factpulse/models/submit_invoice_request.rb +1 -1
  60. data/lib/factpulse/models/validate_cdar_request.rb +219 -0
  61. data/lib/factpulse/models/{facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb β†’ validate_cdar_response.rb} +47 -48
  62. data/lib/factpulse/models/validation_error_response.rb +67 -20
  63. data/lib/factpulse/version.rb +1 -1
  64. data/lib/factpulse.rb +21 -1
  65. metadata +44 -4
  66. data/docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md +0 -26
@@ -0,0 +1,273 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### πŸ“„ Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **πŸ†• Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### βœ… Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### πŸ“‘ AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### πŸ”„ Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## πŸ”’ Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### πŸ”‘ Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - βœ… Full automation (CI/CD, scripts) - βœ… Programmatic token management - βœ… Refresh token support for automatic access renewal - βœ… Easy integration in any language/tool #### πŸ–₯️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - βœ… Quick for API testing - βœ… No password required - βœ… Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### πŸ“š Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # RΓ©ponse de gΓ©nΓ©ration de message CDAR.
18
+ class GenerateCDARResponse < ApiModelBase
19
+ attr_accessor :document_id
20
+
21
+ # XML CDAR gΓ©nΓ©rΓ©
22
+ attr_accessor :xml
23
+
24
+ # Taille du XML en octets
25
+ attr_accessor :xml_size
26
+
27
+ # Hash SHA256 du XML
28
+ attr_accessor :sha256
29
+
30
+ # Message de succès
31
+ attr_accessor :message
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'document_id' => :'documentId',
37
+ :'xml' => :'xml',
38
+ :'xml_size' => :'xmlSize',
39
+ :'sha256' => :'sha256',
40
+ :'message' => :'message'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'document_id' => :'String',
58
+ :'xml' => :'String',
59
+ :'xml_size' => :'Integer',
60
+ :'sha256' => :'String',
61
+ :'message' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::GenerateCDARResponse` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::GenerateCDARResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'document_id')
88
+ self.document_id = attributes[:'document_id']
89
+ else
90
+ self.document_id = nil
91
+ end
92
+
93
+ if attributes.key?(:'xml')
94
+ self.xml = attributes[:'xml']
95
+ else
96
+ self.xml = nil
97
+ end
98
+
99
+ if attributes.key?(:'xml_size')
100
+ self.xml_size = attributes[:'xml_size']
101
+ else
102
+ self.xml_size = nil
103
+ end
104
+
105
+ if attributes.key?(:'sha256')
106
+ self.sha256 = attributes[:'sha256']
107
+ else
108
+ self.sha256 = nil
109
+ end
110
+
111
+ if attributes.key?(:'message')
112
+ self.message = attributes[:'message']
113
+ else
114
+ self.message = nil
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ if @document_id.nil?
124
+ invalid_properties.push('invalid value for "document_id", document_id cannot be nil.')
125
+ end
126
+
127
+ if @xml.nil?
128
+ invalid_properties.push('invalid value for "xml", xml cannot be nil.')
129
+ end
130
+
131
+ if @xml_size.nil?
132
+ invalid_properties.push('invalid value for "xml_size", xml_size cannot be nil.')
133
+ end
134
+
135
+ if @sha256.nil?
136
+ invalid_properties.push('invalid value for "sha256", sha256 cannot be nil.')
137
+ end
138
+
139
+ if @message.nil?
140
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
141
+ end
142
+
143
+ invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ warn '[DEPRECATED] the `valid?` method is obsolete'
150
+ return false if @document_id.nil?
151
+ return false if @xml.nil?
152
+ return false if @xml_size.nil?
153
+ return false if @sha256.nil?
154
+ return false if @message.nil?
155
+ true
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] document_id Value to be assigned
160
+ def document_id=(document_id)
161
+ if document_id.nil?
162
+ fail ArgumentError, 'document_id cannot be nil'
163
+ end
164
+
165
+ @document_id = document_id
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] xml Value to be assigned
170
+ def xml=(xml)
171
+ if xml.nil?
172
+ fail ArgumentError, 'xml cannot be nil'
173
+ end
174
+
175
+ @xml = xml
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] xml_size Value to be assigned
180
+ def xml_size=(xml_size)
181
+ if xml_size.nil?
182
+ fail ArgumentError, 'xml_size cannot be nil'
183
+ end
184
+
185
+ @xml_size = xml_size
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] sha256 Value to be assigned
190
+ def sha256=(sha256)
191
+ if sha256.nil?
192
+ fail ArgumentError, 'sha256 cannot be nil'
193
+ end
194
+
195
+ @sha256 = sha256
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] message Value to be assigned
200
+ def message=(message)
201
+ if message.nil?
202
+ fail ArgumentError, 'message cannot be nil'
203
+ end
204
+
205
+ @message = message
206
+ end
207
+
208
+ # Checks equality by comparing each attribute.
209
+ # @param [Object] Object to be compared
210
+ def ==(o)
211
+ return true if self.equal?(o)
212
+ self.class == o.class &&
213
+ document_id == o.document_id &&
214
+ xml == o.xml &&
215
+ xml_size == o.xml_size &&
216
+ sha256 == o.sha256 &&
217
+ message == o.message
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [document_id, xml, xml_size, sha256, message].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ return nil unless attributes.is_a?(Hash)
237
+ attributes = attributes.transform_keys(&:to_sym)
238
+ transformed_hash = {}
239
+ openapi_types.each_pair do |key, type|
240
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
241
+ transformed_hash["#{key}"] = nil
242
+ elsif type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[attribute_map[key]].is_a?(Array)
246
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
247
+ end
248
+ elsif !attributes[attribute_map[key]].nil?
249
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
250
+ end
251
+ end
252
+ new(transformed_hash)
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ end
272
+
273
+ end
@@ -46,7 +46,7 @@ module FactPulse
46
46
  # Attribute type mapping.
47
47
  def self.openapi_types
48
48
  {
49
- :'credentials' => :'ChorusProCredentials',
49
+ :'credentials' => :'FactureElectroniqueRestApiSchemasChorusProChorusProCredentials',
50
50
  :'siret' => :'String',
51
51
  :'identifier_type' => :'String'
52
52
  }
@@ -42,7 +42,7 @@ module FactPulse
42
42
  # Attribute type mapping.
43
43
  def self.openapi_types
44
44
  {
45
- :'credentials' => :'ChorusProCredentials',
45
+ :'credentials' => :'FactureElectroniqueRestApiSchemasChorusProChorusProCredentials',
46
46
  :'chorus_invoice_id' => :'Integer'
47
47
  }
48
48
  end
@@ -46,7 +46,7 @@ module FactPulse
46
46
  # Attribute type mapping.
47
47
  def self.openapi_types
48
48
  {
49
- :'credentials' => :'ChorusProCredentials',
49
+ :'credentials' => :'FactureElectroniqueRestApiSchemasChorusProChorusProCredentials',
50
50
  :'structure_id' => :'Integer',
51
51
  :'language_code' => :'String'
52
52
  }
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### πŸ“„ Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **πŸ†• Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### βœ… Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### πŸ“‘ AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### πŸ”„ Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## πŸ”’ Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### πŸ”‘ Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - βœ… Full automation (CI/CD, scripts) - βœ… Programmatic token management - βœ… Refresh token support for automatic access renewal - βœ… Easy integration in any language/tool #### πŸ–₯️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - βœ… Quick for API testing - βœ… No password required - βœ… Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### πŸ“š Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Information sur un code motif.
18
+ class ReasonCodeInfo < ApiModelBase
19
+ # Code
20
+ attr_accessor :code
21
+
22
+ # Nom Python de l'enum
23
+ attr_accessor :name
24
+
25
+ # Description
26
+ attr_accessor :description
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'code' => :'code',
32
+ :'name' => :'name',
33
+ :'description' => :'description'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'code' => :'String',
51
+ :'name' => :'String',
52
+ :'description' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
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::ReasonCodeInfo` 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::ReasonCodeInfo`. 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?(:'code')
79
+ self.code = attributes[:'code']
80
+ else
81
+ self.code = nil
82
+ end
83
+
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
86
+ else
87
+ self.name = nil
88
+ end
89
+
90
+ if attributes.key?(:'description')
91
+ self.description = attributes[:'description']
92
+ else
93
+ self.description = nil
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 @code.nil?
103
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
104
+ end
105
+
106
+ if @name.nil?
107
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
108
+ end
109
+
110
+ if @description.nil?
111
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
112
+ end
113
+
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
+ return false if @code.nil?
122
+ return false if @name.nil?
123
+ return false if @description.nil?
124
+ true
125
+ end
126
+
127
+ # Custom attribute writer method with validation
128
+ # @param [Object] code Value to be assigned
129
+ def code=(code)
130
+ if code.nil?
131
+ fail ArgumentError, 'code cannot be nil'
132
+ end
133
+
134
+ @code = code
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] name Value to be assigned
139
+ def name=(name)
140
+ if name.nil?
141
+ fail ArgumentError, 'name cannot be nil'
142
+ end
143
+
144
+ @name = name
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] description Value to be assigned
149
+ def description=(description)
150
+ if description.nil?
151
+ fail ArgumentError, 'description cannot be nil'
152
+ end
153
+
154
+ @description = description
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ code == o.code &&
163
+ name == o.name &&
164
+ description == o.description
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [code, name, description].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ transformed_hash = {}
186
+ openapi_types.each_pair do |key, type|
187
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[attribute_map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ end
219
+
220
+ end