trinsic_api 3.0.1 → 3.0.2.pre.preview

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 (122) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AadhaarClaims.md +46 -0
  3. data/docs/AadhaarLanguage.md +20 -0
  4. data/docs/AadhaarLocalizedClaims.md +40 -0
  5. data/docs/AppleWalletInput.md +3 -1
  6. data/docs/ConnectIdAddress.md +26 -0
  7. data/docs/ConnectIdAgeVerification.md +20 -0
  8. data/docs/ConnectIdBeneficiaryAccount.md +24 -0
  9. data/docs/ConnectIdProviderOutput.md +38 -0
  10. data/docs/CzechMojeIdAddressOutput.md +28 -0
  11. data/docs/CzechMojeIdProviderOutput.md +62 -0
  12. data/docs/DigilockerAadhaarProviderOutput.md +30 -0
  13. data/docs/FaydaProviderOutput.md +7 -1
  14. data/docs/FinnishTrustNetworkProviderOutput.md +38 -0
  15. data/docs/FranceIdentiteInput.md +18 -0
  16. data/docs/FranceIdentiteProviderOutput.md +18 -0
  17. data/docs/FrejaIndirectProviderOutput.md +24 -0
  18. data/docs/FrejaProviderOutput.md +36 -8
  19. data/docs/GetProviderResponse.md +18 -0
  20. data/docs/GoogleWalletInput.md +3 -1
  21. data/docs/NigeriaNinLookup2ProviderOutput.md +40 -0
  22. data/docs/NorwegianBankIdProviderOutput.md +32 -0
  23. data/docs/OneIdProviderAddress.md +26 -0
  24. data/docs/OneIdProviderOutput.md +28 -0
  25. data/docs/OutputFrejaAddress.md +24 -0
  26. data/docs/OutputFrejaDocument.md +24 -0
  27. data/docs/PhilippinesDigitalNidProviderOutput.md +21 -1
  28. data/docs/PhilippinesPhysicalNidProviderOutput.md +17 -1
  29. data/docs/ProviderInput.md +6 -0
  30. data/docs/ProviderOutput.md +24 -2
  31. data/docs/ProvidersApi.md +70 -0
  32. data/docs/Raw18013DocumentRequest.md +20 -0
  33. data/docs/Raw18013RequestInput.md +18 -0
  34. data/docs/RecommendProvidersResponse.md +3 -1
  35. data/docs/SamsungWalletInput.md +18 -0
  36. data/docs/UkEvisaLookupInput.md +20 -0
  37. data/docs/UnitedKingdomEvisaProviderOutput.md +38 -0
  38. data/docs/VerificationProfileResponse.md +2 -0
  39. data/docs/VerificationProfilesApi.md +4 -0
  40. data/docs/YotiDeeplinkProviderOutput.md +40 -0
  41. data/lib/trinsic_api/api/providers_api.rb +63 -0
  42. data/lib/trinsic_api/api/verification_profiles_api.rb +6 -0
  43. data/lib/trinsic_api/models/aadhaar_claims.rb +376 -0
  44. data/lib/trinsic_api/models/aadhaar_language.rb +250 -0
  45. data/lib/trinsic_api/models/aadhaar_localized_claims.rb +343 -0
  46. data/lib/trinsic_api/models/apple_wallet_input.rb +16 -5
  47. data/lib/trinsic_api/models/connect_id_address.rb +266 -0
  48. data/lib/trinsic_api/models/connect_id_age_verification.rb +233 -0
  49. data/lib/trinsic_api/models/connect_id_beneficiary_account.rb +255 -0
  50. data/lib/trinsic_api/models/connect_id_provider_output.rb +333 -0
  51. data/lib/trinsic_api/models/czech_moje_id_address_output.rb +277 -0
  52. data/lib/trinsic_api/models/czech_moje_id_provider_output.rb +465 -0
  53. data/lib/trinsic_api/models/digilocker_aadhaar_provider_output.rb +305 -0
  54. data/lib/trinsic_api/models/fayda_provider_output.rb +38 -5
  55. data/lib/trinsic_api/models/finnish_trust_network_provider_output.rb +333 -0
  56. data/lib/trinsic_api/models/france_identite_input.rb +222 -0
  57. data/lib/trinsic_api/models/france_identite_provider_output.rb +239 -0
  58. data/lib/trinsic_api/models/freja_indirect_provider_output.rb +320 -0
  59. data/lib/trinsic_api/models/freja_provider_output.rb +185 -91
  60. data/lib/trinsic_api/models/get_provider_response.rb +238 -0
  61. data/lib/trinsic_api/models/google_wallet_input.rb +16 -5
  62. data/lib/trinsic_api/models/integration_step.rb +1 -1
  63. data/lib/trinsic_api/models/nigeria_nin_lookup2_provider_output.rb +392 -0
  64. data/lib/trinsic_api/models/norwegian_bank_id_provider_output.rb +300 -0
  65. data/lib/trinsic_api/models/one_id_provider_address.rb +266 -0
  66. data/lib/trinsic_api/models/one_id_provider_output.rb +278 -0
  67. data/lib/trinsic_api/models/output_freja_address.rb +255 -0
  68. data/lib/trinsic_api/models/output_freja_document.rb +255 -0
  69. data/lib/trinsic_api/models/philippines_digital_nid_provider_output.rb +114 -4
  70. data/lib/trinsic_api/models/philippines_physical_nid_provider_output.rb +92 -4
  71. data/lib/trinsic_api/models/provider_input.rb +34 -1
  72. data/lib/trinsic_api/models/provider_output.rb +127 -6
  73. data/lib/trinsic_api/models/raw18013_document_request.rb +276 -0
  74. data/lib/trinsic_api/models/raw18013_request_input.rb +259 -0
  75. data/lib/trinsic_api/models/recommend_providers_response.rb +33 -4
  76. data/lib/trinsic_api/models/samsung_wallet_input.rb +222 -0
  77. data/lib/trinsic_api/models/uk_evisa_lookup_input.rb +283 -0
  78. data/lib/trinsic_api/models/united_kingdom_evisa_provider_output.rb +333 -0
  79. data/lib/trinsic_api/models/verification_profile_response.rb +28 -1
  80. data/lib/trinsic_api/models/yoti_deeplink_provider_output.rb +344 -0
  81. data/lib/trinsic_api/version.rb +1 -1
  82. data/lib/trinsic_api.rb +27 -0
  83. data/spec/api/providers_api_spec.rb +12 -0
  84. data/spec/api/verification_profiles_api_spec.rb +2 -0
  85. data/spec/models/aadhaar_claims_spec.rb +120 -0
  86. data/spec/models/aadhaar_language_spec.rb +42 -0
  87. data/spec/models/aadhaar_localized_claims_spec.rb +102 -0
  88. data/spec/models/apple_wallet_input_spec.rb +6 -0
  89. data/spec/models/connect_id_address_spec.rb +60 -0
  90. data/spec/models/connect_id_age_verification_spec.rb +42 -0
  91. data/spec/models/connect_id_beneficiary_account_spec.rb +54 -0
  92. data/spec/models/connect_id_provider_output_spec.rb +96 -0
  93. data/spec/models/czech_moje_id_address_output_spec.rb +66 -0
  94. data/spec/models/czech_moje_id_provider_output_spec.rb +168 -0
  95. data/spec/models/digilocker_aadhaar_provider_output_spec.rb +72 -0
  96. data/spec/models/fayda_provider_output_spec.rb +18 -0
  97. data/spec/models/finnish_trust_network_provider_output_spec.rb +96 -0
  98. data/spec/models/france_identite_input_spec.rb +36 -0
  99. data/spec/models/france_identite_provider_output_spec.rb +36 -0
  100. data/spec/models/freja_indirect_provider_output_spec.rb +54 -0
  101. data/spec/models/freja_provider_output_spec.rb +88 -4
  102. data/spec/models/get_provider_response_spec.rb +36 -0
  103. data/spec/models/google_wallet_input_spec.rb +6 -0
  104. data/spec/models/nigeria_nin_lookup2_provider_output_spec.rb +102 -0
  105. data/spec/models/norwegian_bank_id_provider_output_spec.rb +78 -0
  106. data/spec/models/one_id_provider_address_spec.rb +60 -0
  107. data/spec/models/one_id_provider_output_spec.rb +66 -0
  108. data/spec/models/output_freja_address_spec.rb +54 -0
  109. data/spec/models/output_freja_document_spec.rb +54 -0
  110. data/spec/models/philippines_digital_nid_provider_output_spec.rb +60 -0
  111. data/spec/models/philippines_physical_nid_provider_output_spec.rb +48 -0
  112. data/spec/models/provider_input_spec.rb +18 -0
  113. data/spec/models/provider_output_spec.rb +66 -0
  114. data/spec/models/raw18013_document_request_spec.rb +42 -0
  115. data/spec/models/raw18013_request_input_spec.rb +36 -0
  116. data/spec/models/recommend_providers_response_spec.rb +6 -0
  117. data/spec/models/samsung_wallet_input_spec.rb +36 -0
  118. data/spec/models/uk_evisa_lookup_input_spec.rb +42 -0
  119. data/spec/models/united_kingdom_evisa_provider_output_spec.rb +96 -0
  120. data/spec/models/verification_profile_response_spec.rb +6 -0
  121. data/spec/models/yoti_deeplink_provider_output_spec.rb +102 -0
  122. metadata +230 -122
@@ -0,0 +1,266 @@
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.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class OneIdProviderAddress
18
+ # The line or street portion of the address.
19
+ attr_accessor :street_address
20
+
21
+ # The locality or city portion of the address.
22
+ attr_accessor :locality
23
+
24
+ # The region or subdivision portion of the address.
25
+ attr_accessor :region
26
+
27
+ # The postal code of the address.
28
+ attr_accessor :postal_code
29
+
30
+ # The alpha-2 country code of the address.
31
+ attr_accessor :country_code
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'street_address' => :'streetAddress',
37
+ :'locality' => :'locality',
38
+ :'region' => :'region',
39
+ :'postal_code' => :'postalCode',
40
+ :'country_code' => :'countryCode'
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
+ :'street_address' => :'String',
58
+ :'locality' => :'String',
59
+ :'region' => :'String',
60
+ :'postal_code' => :'String',
61
+ :'country_code' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ :'street_address',
69
+ :'locality',
70
+ :'region',
71
+ :'postal_code',
72
+ :'country_code'
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::OneIdProviderAddress` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::OneIdProviderAddress`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'street_address')
93
+ self.street_address = attributes[:'street_address']
94
+ end
95
+
96
+ if attributes.key?(:'locality')
97
+ self.locality = attributes[:'locality']
98
+ end
99
+
100
+ if attributes.key?(:'region')
101
+ self.region = attributes[:'region']
102
+ end
103
+
104
+ if attributes.key?(:'postal_code')
105
+ self.postal_code = attributes[:'postal_code']
106
+ end
107
+
108
+ if attributes.key?(:'country_code')
109
+ self.country_code = attributes[:'country_code']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ street_address == o.street_address &&
134
+ locality == o.locality &&
135
+ region == o.region &&
136
+ postal_code == o.postal_code &&
137
+ country_code == o.country_code
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [street_address, locality, region, postal_code, country_code].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def self._deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = TrinsicApi.const_get(type)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -0,0 +1,278 @@
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.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ # Exposed properties for the `oneid` Provider which do not directly map to the normalized IdentityData model.
18
+ class OneIdProviderOutput
19
+ # The OpenID Connect (OIDC) subject identifier (sub).
20
+ attr_accessor :sub
21
+
22
+ # The individual's full name.
23
+ attr_accessor :full_name
24
+
25
+ # The individual's given name.
26
+ attr_accessor :given_name
27
+
28
+ # The individual's family name.
29
+ attr_accessor :family_name
30
+
31
+ # The date of birth of the individual.
32
+ attr_accessor :birthdate
33
+
34
+ # The address of the individual.
35
+ attr_accessor :address
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'sub' => :'sub',
41
+ :'full_name' => :'fullName',
42
+ :'given_name' => :'givenName',
43
+ :'family_name' => :'familyName',
44
+ :'birthdate' => :'birthdate',
45
+ :'address' => :'address'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'sub' => :'String',
63
+ :'full_name' => :'String',
64
+ :'given_name' => :'String',
65
+ :'family_name' => :'String',
66
+ :'birthdate' => :'Date',
67
+ :'address' => :'OneIdProviderAddress'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ :'sub',
75
+ :'full_name',
76
+ :'given_name',
77
+ :'family_name',
78
+ :'birthdate',
79
+ :'address'
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::OneIdProviderOutput` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ acceptable_attribute_map = self.class.acceptable_attribute_map
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!acceptable_attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::OneIdProviderOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'sub')
100
+ self.sub = attributes[:'sub']
101
+ end
102
+
103
+ if attributes.key?(:'full_name')
104
+ self.full_name = attributes[:'full_name']
105
+ end
106
+
107
+ if attributes.key?(:'given_name')
108
+ self.given_name = attributes[:'given_name']
109
+ end
110
+
111
+ if attributes.key?(:'family_name')
112
+ self.family_name = attributes[:'family_name']
113
+ end
114
+
115
+ if attributes.key?(:'birthdate')
116
+ self.birthdate = attributes[:'birthdate']
117
+ end
118
+
119
+ if attributes.key?(:'address')
120
+ self.address = attributes[:'address']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
+ invalid_properties = Array.new
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ true
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ sub == o.sub &&
145
+ full_name == o.full_name &&
146
+ given_name == o.given_name &&
147
+ family_name == o.family_name &&
148
+ birthdate == o.birthdate &&
149
+ address == o.address
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
+ [sub, full_name, given_name, family_name, birthdate, address].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
+ # Deserializes the data based on type
188
+ # @param string type Data type
189
+ # @param string value Value to be deserialized
190
+ # @return [Object] Deserialized data
191
+ def self._deserialize(type, value)
192
+ case type.to_sym
193
+ when :Time
194
+ Time.parse(value)
195
+ when :Date
196
+ Date.parse(value)
197
+ when :String
198
+ value.to_s
199
+ when :Integer
200
+ value.to_i
201
+ when :Float
202
+ value.to_f
203
+ when :Boolean
204
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
205
+ true
206
+ else
207
+ false
208
+ end
209
+ when :Object
210
+ # generic object (usually a Hash), return directly
211
+ value
212
+ when /\AArray<(?<inner_type>.+)>\z/
213
+ inner_type = Regexp.last_match[:inner_type]
214
+ value.map { |v| _deserialize(inner_type, v) }
215
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
216
+ k_type = Regexp.last_match[:k_type]
217
+ v_type = Regexp.last_match[:v_type]
218
+ {}.tap do |hash|
219
+ value.each do |k, v|
220
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
221
+ end
222
+ end
223
+ else # model
224
+ # models (e.g. Pet) or oneOf
225
+ klass = TrinsicApi.const_get(type)
226
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+
276
+ end
277
+
278
+ end