trinsic_api 1.2.0 → 2.0.0.pre.alpha3

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 (181) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AadhaarInput.md +20 -0
  3. data/docs/Address.md +3 -3
  4. data/docs/AttachmentAccessKeys.md +7 -5
  5. data/docs/BangladeshNationalIdInput.md +24 -0
  6. data/docs/BrazilCpfCheckInput.md +18 -0
  7. data/docs/BrazilDigitalCnhInput.md +24 -0
  8. data/docs/CreateAdvancedProviderSessionRequest.md +26 -0
  9. data/docs/CreateAdvancedProviderSessionResponse.md +22 -0
  10. data/docs/CreateHostedProviderSessionRequest.md +22 -0
  11. data/docs/CreateHostedProviderSessionResponse.md +20 -0
  12. data/docs/CreateWidgetSessionRequest.md +22 -0
  13. data/docs/{CreateSessionResponse.md → CreateWidgetSessionResponse.md} +5 -5
  14. data/docs/DocumentData.md +3 -3
  15. data/docs/DocumentScanAttachments.md +18 -0
  16. data/docs/{SessionState.md → DocumentType.md} +2 -2
  17. data/docs/HttpValidationProblemDetails.md +28 -0
  18. data/docs/IdentityData.md +4 -4
  19. data/docs/IndonesiaNikInput.md +22 -0
  20. data/docs/{FailureMessage.md → IntegrationCapability.md} +2 -5
  21. data/docs/IntegrationLaunchMethod.md +15 -0
  22. data/docs/IntegrationStep.md +22 -0
  23. data/docs/KenyaNidInput.md +28 -0
  24. data/docs/KnownAddress.md +3 -1
  25. data/docs/KnownPersonData.md +4 -0
  26. data/docs/MexicoCurpInput.md +18 -0
  27. data/docs/NetworkApi.md +2 -72
  28. data/docs/NigeriaNinInput.md +30 -0
  29. data/docs/PersonData.md +14 -12
  30. data/docs/PhilippineMatchInput.md +26 -0
  31. data/docs/PhilippineQRInput.md +20 -0
  32. data/docs/ProblemDetails.md +26 -0
  33. data/docs/ProviderAttachments.md +18 -0
  34. data/docs/ProviderInfo.md +3 -1
  35. data/docs/ProviderInput.md +38 -0
  36. data/docs/RecommendRequest.md +7 -3
  37. data/docs/RefreshStepContentRequest.md +18 -0
  38. data/docs/RefreshStepContentResponse.md +18 -0
  39. data/docs/ResultCollection.md +20 -0
  40. data/docs/ResultCollectionMethod.md +15 -0
  41. data/docs/Session.md +6 -8
  42. data/docs/{VerificationFailCode.md → SessionErrorCode.md} +2 -2
  43. data/docs/SessionsApi.md +236 -18
  44. data/docs/{SessionFailCode.md → Sex.md} +2 -2
  45. data/docs/SouthAfricaNidInput.md +24 -0
  46. data/docs/StepRefreshInfo.md +22 -0
  47. data/lib/trinsic_api/api/attachments_api.rb +1 -1
  48. data/lib/trinsic_api/api/network_api.rb +3 -66
  49. data/lib/trinsic_api/api/sessions_api.rb +217 -19
  50. data/lib/trinsic_api/api_client.rb +1 -1
  51. data/lib/trinsic_api/api_error.rb +1 -1
  52. data/lib/trinsic_api/configuration.rb +1 -1
  53. data/lib/trinsic_api/models/{validation_result.rb → aadhaar_input.rb} +21 -26
  54. data/lib/trinsic_api/models/address.rb +16 -10
  55. data/lib/trinsic_api/models/attachment_access_keys.rb +25 -10
  56. data/lib/trinsic_api/models/bangladesh_national_id_input.rb +249 -0
  57. data/lib/trinsic_api/models/brazil_cpf_check_input.rb +261 -0
  58. data/lib/trinsic_api/models/brazil_digital_cnh_input.rb +294 -0
  59. data/lib/trinsic_api/models/cancel_session_response.rb +1 -1
  60. data/lib/trinsic_api/models/create_advanced_provider_session_request.rb +312 -0
  61. data/lib/trinsic_api/models/create_advanced_provider_session_response.rb +256 -0
  62. data/lib/trinsic_api/models/create_hosted_provider_session_request.rb +288 -0
  63. data/lib/trinsic_api/models/create_hosted_provider_session_response.rb +233 -0
  64. data/lib/trinsic_api/models/create_widget_session_request.rb +240 -0
  65. data/lib/trinsic_api/models/{create_session_response.rb → create_widget_session_response.rb} +18 -17
  66. data/lib/trinsic_api/models/document_data.rb +32 -4
  67. data/lib/trinsic_api/models/{failure_message.rb → document_scan_attachments.rb} +12 -18
  68. data/lib/trinsic_api/models/{session_state.rb → document_type.rb} +9 -11
  69. data/lib/trinsic_api/models/get_attachment_request.rb +1 -1
  70. data/lib/trinsic_api/models/get_attachment_response.rb +1 -1
  71. data/lib/trinsic_api/models/get_session_response.rb +1 -1
  72. data/lib/trinsic_api/models/get_session_result_request.rb +1 -1
  73. data/lib/trinsic_api/models/get_session_result_response.rb +2 -1
  74. data/lib/trinsic_api/models/http_validation_problem_details.rb +273 -0
  75. data/lib/trinsic_api/models/identity_data.rb +5 -5
  76. data/lib/trinsic_api/models/{disclosed_fields_request.rb → indonesia_nik_input.rb} +94 -93
  77. data/lib/trinsic_api/models/integration_capability.rb +44 -0
  78. data/lib/trinsic_api/models/integration_launch_method.rb +42 -0
  79. data/lib/trinsic_api/models/integration_step.rb +275 -0
  80. data/lib/trinsic_api/models/kenya_nid_input.rb +397 -0
  81. data/lib/trinsic_api/models/known_address.rb +20 -2
  82. data/lib/trinsic_api/models/known_identity_data.rb +2 -1
  83. data/lib/trinsic_api/models/known_person_data.rb +30 -2
  84. data/lib/trinsic_api/models/list_providers_response.rb +1 -1
  85. data/lib/trinsic_api/models/list_sessions_response.rb +1 -1
  86. data/lib/trinsic_api/models/mexico_curp_input.rb +250 -0
  87. data/lib/trinsic_api/models/nigeria_nin_input.rb +383 -0
  88. data/lib/trinsic_api/models/order_direction.rb +1 -1
  89. data/lib/trinsic_api/models/person_data.rb +50 -15
  90. data/lib/trinsic_api/models/philippine_match_input.rb +260 -0
  91. data/lib/trinsic_api/models/philippine_qr_input.rb +227 -0
  92. data/lib/trinsic_api/models/problem_details.rb +255 -0
  93. data/lib/trinsic_api/models/provider_attachments.rb +215 -0
  94. data/lib/trinsic_api/models/provider_info.rb +18 -5
  95. data/lib/trinsic_api/models/provider_information.rb +1 -1
  96. data/lib/trinsic_api/models/{create_session_request.rb → provider_input.rb} +111 -42
  97. data/lib/trinsic_api/models/recommend_request.rb +38 -18
  98. data/lib/trinsic_api/models/recommend_response.rb +1 -1
  99. data/lib/trinsic_api/models/refresh_step_content_request.rb +216 -0
  100. data/lib/trinsic_api/models/{identity_lookup_response.rb → refresh_step_content_response.rb} +16 -16
  101. data/lib/trinsic_api/models/{verification.rb → result_collection.rb} +27 -20
  102. data/lib/trinsic_api/models/result_collection_method.rb +40 -0
  103. data/lib/trinsic_api/models/session.rb +32 -48
  104. data/lib/trinsic_api/models/session_error_code.rb +48 -0
  105. data/lib/trinsic_api/models/session_ordering.rb +1 -1
  106. data/lib/trinsic_api/models/sex.rb +42 -0
  107. data/lib/trinsic_api/models/{disclosed_fields.rb → south_africa_nid_input.rb} +107 -154
  108. data/lib/trinsic_api/models/step_refresh_info.rb +256 -0
  109. data/lib/trinsic_api/version.rb +2 -2
  110. data/lib/trinsic_api.rb +34 -12
  111. data/spec/api/attachments_api_spec.rb +1 -1
  112. data/spec/api/network_api_spec.rb +2 -14
  113. data/spec/api/sessions_api_spec.rb +44 -7
  114. data/spec/models/{verification_spec.rb → aadhaar_input_spec.rb} +9 -9
  115. data/spec/models/address_spec.rb +2 -2
  116. data/spec/models/attachment_access_keys_spec.rb +7 -1
  117. data/spec/models/bangladesh_national_id_input_spec.rb +54 -0
  118. data/spec/models/{identity_lookup_response_spec.rb → brazil_cpf_check_input_spec.rb} +8 -8
  119. data/spec/models/brazil_digital_cnh_input_spec.rb +54 -0
  120. data/spec/models/cancel_session_response_spec.rb +1 -1
  121. data/spec/models/create_advanced_provider_session_request_spec.rb +60 -0
  122. data/spec/models/create_advanced_provider_session_response_spec.rb +48 -0
  123. data/spec/models/create_hosted_provider_session_request_spec.rb +48 -0
  124. data/spec/models/create_hosted_provider_session_response_spec.rb +42 -0
  125. data/spec/models/create_widget_session_request_spec.rb +48 -0
  126. data/spec/models/{create_session_response_spec.rb → create_widget_session_response_spec.rb} +8 -8
  127. data/spec/models/document_data_spec.rb +1 -1
  128. data/spec/models/document_scan_attachments_spec.rb +36 -0
  129. data/spec/models/{session_state_spec.rb → document_type_spec.rb} +7 -7
  130. data/spec/models/get_attachment_request_spec.rb +1 -1
  131. data/spec/models/get_attachment_response_spec.rb +1 -1
  132. data/spec/models/get_session_response_spec.rb +1 -1
  133. data/spec/models/get_session_result_request_spec.rb +1 -1
  134. data/spec/models/get_session_result_response_spec.rb +1 -1
  135. data/spec/models/http_validation_problem_details_spec.rb +66 -0
  136. data/spec/models/identity_data_spec.rb +1 -1
  137. data/spec/models/indonesia_nik_input_spec.rb +48 -0
  138. data/spec/models/integration_capability_spec.rb +30 -0
  139. data/spec/models/integration_launch_method_spec.rb +30 -0
  140. data/spec/models/integration_step_spec.rb +48 -0
  141. data/spec/models/kenya_nid_input_spec.rb +66 -0
  142. data/spec/models/known_address_spec.rb +7 -1
  143. data/spec/models/known_identity_data_spec.rb +1 -1
  144. data/spec/models/known_person_data_spec.rb +13 -1
  145. data/spec/models/list_providers_response_spec.rb +1 -1
  146. data/spec/models/list_sessions_response_spec.rb +1 -1
  147. data/spec/models/{failure_message_spec.rb → mexico_curp_input_spec.rb} +8 -8
  148. data/spec/models/nigeria_nin_input_spec.rb +72 -0
  149. data/spec/models/order_direction_spec.rb +1 -1
  150. data/spec/models/person_data_spec.rb +8 -2
  151. data/spec/models/{create_session_request_spec.rb → philippine_match_input_spec.rb} +12 -12
  152. data/spec/models/philippine_qr_input_spec.rb +42 -0
  153. data/spec/models/problem_details_spec.rb +60 -0
  154. data/spec/models/provider_attachments_spec.rb +36 -0
  155. data/spec/models/provider_info_spec.rb +7 -1
  156. data/spec/models/provider_information_spec.rb +1 -1
  157. data/spec/models/{disclosed_fields_spec.rb → provider_input_spec.rb} +18 -24
  158. data/spec/models/recommend_request_spec.rb +14 -2
  159. data/spec/models/recommend_response_spec.rb +1 -1
  160. data/spec/models/refresh_step_content_request_spec.rb +36 -0
  161. data/spec/models/refresh_step_content_response_spec.rb +36 -0
  162. data/spec/models/result_collection_method_spec.rb +30 -0
  163. data/spec/models/{validation_result_spec.rb → result_collection_spec.rb} +9 -9
  164. data/spec/models/{verification_fail_code_spec.rb → session_error_code_spec.rb} +7 -7
  165. data/spec/models/session_ordering_spec.rb +1 -1
  166. data/spec/models/session_spec.rb +4 -10
  167. data/spec/models/{session_fail_code_spec.rb → sex_spec.rb} +7 -7
  168. data/spec/models/south_africa_nid_input_spec.rb +54 -0
  169. data/spec/models/step_refresh_info_spec.rb +48 -0
  170. data/spec/spec_helper.rb +1 -1
  171. data/trinsic_api.gemspec +1 -1
  172. metadata +154 -66
  173. data/docs/CreateSessionRequest.md +0 -26
  174. data/docs/DisclosedFields.md +0 -40
  175. data/docs/DisclosedFieldsRequest.md +0 -40
  176. data/docs/IdentityLookupResponse.md +0 -18
  177. data/docs/ValidationResult.md +0 -20
  178. data/docs/Verification.md +0 -20
  179. data/lib/trinsic_api/models/session_fail_code.rb +0 -45
  180. data/lib/trinsic_api/models/verification_fail_code.rb +0 -44
  181. data/spec/models/disclosed_fields_request_spec.rb +0 -102
@@ -0,0 +1,249 @@
1
+ =begin
2
+ #Trinsic API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class BangladeshNationalIdInput
18
+ # The user's Bangladesh National ID number.
19
+ attr_accessor :national_id_number
20
+
21
+ # The user's date of birth, in `YYYY-MM-DD` format
22
+ attr_accessor :date_of_birth
23
+
24
+ # The user's full name
25
+ attr_accessor :name
26
+
27
+ # The base64-encoded bytes of the photo collected from the user
28
+ attr_accessor :photo_base64
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'national_id_number' => :'nationalIdNumber',
34
+ :'date_of_birth' => :'dateOfBirth',
35
+ :'name' => :'name',
36
+ :'photo_base64' => :'photoBase64'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'national_id_number' => :'String',
49
+ :'date_of_birth' => :'Date',
50
+ :'name' => :'String',
51
+ :'photo_base64' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'national_id_number',
59
+ :'date_of_birth',
60
+ :'name',
61
+ :'photo_base64'
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::BangladeshNationalIdInput` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::BangladeshNationalIdInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'national_id_number')
81
+ self.national_id_number = attributes[:'national_id_number']
82
+ end
83
+
84
+ if attributes.key?(:'date_of_birth')
85
+ self.date_of_birth = attributes[:'date_of_birth']
86
+ end
87
+
88
+ if attributes.key?(:'name')
89
+ self.name = attributes[:'name']
90
+ end
91
+
92
+ if attributes.key?(:'photo_base64')
93
+ self.photo_base64 = attributes[:'photo_base64']
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
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ national_id_number == o.national_id_number &&
118
+ date_of_birth == o.date_of_birth &&
119
+ name == o.name &&
120
+ photo_base64 == o.photo_base64
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [national_id_number, date_of_birth, name, photo_base64].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def self._deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = TrinsicApi.const_get(type)
197
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end
@@ -0,0 +1,261 @@
1
+ =begin
2
+ #Trinsic API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class BrazilCpfCheckInput
18
+ # The user's 11-digit, numeric CPF Number
19
+ attr_accessor :cpf_number
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'cpf_number' => :'cpfNumber'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'cpf_number' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::BrazilCpfCheckInput` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::BrazilCpfCheckInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'cpf_number')
62
+ self.cpf_number = attributes[:'cpf_number']
63
+ else
64
+ self.cpf_number = nil
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
+ invalid_properties = Array.new
73
+ if @cpf_number.nil?
74
+ invalid_properties.push('invalid value for "cpf_number", cpf_number cannot be nil.')
75
+ end
76
+
77
+ if @cpf_number.to_s.length > 11
78
+ invalid_properties.push('invalid value for "cpf_number", the character length must be smaller than or equal to 11.')
79
+ end
80
+
81
+ if @cpf_number.to_s.length < 11
82
+ invalid_properties.push('invalid value for "cpf_number", the character length must be great than or equal to 11.')
83
+ end
84
+
85
+ pattern = Regexp.new(/^\d*$/)
86
+ if @cpf_number !~ pattern
87
+ invalid_properties.push("invalid value for \"cpf_number\", must conform to the pattern #{pattern}.")
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ return false if @cpf_number.nil?
98
+ return false if @cpf_number.to_s.length > 11
99
+ return false if @cpf_number.to_s.length < 11
100
+ return false if @cpf_number !~ Regexp.new(/^\d*$/)
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] cpf_number Value to be assigned
106
+ def cpf_number=(cpf_number)
107
+ if cpf_number.nil?
108
+ fail ArgumentError, 'cpf_number cannot be nil'
109
+ end
110
+
111
+ if cpf_number.to_s.length > 11
112
+ fail ArgumentError, 'invalid value for "cpf_number", the character length must be smaller than or equal to 11.'
113
+ end
114
+
115
+ if cpf_number.to_s.length < 11
116
+ fail ArgumentError, 'invalid value for "cpf_number", the character length must be great than or equal to 11.'
117
+ end
118
+
119
+ pattern = Regexp.new(/^\d*$/)
120
+ if cpf_number !~ pattern
121
+ fail ArgumentError, "invalid value for \"cpf_number\", must conform to the pattern #{pattern}."
122
+ end
123
+
124
+ @cpf_number = cpf_number
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ cpf_number == o.cpf_number
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [cpf_number].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ openapi_types.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
162
+ end
163
+ elsif !attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
+ end
166
+ end
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def self._deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = TrinsicApi.const_get(type)
209
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end