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