trinsic_api 0.2.3

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 (103) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +137 -0
  4. data/Rakefile +10 -0
  5. data/docs/Address.md +32 -0
  6. data/docs/Attachments.md +24 -0
  7. data/docs/AttachmentsApi.md +76 -0
  8. data/docs/CancelSessionResponse.md +18 -0
  9. data/docs/CreateSessionRequest.md +22 -0
  10. data/docs/CreateSessionResponse.md +20 -0
  11. data/docs/DisclosedFields.md +40 -0
  12. data/docs/DisclosedFieldsRequest.md +40 -0
  13. data/docs/DocumentData.md +28 -0
  14. data/docs/ExchangeAttachmentAccessKeyRequest.md +18 -0
  15. data/docs/ExchangeResultsKeyRequest.md +18 -0
  16. data/docs/ExchangeResultsKeyResponse.md +20 -0
  17. data/docs/FailureMessage.md +18 -0
  18. data/docs/GetSessionResponse.md +18 -0
  19. data/docs/IdentityData.md +24 -0
  20. data/docs/IdentityLookupResponse.md +18 -0
  21. data/docs/ListProvidersResponse.md +18 -0
  22. data/docs/ListSessionsResponse.md +22 -0
  23. data/docs/NetworkApi.md +140 -0
  24. data/docs/OrderDirection.md +15 -0
  25. data/docs/PersonData.md +34 -0
  26. data/docs/ProviderInfo.md +22 -0
  27. data/docs/Session.md +30 -0
  28. data/docs/SessionFailCode.md +15 -0
  29. data/docs/SessionOrdering.md +15 -0
  30. data/docs/SessionState.md +15 -0
  31. data/docs/SessionsApi.md +428 -0
  32. data/docs/ValidationResult.md +20 -0
  33. data/docs/Verification.md +20 -0
  34. data/docs/VerificationFailCode.md +15 -0
  35. data/git_push.sh +57 -0
  36. data/lib/trinsic_api/api/attachments_api.rb +84 -0
  37. data/lib/trinsic_api/api/network_api.rb +138 -0
  38. data/lib/trinsic_api/api/sessions_api.rb +418 -0
  39. data/lib/trinsic_api/api_client.rb +394 -0
  40. data/lib/trinsic_api/api_error.rb +58 -0
  41. data/lib/trinsic_api/configuration.rb +308 -0
  42. data/lib/trinsic_api/models/address.rb +279 -0
  43. data/lib/trinsic_api/models/attachments.rb +246 -0
  44. data/lib/trinsic_api/models/cancel_session_response.rb +221 -0
  45. data/lib/trinsic_api/models/create_session_request.rb +237 -0
  46. data/lib/trinsic_api/models/create_session_response.rb +232 -0
  47. data/lib/trinsic_api/models/disclosed_fields.rb +397 -0
  48. data/lib/trinsic_api/models/disclosed_fields_request.rb +313 -0
  49. data/lib/trinsic_api/models/document_data.rb +259 -0
  50. data/lib/trinsic_api/models/exchange_attachment_access_key_request.rb +241 -0
  51. data/lib/trinsic_api/models/exchange_results_key_request.rb +222 -0
  52. data/lib/trinsic_api/models/exchange_results_key_response.rb +230 -0
  53. data/lib/trinsic_api/models/failure_message.rb +221 -0
  54. data/lib/trinsic_api/models/get_session_response.rb +221 -0
  55. data/lib/trinsic_api/models/identity_data.rb +245 -0
  56. data/lib/trinsic_api/models/identity_lookup_response.rb +222 -0
  57. data/lib/trinsic_api/models/list_providers_response.rb +224 -0
  58. data/lib/trinsic_api/models/list_sessions_response.rb +257 -0
  59. data/lib/trinsic_api/models/order_direction.rb +40 -0
  60. data/lib/trinsic_api/models/person_data.rb +292 -0
  61. data/lib/trinsic_api/models/provider_info.rb +257 -0
  62. data/lib/trinsic_api/models/session.rb +338 -0
  63. data/lib/trinsic_api/models/session_fail_code.rb +45 -0
  64. data/lib/trinsic_api/models/session_ordering.rb +41 -0
  65. data/lib/trinsic_api/models/session_state.rb +44 -0
  66. data/lib/trinsic_api/models/validation_result.rb +232 -0
  67. data/lib/trinsic_api/models/verification.rb +248 -0
  68. data/lib/trinsic_api/models/verification_fail_code.rb +43 -0
  69. data/lib/trinsic_api/version.rb +15 -0
  70. data/lib/trinsic_api.rb +69 -0
  71. data/spec/api/attachments_api_spec.rb +46 -0
  72. data/spec/api/network_api_spec.rb +56 -0
  73. data/spec/api/sessions_api_spec.rb +105 -0
  74. data/spec/models/address_spec.rb +78 -0
  75. data/spec/models/attachments_spec.rb +54 -0
  76. data/spec/models/cancel_session_response_spec.rb +36 -0
  77. data/spec/models/create_session_request_spec.rb +48 -0
  78. data/spec/models/create_session_response_spec.rb +42 -0
  79. data/spec/models/disclosed_fields_request_spec.rb +102 -0
  80. data/spec/models/disclosed_fields_spec.rb +102 -0
  81. data/spec/models/document_data_spec.rb +66 -0
  82. data/spec/models/exchange_attachment_access_key_request_spec.rb +36 -0
  83. data/spec/models/exchange_results_key_request_spec.rb +36 -0
  84. data/spec/models/exchange_results_key_response_spec.rb +42 -0
  85. data/spec/models/failure_message_spec.rb +36 -0
  86. data/spec/models/get_session_response_spec.rb +36 -0
  87. data/spec/models/identity_data_spec.rb +54 -0
  88. data/spec/models/identity_lookup_response_spec.rb +36 -0
  89. data/spec/models/list_providers_response_spec.rb +36 -0
  90. data/spec/models/list_sessions_response_spec.rb +48 -0
  91. data/spec/models/order_direction_spec.rb +30 -0
  92. data/spec/models/person_data_spec.rb +84 -0
  93. data/spec/models/provider_info_spec.rb +48 -0
  94. data/spec/models/session_fail_code_spec.rb +30 -0
  95. data/spec/models/session_ordering_spec.rb +30 -0
  96. data/spec/models/session_spec.rb +72 -0
  97. data/spec/models/session_state_spec.rb +30 -0
  98. data/spec/models/validation_result_spec.rb +42 -0
  99. data/spec/models/verification_fail_code_spec.rb +30 -0
  100. data/spec/models/verification_spec.rb +42 -0
  101. data/spec/spec_helper.rb +111 -0
  102. data/trinsic_api.gemspec +39 -0
  103. metadata +215 -0
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #Connect 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.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class CreateSessionResponse
18
+ # The created Acceptance Session
19
+ attr_accessor :session
20
+
21
+ # The URL that should be used to invoke the Acceptance Session on your user's device. If the Session was created with `LaunchMethodDirectly` set to `true`, you should redirect your user's browser to this URL. The frontend SDK cannot presently be used to invoke these Sessions. Otherwise, you should pass this URL to your user's frontend and use the frontend SDK to invoke the Session. This URL is sensitive and as such can only be obtained once. If you need to obtain it again, you will need to create a new Acceptance Session.
22
+ attr_accessor :launch_url
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'session' => :'session',
28
+ :'launch_url' => :'launchUrl'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'session' => :'Session',
41
+ :'launch_url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::CreateSessionResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::CreateSessionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'session')
67
+ self.session = attributes[:'session']
68
+ else
69
+ self.session = nil
70
+ end
71
+
72
+ if attributes.key?(:'launch_url')
73
+ self.launch_url = attributes[:'launch_url']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @session.nil?
83
+ invalid_properties.push('invalid value for "session", session cannot be nil.')
84
+ end
85
+
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ return false if @session.nil?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ session == o.session &&
103
+ launch_url == o.launch_url
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [session, launch_url].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ attributes = attributes.transform_keys(&:to_sym)
124
+ transformed_hash = {}
125
+ openapi_types.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = nil
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
133
+ end
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
136
+ end
137
+ end
138
+ new(transformed_hash)
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def self._deserialize(type, value)
146
+ case type.to_sym
147
+ when :Time
148
+ Time.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ # models (e.g. Pet) or oneOf
179
+ klass = TrinsicApi.const_get(type)
180
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+
230
+ end
231
+
232
+ end
@@ -0,0 +1,397 @@
1
+ =begin
2
+ #Connect 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.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class DisclosedFields
18
+ attr_accessor :id_number
19
+
20
+ attr_accessor :given_name
21
+
22
+ attr_accessor :family_name
23
+
24
+ attr_accessor :address
25
+
26
+ attr_accessor :date_of_birth
27
+
28
+ attr_accessor :country
29
+
30
+ attr_accessor :issue_date
31
+
32
+ attr_accessor :expiration_date
33
+
34
+ attr_accessor :document_front
35
+
36
+ attr_accessor :document_back
37
+
38
+ attr_accessor :document_portrait
39
+
40
+ attr_accessor :selfie
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'id_number' => :'idNumber',
46
+ :'given_name' => :'givenName',
47
+ :'family_name' => :'familyName',
48
+ :'address' => :'address',
49
+ :'date_of_birth' => :'dateOfBirth',
50
+ :'country' => :'country',
51
+ :'issue_date' => :'issueDate',
52
+ :'expiration_date' => :'expirationDate',
53
+ :'document_front' => :'documentFront',
54
+ :'document_back' => :'documentBack',
55
+ :'document_portrait' => :'documentPortrait',
56
+ :'selfie' => :'selfie'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'id_number' => :'Boolean',
69
+ :'given_name' => :'Boolean',
70
+ :'family_name' => :'Boolean',
71
+ :'address' => :'Boolean',
72
+ :'date_of_birth' => :'Boolean',
73
+ :'country' => :'Boolean',
74
+ :'issue_date' => :'Boolean',
75
+ :'expiration_date' => :'Boolean',
76
+ :'document_front' => :'Boolean',
77
+ :'document_back' => :'Boolean',
78
+ :'document_portrait' => :'Boolean',
79
+ :'selfie' => :'Boolean'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::DisclosedFields` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::DisclosedFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'id_number')
105
+ self.id_number = attributes[:'id_number']
106
+ else
107
+ self.id_number = nil
108
+ end
109
+
110
+ if attributes.key?(:'given_name')
111
+ self.given_name = attributes[:'given_name']
112
+ else
113
+ self.given_name = nil
114
+ end
115
+
116
+ if attributes.key?(:'family_name')
117
+ self.family_name = attributes[:'family_name']
118
+ else
119
+ self.family_name = nil
120
+ end
121
+
122
+ if attributes.key?(:'address')
123
+ self.address = attributes[:'address']
124
+ else
125
+ self.address = nil
126
+ end
127
+
128
+ if attributes.key?(:'date_of_birth')
129
+ self.date_of_birth = attributes[:'date_of_birth']
130
+ else
131
+ self.date_of_birth = nil
132
+ end
133
+
134
+ if attributes.key?(:'country')
135
+ self.country = attributes[:'country']
136
+ else
137
+ self.country = nil
138
+ end
139
+
140
+ if attributes.key?(:'issue_date')
141
+ self.issue_date = attributes[:'issue_date']
142
+ else
143
+ self.issue_date = nil
144
+ end
145
+
146
+ if attributes.key?(:'expiration_date')
147
+ self.expiration_date = attributes[:'expiration_date']
148
+ else
149
+ self.expiration_date = nil
150
+ end
151
+
152
+ if attributes.key?(:'document_front')
153
+ self.document_front = attributes[:'document_front']
154
+ else
155
+ self.document_front = nil
156
+ end
157
+
158
+ if attributes.key?(:'document_back')
159
+ self.document_back = attributes[:'document_back']
160
+ else
161
+ self.document_back = nil
162
+ end
163
+
164
+ if attributes.key?(:'document_portrait')
165
+ self.document_portrait = attributes[:'document_portrait']
166
+ else
167
+ self.document_portrait = nil
168
+ end
169
+
170
+ if attributes.key?(:'selfie')
171
+ self.selfie = attributes[:'selfie']
172
+ else
173
+ self.selfie = nil
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
181
+ invalid_properties = Array.new
182
+ if @id_number.nil?
183
+ invalid_properties.push('invalid value for "id_number", id_number cannot be nil.')
184
+ end
185
+
186
+ if @given_name.nil?
187
+ invalid_properties.push('invalid value for "given_name", given_name cannot be nil.')
188
+ end
189
+
190
+ if @family_name.nil?
191
+ invalid_properties.push('invalid value for "family_name", family_name cannot be nil.')
192
+ end
193
+
194
+ if @address.nil?
195
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
196
+ end
197
+
198
+ if @date_of_birth.nil?
199
+ invalid_properties.push('invalid value for "date_of_birth", date_of_birth cannot be nil.')
200
+ end
201
+
202
+ if @country.nil?
203
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
204
+ end
205
+
206
+ if @issue_date.nil?
207
+ invalid_properties.push('invalid value for "issue_date", issue_date cannot be nil.')
208
+ end
209
+
210
+ if @expiration_date.nil?
211
+ invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.')
212
+ end
213
+
214
+ if @document_front.nil?
215
+ invalid_properties.push('invalid value for "document_front", document_front cannot be nil.')
216
+ end
217
+
218
+ if @document_back.nil?
219
+ invalid_properties.push('invalid value for "document_back", document_back cannot be nil.')
220
+ end
221
+
222
+ if @document_portrait.nil?
223
+ invalid_properties.push('invalid value for "document_portrait", document_portrait cannot be nil.')
224
+ end
225
+
226
+ if @selfie.nil?
227
+ invalid_properties.push('invalid value for "selfie", selfie cannot be nil.')
228
+ end
229
+
230
+ invalid_properties
231
+ end
232
+
233
+ # Check to see if the all the properties in the model are valid
234
+ # @return true if the model is valid
235
+ def valid?
236
+ warn '[DEPRECATED] the `valid?` method is obsolete'
237
+ return false if @id_number.nil?
238
+ return false if @given_name.nil?
239
+ return false if @family_name.nil?
240
+ return false if @address.nil?
241
+ return false if @date_of_birth.nil?
242
+ return false if @country.nil?
243
+ return false if @issue_date.nil?
244
+ return false if @expiration_date.nil?
245
+ return false if @document_front.nil?
246
+ return false if @document_back.nil?
247
+ return false if @document_portrait.nil?
248
+ return false if @selfie.nil?
249
+ true
250
+ end
251
+
252
+ # Checks equality by comparing each attribute.
253
+ # @param [Object] Object to be compared
254
+ def ==(o)
255
+ return true if self.equal?(o)
256
+ self.class == o.class &&
257
+ id_number == o.id_number &&
258
+ given_name == o.given_name &&
259
+ family_name == o.family_name &&
260
+ address == o.address &&
261
+ date_of_birth == o.date_of_birth &&
262
+ country == o.country &&
263
+ issue_date == o.issue_date &&
264
+ expiration_date == o.expiration_date &&
265
+ document_front == o.document_front &&
266
+ document_back == o.document_back &&
267
+ document_portrait == o.document_portrait &&
268
+ selfie == o.selfie
269
+ end
270
+
271
+ # @see the `==` method
272
+ # @param [Object] Object to be compared
273
+ def eql?(o)
274
+ self == o
275
+ end
276
+
277
+ # Calculates hash code according to all attributes.
278
+ # @return [Integer] Hash code
279
+ def hash
280
+ [id_number, given_name, family_name, address, date_of_birth, country, issue_date, expiration_date, document_front, document_back, document_portrait, selfie].hash
281
+ end
282
+
283
+ # Builds the object from hash
284
+ # @param [Hash] attributes Model attributes in the form of hash
285
+ # @return [Object] Returns the model itself
286
+ def self.build_from_hash(attributes)
287
+ return nil unless attributes.is_a?(Hash)
288
+ attributes = attributes.transform_keys(&:to_sym)
289
+ transformed_hash = {}
290
+ openapi_types.each_pair do |key, type|
291
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
292
+ transformed_hash["#{key}"] = nil
293
+ elsif type =~ /\AArray<(.*)>/i
294
+ # check to ensure the input is an array given that the attribute
295
+ # is documented as an array but the input is not
296
+ if attributes[attribute_map[key]].is_a?(Array)
297
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
298
+ end
299
+ elsif !attributes[attribute_map[key]].nil?
300
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
301
+ end
302
+ end
303
+ new(transformed_hash)
304
+ end
305
+
306
+ # Deserializes the data based on type
307
+ # @param string type Data type
308
+ # @param string value Value to be deserialized
309
+ # @return [Object] Deserialized data
310
+ def self._deserialize(type, value)
311
+ case type.to_sym
312
+ when :Time
313
+ Time.parse(value)
314
+ when :Date
315
+ Date.parse(value)
316
+ when :String
317
+ value.to_s
318
+ when :Integer
319
+ value.to_i
320
+ when :Float
321
+ value.to_f
322
+ when :Boolean
323
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
324
+ true
325
+ else
326
+ false
327
+ end
328
+ when :Object
329
+ # generic object (usually a Hash), return directly
330
+ value
331
+ when /\AArray<(?<inner_type>.+)>\z/
332
+ inner_type = Regexp.last_match[:inner_type]
333
+ value.map { |v| _deserialize(inner_type, v) }
334
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
335
+ k_type = Regexp.last_match[:k_type]
336
+ v_type = Regexp.last_match[:v_type]
337
+ {}.tap do |hash|
338
+ value.each do |k, v|
339
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
340
+ end
341
+ end
342
+ else # model
343
+ # models (e.g. Pet) or oneOf
344
+ klass = TrinsicApi.const_get(type)
345
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
346
+ end
347
+ end
348
+
349
+ # Returns the string representation of the object
350
+ # @return [String] String presentation of the object
351
+ def to_s
352
+ to_hash.to_s
353
+ end
354
+
355
+ # to_body is an alias to to_hash (backward compatibility)
356
+ # @return [Hash] Returns the object in the form of hash
357
+ def to_body
358
+ to_hash
359
+ end
360
+
361
+ # Returns the object in the form of hash
362
+ # @return [Hash] Returns the object in the form of hash
363
+ def to_hash
364
+ hash = {}
365
+ self.class.attribute_map.each_pair do |attr, param|
366
+ value = self.send(attr)
367
+ if value.nil?
368
+ is_nullable = self.class.openapi_nullable.include?(attr)
369
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
370
+ end
371
+
372
+ hash[param] = _to_hash(value)
373
+ end
374
+ hash
375
+ end
376
+
377
+ # Outputs non-array value in the form of hash
378
+ # For object, use to_hash. Otherwise, just return the value
379
+ # @param [Object] value Any valid value
380
+ # @return [Hash] Returns the value in the form of hash
381
+ def _to_hash(value)
382
+ if value.is_a?(Array)
383
+ value.compact.map { |v| _to_hash(v) }
384
+ elsif value.is_a?(Hash)
385
+ {}.tap do |hash|
386
+ value.each { |k, v| hash[k] = _to_hash(v) }
387
+ end
388
+ elsif value.respond_to? :to_hash
389
+ value.to_hash
390
+ else
391
+ value
392
+ end
393
+ end
394
+
395
+ end
396
+
397
+ end