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,222 @@
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 SamsungWalletInput
18
+ # **Preview feature: not suitable for production use cases** The raw 18013-7 exchange request to use for this verification. If set, this overrides any default configuration on your Verification Profile.
19
+ attr_accessor :preview_raw18013_request
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'preview_raw18013_request' => :'preview_raw18013Request'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'preview_raw18013_request' => :'Raw18013RequestInput'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'preview_raw18013_request'
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::SamsungWalletInput` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ acceptable_attribute_map = self.class.acceptable_attribute_map
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!acceptable_attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::SamsungWalletInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'preview_raw18013_request')
69
+ self.preview_raw18013_request = attributes[:'preview_raw18013_request']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ preview_raw18013_request == o.preview_raw18013_request
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [preview_raw18013_request].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def self._deserialize(type, value)
136
+ case type.to_sym
137
+ when :Time
138
+ Time.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :Boolean
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ # models (e.g. Pet) or oneOf
169
+ klass = TrinsicApi.const_get(type)
170
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end
@@ -0,0 +1,283 @@
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 UkEvisaLookupInput
18
+ # The 9-character share code.
19
+ attr_accessor :share_code
20
+
21
+ # The user's date of birth, in `YYYY-MM-DD` format.
22
+ attr_accessor :date_of_birth
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'share_code' => :'shareCode',
28
+ :'date_of_birth' => :'dateOfBirth'
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
+ :'share_code' => :'String',
46
+ :'date_of_birth' => :'Date'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::UkEvisaLookupInput` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::UkEvisaLookupInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'share_code')
73
+ self.share_code = attributes[:'share_code']
74
+ else
75
+ self.share_code = nil
76
+ end
77
+
78
+ if attributes.key?(:'date_of_birth')
79
+ self.date_of_birth = attributes[:'date_of_birth']
80
+ else
81
+ self.date_of_birth = nil
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @share_code.nil?
91
+ invalid_properties.push('invalid value for "share_code", share_code cannot be nil.')
92
+ end
93
+
94
+ if @share_code.to_s.length > 9
95
+ invalid_properties.push('invalid value for "share_code", the character length must be smaller than or equal to 9.')
96
+ end
97
+
98
+ if @share_code.to_s.length < 9
99
+ invalid_properties.push('invalid value for "share_code", the character length must be great than or equal to 9.')
100
+ end
101
+
102
+ if @date_of_birth.nil?
103
+ invalid_properties.push('invalid value for "date_of_birth", date_of_birth cannot be nil.')
104
+ end
105
+
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ return false if @share_code.nil?
114
+ return false if @share_code.to_s.length > 9
115
+ return false if @share_code.to_s.length < 9
116
+ return false if @date_of_birth.nil?
117
+ true
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] share_code Value to be assigned
122
+ def share_code=(share_code)
123
+ if share_code.nil?
124
+ fail ArgumentError, 'share_code cannot be nil'
125
+ end
126
+
127
+ if share_code.to_s.length > 9
128
+ fail ArgumentError, 'invalid value for "share_code", the character length must be smaller than or equal to 9.'
129
+ end
130
+
131
+ if share_code.to_s.length < 9
132
+ fail ArgumentError, 'invalid value for "share_code", the character length must be great than or equal to 9.'
133
+ end
134
+
135
+ @share_code = share_code
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] date_of_birth Value to be assigned
140
+ def date_of_birth=(date_of_birth)
141
+ if date_of_birth.nil?
142
+ fail ArgumentError, 'date_of_birth cannot be nil'
143
+ end
144
+
145
+ @date_of_birth = date_of_birth
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ share_code == o.share_code &&
154
+ date_of_birth == o.date_of_birth
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [share_code, date_of_birth].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ openapi_types.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
+ end
185
+ elsif !attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
+ end
188
+ end
189
+ new(transformed_hash)
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def self._deserialize(type, value)
197
+ case type.to_sym
198
+ when :Time
199
+ Time.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ # models (e.g. Pet) or oneOf
230
+ klass = TrinsicApi.const_get(type)
231
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+
281
+ end
282
+
283
+ end