trinsic_api 2.2.0 → 2.3.0.pre.alpha2

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AddRedirectUriResponse.md +18 -0
  3. data/docs/AttachmentAccessKeys.md +2 -0
  4. data/docs/ContractField.md +2 -0
  5. data/docs/ContractIdentifierField.md +22 -0
  6. data/docs/CreateHostedProviderSessionResponse.md +1 -1
  7. data/docs/CreateVerificationProfileResponse.md +18 -0
  8. data/docs/CreateWidgetSessionResponse.md +1 -1
  9. data/docs/EnvironmentRedirectUrisAddRequest.md +18 -0
  10. data/docs/EnvironmentRedirectUrisApi.md +222 -0
  11. data/docs/FaydaProviderOutput.md +18 -0
  12. data/docs/Identifier.md +22 -0
  13. data/docs/IdentityData.md +5 -1
  14. data/docs/IntegrationStep.md +1 -1
  15. data/docs/KenyaNidBiometric2Input.md +22 -0
  16. data/docs/KenyaNidInput.md +1 -1
  17. data/docs/KenyaNidLookup2Input.md +18 -0
  18. data/docs/KenyaNidMatch2Input.md +28 -0
  19. data/docs/ListEnvironmentRedirectUrisResponse.md +20 -0
  20. data/docs/ListVerificationProfilesResponse.md +20 -0
  21. data/docs/MexicoCurpProviderOutput.md +18 -0
  22. data/docs/NigeriaNinInput.md +1 -1
  23. data/docs/PhilippinesDigitalNidProviderOutput.md +18 -0
  24. data/docs/PhilippinesPhysicalNidProviderOutput.md +18 -0
  25. data/docs/ProviderContract.md +2 -0
  26. data/docs/ProviderInput.md +8 -0
  27. data/docs/ProviderOutput.md +26 -0
  28. data/docs/RedirectUriResponse.md +20 -0
  29. data/docs/SexV1.md +15 -0
  30. data/docs/SouthAfricaNidInput.md +1 -1
  31. data/docs/SouthAfricaNidLookup2Input.md +18 -0
  32. data/docs/SpidBillingInformation.md +22 -0
  33. data/docs/SpidInput.md +3 -1
  34. data/docs/SpidProviderOutput.md +44 -0
  35. data/docs/VerificationProfileResponse.md +28 -0
  36. data/docs/VerificationProfilesApi.md +231 -0
  37. data/lib/trinsic_api/api/environment_redirect_uris_api.rb +228 -0
  38. data/lib/trinsic_api/api/verification_profiles_api.rb +273 -0
  39. data/lib/trinsic_api/models/add_redirect_uri_response.rb +237 -0
  40. data/lib/trinsic_api/models/attachment_access_keys.rb +11 -1
  41. data/lib/trinsic_api/models/contract_field.rb +28 -1
  42. data/lib/trinsic_api/models/contract_identifier_field.rb +315 -0
  43. data/lib/trinsic_api/models/create_verification_profile_response.rb +238 -0
  44. data/lib/trinsic_api/models/environment_redirect_uris_add_request.rb +237 -0
  45. data/lib/trinsic_api/models/fayda_provider_output.rb +222 -0
  46. data/lib/trinsic_api/models/identifier.rb +289 -0
  47. data/lib/trinsic_api/models/identity_data.rb +43 -5
  48. data/lib/trinsic_api/models/kenya_nid_biometric2_input.rb +246 -0
  49. data/lib/trinsic_api/models/kenya_nid_input.rb +1 -1
  50. data/lib/trinsic_api/models/kenya_nid_lookup2_input.rb +222 -0
  51. data/lib/trinsic_api/models/kenya_nid_match2_input.rb +299 -0
  52. data/lib/trinsic_api/models/list_environment_redirect_uris_response.rb +268 -0
  53. data/lib/trinsic_api/models/list_verification_profiles_response.rb +266 -0
  54. data/lib/trinsic_api/models/mexico_curp_provider_output.rb +222 -0
  55. data/lib/trinsic_api/models/nigeria_nin_input.rb +1 -1
  56. data/lib/trinsic_api/models/philippines_digital_nid_provider_output.rb +238 -0
  57. data/lib/trinsic_api/models/philippines_physical_nid_provider_output.rb +238 -0
  58. data/lib/trinsic_api/models/provider_contract.rb +14 -1
  59. data/lib/trinsic_api/models/provider_input.rb +45 -1
  60. data/lib/trinsic_api/models/provider_output.rb +261 -0
  61. data/lib/trinsic_api/models/redirect_uri_response.rb +263 -0
  62. data/lib/trinsic_api/models/sex_v1.rb +42 -0
  63. data/lib/trinsic_api/models/south_africa_nid_input.rb +1 -1
  64. data/lib/trinsic_api/models/south_africa_nid_lookup2_input.rb +222 -0
  65. data/lib/trinsic_api/models/spid_billing_information.rb +293 -0
  66. data/lib/trinsic_api/models/spid_input.rb +16 -5
  67. data/lib/trinsic_api/models/spid_provider_output.rb +397 -0
  68. data/lib/trinsic_api/models/verification_profile_response.rb +375 -0
  69. data/lib/trinsic_api/version.rb +1 -1
  70. data/lib/trinsic_api.rb +23 -0
  71. data/spec/api/environment_redirect_uris_api_spec.rb +72 -0
  72. data/spec/api/verification_profiles_api_spec.rb +76 -0
  73. data/spec/models/add_redirect_uri_response_spec.rb +36 -0
  74. data/spec/models/attachment_access_keys_spec.rb +6 -0
  75. data/spec/models/contract_field_spec.rb +6 -0
  76. data/spec/models/contract_identifier_field_spec.rb +48 -0
  77. data/spec/models/create_verification_profile_response_spec.rb +36 -0
  78. data/spec/models/environment_redirect_uris_add_request_spec.rb +36 -0
  79. data/spec/models/fayda_provider_output_spec.rb +36 -0
  80. data/spec/models/identifier_spec.rb +48 -0
  81. data/spec/models/identity_data_spec.rb +12 -0
  82. data/spec/models/kenya_nid_biometric2_input_spec.rb +48 -0
  83. data/spec/models/kenya_nid_lookup2_input_spec.rb +36 -0
  84. data/spec/models/kenya_nid_match2_input_spec.rb +66 -0
  85. data/spec/models/list_environment_redirect_uris_response_spec.rb +42 -0
  86. data/spec/models/list_verification_profiles_response_spec.rb +42 -0
  87. data/spec/models/mexico_curp_provider_output_spec.rb +36 -0
  88. data/spec/models/philippines_digital_nid_provider_output_spec.rb +36 -0
  89. data/spec/models/philippines_physical_nid_provider_output_spec.rb +36 -0
  90. data/spec/models/provider_contract_spec.rb +6 -0
  91. data/spec/models/provider_input_spec.rb +24 -0
  92. data/spec/models/provider_output_spec.rb +60 -0
  93. data/spec/models/redirect_uri_response_spec.rb +42 -0
  94. data/spec/models/sex_v1_spec.rb +30 -0
  95. data/spec/models/south_africa_nid_lookup2_input_spec.rb +36 -0
  96. data/spec/models/spid_billing_information_spec.rb +48 -0
  97. data/spec/models/spid_input_spec.rb +6 -0
  98. data/spec/models/spid_provider_output_spec.rb +114 -0
  99. data/spec/models/verification_profile_response_spec.rb +66 -0
  100. metadata +94 -2
@@ -66,6 +66,9 @@ module TrinsicApi
66
66
  # Information about the fields that this Provider will return in verification results.
67
67
  attr_accessor :available_fields
68
68
 
69
+ # Information about the identifiers this Provider returns in verification results.
70
+ attr_accessor :available_identifiers
71
+
69
72
  # Metadata about the sub-providers which are available for this Provider. For example, Italy's SPID is a Provider which aggregates access to multiple sub-providers.
70
73
  attr_accessor :sub_providers
71
74
 
@@ -114,6 +117,7 @@ module TrinsicApi
114
117
  :'supports_advanced_provider_sessions' => :'supportsAdvancedProviderSessions',
115
118
  :'supports_direct_provider_sessions' => :'supportsDirectProviderSessions',
116
119
  :'available_fields' => :'availableFields',
120
+ :'available_identifiers' => :'availableIdentifiers',
117
121
  :'sub_providers' => :'subProviders',
118
122
  :'health' => :'health'
119
123
  }
@@ -149,6 +153,7 @@ module TrinsicApi
149
153
  :'supports_advanced_provider_sessions' => :'Boolean',
150
154
  :'supports_direct_provider_sessions' => :'Boolean',
151
155
  :'available_fields' => :'Array<ContractField>',
156
+ :'available_identifiers' => :'Array<ContractIdentifierField>',
152
157
  :'sub_providers' => :'Array<SubProviderMetadata>',
153
158
  :'health' => :'ProviderHealth'
154
159
  }
@@ -158,6 +163,7 @@ module TrinsicApi
158
163
  def self.openapi_nullable
159
164
  Set.new([
160
165
  :'available_fields',
166
+ :'available_identifiers',
161
167
  :'sub_providers',
162
168
  ])
163
169
  end
@@ -284,6 +290,12 @@ module TrinsicApi
284
290
  end
285
291
  end
286
292
 
293
+ if attributes.key?(:'available_identifiers')
294
+ if (value = attributes[:'available_identifiers']).is_a?(Array)
295
+ self.available_identifiers = value
296
+ end
297
+ end
298
+
287
299
  if attributes.key?(:'sub_providers')
288
300
  if (value = attributes[:'sub_providers']).is_a?(Array)
289
301
  self.sub_providers = value
@@ -589,6 +601,7 @@ module TrinsicApi
589
601
  supports_advanced_provider_sessions == o.supports_advanced_provider_sessions &&
590
602
  supports_direct_provider_sessions == o.supports_direct_provider_sessions &&
591
603
  available_fields == o.available_fields &&
604
+ available_identifiers == o.available_identifiers &&
592
605
  sub_providers == o.sub_providers &&
593
606
  health == o.health
594
607
  end
@@ -602,7 +615,7 @@ module TrinsicApi
602
615
  # Calculates hash code according to all attributes.
603
616
  # @return [Integer] Hash code
604
617
  def hash
605
- [id, name, subtext, description, logo_url, available, geography, regions, launch_method, collection_method, results_may_be_delayed_after_redirect, has_refreshable_content, requires_input, has_trinsic_interface, supports_advanced_provider_sessions, supports_direct_provider_sessions, available_fields, sub_providers, health].hash
618
+ [id, name, subtext, description, logo_url, available, geography, regions, launch_method, collection_method, results_may_be_delayed_after_redirect, has_refreshable_content, requires_input, has_trinsic_interface, supports_advanced_provider_sessions, supports_direct_provider_sessions, available_fields, available_identifiers, sub_providers, health].hash
606
619
  end
607
620
 
608
621
  # Builds the object from hash
@@ -15,6 +15,9 @@ require 'time'
15
15
 
16
16
  module TrinsicApi
17
17
  class ProviderInput
18
+ # Input for the `kenya-nid-match-biometric-2` provider
19
+ attr_accessor :kenya_biometric2
20
+
18
21
  # Input for the `indonesia-nik-lookup` provider
19
22
  attr_accessor :indonesia_nik
20
23
 
@@ -30,6 +33,15 @@ module TrinsicApi
30
33
  # Input for the `kenya-nid-lookup` provider
31
34
  attr_accessor :kenya_nid
32
35
 
36
+ # Input for the `kenya-nid-match-2` provider
37
+ attr_accessor :kenya_nid_match2
38
+
39
+ # Input for the `kenya-nid-lookup-2` provider
40
+ attr_accessor :kenya_nid_lookup2
41
+
42
+ # Input for the `south-africa-nid-lookup-2` provider
43
+ attr_accessor :south_africa_nid_lookup2
44
+
33
45
  # Input for the `nigeria-nin-lookup` provider
34
46
  attr_accessor :nigeria_nin
35
47
 
@@ -78,11 +90,15 @@ module TrinsicApi
78
90
  # Attribute mapping from ruby-style variable name to JSON key.
79
91
  def self.attribute_map
80
92
  {
93
+ :'kenya_biometric2' => :'kenyaBiometric2',
81
94
  :'indonesia_nik' => :'indonesiaNik',
82
95
  :'indonesia_dukcapil_match' => :'indonesiaDukcapilMatch',
83
96
  :'mexico_curp' => :'mexicoCurp',
84
97
  :'south_africa_nid' => :'southAfricaNid',
85
98
  :'kenya_nid' => :'kenyaNid',
99
+ :'kenya_nid_match2' => :'kenyaNidMatch2',
100
+ :'kenya_nid_lookup2' => :'kenyaNidLookup2',
101
+ :'south_africa_nid_lookup2' => :'southAfricaNidLookup2',
86
102
  :'nigeria_nin' => :'nigeriaNin',
87
103
  :'aadhaar' => :'aadhaar',
88
104
  :'bangladesh_national_id' => :'bangladeshNationalId',
@@ -114,11 +130,15 @@ module TrinsicApi
114
130
  # Attribute type mapping.
115
131
  def self.openapi_types
116
132
  {
133
+ :'kenya_biometric2' => :'KenyaNidBiometric2Input',
117
134
  :'indonesia_nik' => :'IndonesiaNikInput',
118
135
  :'indonesia_dukcapil_match' => :'IndonesiaDukcapilMatchInput',
119
136
  :'mexico_curp' => :'MexicoCurpInput',
120
137
  :'south_africa_nid' => :'SouthAfricaNidInput',
121
138
  :'kenya_nid' => :'KenyaNidInput',
139
+ :'kenya_nid_match2' => :'KenyaNidMatch2Input',
140
+ :'kenya_nid_lookup2' => :'KenyaNidLookup2Input',
141
+ :'south_africa_nid_lookup2' => :'SouthAfricaNidLookup2Input',
122
142
  :'nigeria_nin' => :'NigeriaNinInput',
123
143
  :'aadhaar' => :'AadhaarInput',
124
144
  :'bangladesh_national_id' => :'BangladeshNidInput',
@@ -140,11 +160,15 @@ module TrinsicApi
140
160
  # List of attributes with nullable: true
141
161
  def self.openapi_nullable
142
162
  Set.new([
163
+ :'kenya_biometric2',
143
164
  :'indonesia_nik',
144
165
  :'indonesia_dukcapil_match',
145
166
  :'mexico_curp',
146
167
  :'south_africa_nid',
147
168
  :'kenya_nid',
169
+ :'kenya_nid_match2',
170
+ :'kenya_nid_lookup2',
171
+ :'south_africa_nid_lookup2',
148
172
  :'nigeria_nin',
149
173
  :'aadhaar',
150
174
  :'bangladesh_national_id',
@@ -179,6 +203,10 @@ module TrinsicApi
179
203
  h[k.to_sym] = v
180
204
  }
181
205
 
206
+ if attributes.key?(:'kenya_biometric2')
207
+ self.kenya_biometric2 = attributes[:'kenya_biometric2']
208
+ end
209
+
182
210
  if attributes.key?(:'indonesia_nik')
183
211
  self.indonesia_nik = attributes[:'indonesia_nik']
184
212
  end
@@ -199,6 +227,18 @@ module TrinsicApi
199
227
  self.kenya_nid = attributes[:'kenya_nid']
200
228
  end
201
229
 
230
+ if attributes.key?(:'kenya_nid_match2')
231
+ self.kenya_nid_match2 = attributes[:'kenya_nid_match2']
232
+ end
233
+
234
+ if attributes.key?(:'kenya_nid_lookup2')
235
+ self.kenya_nid_lookup2 = attributes[:'kenya_nid_lookup2']
236
+ end
237
+
238
+ if attributes.key?(:'south_africa_nid_lookup2')
239
+ self.south_africa_nid_lookup2 = attributes[:'south_africa_nid_lookup2']
240
+ end
241
+
202
242
  if attributes.key?(:'nigeria_nin')
203
243
  self.nigeria_nin = attributes[:'nigeria_nin']
204
244
  end
@@ -280,11 +320,15 @@ module TrinsicApi
280
320
  def ==(o)
281
321
  return true if self.equal?(o)
282
322
  self.class == o.class &&
323
+ kenya_biometric2 == o.kenya_biometric2 &&
283
324
  indonesia_nik == o.indonesia_nik &&
284
325
  indonesia_dukcapil_match == o.indonesia_dukcapil_match &&
285
326
  mexico_curp == o.mexico_curp &&
286
327
  south_africa_nid == o.south_africa_nid &&
287
328
  kenya_nid == o.kenya_nid &&
329
+ kenya_nid_match2 == o.kenya_nid_match2 &&
330
+ kenya_nid_lookup2 == o.kenya_nid_lookup2 &&
331
+ south_africa_nid_lookup2 == o.south_africa_nid_lookup2 &&
288
332
  nigeria_nin == o.nigeria_nin &&
289
333
  aadhaar == o.aadhaar &&
290
334
  bangladesh_national_id == o.bangladesh_national_id &&
@@ -311,7 +355,7 @@ module TrinsicApi
311
355
  # Calculates hash code according to all attributes.
312
356
  # @return [Integer] Hash code
313
357
  def hash
314
- [indonesia_nik, indonesia_dukcapil_match, mexico_curp, south_africa_nid, kenya_nid, nigeria_nin, aadhaar, bangladesh_national_id, brazil_cpf_check, brazil_digital_cnh, philippine_match, philippine_qr, smart_id, mobile_id, idin, spid, google_wallet, apple_wallet, trinsic_test_database_lookup, trinsic_test_sub_providers].hash
358
+ [kenya_biometric2, indonesia_nik, indonesia_dukcapil_match, mexico_curp, south_africa_nid, kenya_nid, kenya_nid_match2, kenya_nid_lookup2, south_africa_nid_lookup2, nigeria_nin, aadhaar, bangladesh_national_id, brazil_cpf_check, brazil_digital_cnh, philippine_match, philippine_qr, smart_id, mobile_id, idin, spid, google_wallet, apple_wallet, trinsic_test_database_lookup, trinsic_test_sub_providers].hash
315
359
  end
316
360
 
317
361
  # Builds the object from hash
@@ -0,0 +1,261 @@
1
+ =begin
2
+ #Trinsic API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class ProviderOutput
18
+ attr_accessor :italy_spid
19
+
20
+ attr_accessor :mexico_curp_lookup
21
+
22
+ attr_accessor :ethiopia_fayda
23
+
24
+ attr_accessor :philippines_physical_national_id_qr
25
+
26
+ attr_accessor :philippines_digital_national_id_qr
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'italy_spid' => :'italy-spid',
32
+ :'mexico_curp_lookup' => :'mexico-curp-lookup',
33
+ :'ethiopia_fayda' => :'ethiopia-fayda',
34
+ :'philippines_physical_national_id_qr' => :'philippines-physical-national-id-qr',
35
+ :'philippines_digital_national_id_qr' => :'philippines-digital-national-id-qr'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'italy_spid' => :'SpidProviderOutput',
53
+ :'mexico_curp_lookup' => :'MexicoCurpProviderOutput',
54
+ :'ethiopia_fayda' => :'FaydaProviderOutput',
55
+ :'philippines_physical_national_id_qr' => :'PhilippinesPhysicalNidProviderOutput',
56
+ :'philippines_digital_national_id_qr' => :'PhilippinesDigitalNidProviderOutput'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'italy_spid',
64
+ :'mexico_curp_lookup',
65
+ :'ethiopia_fayda',
66
+ :'philippines_physical_national_id_qr',
67
+ :'philippines_digital_national_id_qr'
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::ProviderOutput` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::ProviderOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'italy_spid')
88
+ self.italy_spid = attributes[:'italy_spid']
89
+ end
90
+
91
+ if attributes.key?(:'mexico_curp_lookup')
92
+ self.mexico_curp_lookup = attributes[:'mexico_curp_lookup']
93
+ end
94
+
95
+ if attributes.key?(:'ethiopia_fayda')
96
+ self.ethiopia_fayda = attributes[:'ethiopia_fayda']
97
+ end
98
+
99
+ if attributes.key?(:'philippines_physical_national_id_qr')
100
+ self.philippines_physical_national_id_qr = attributes[:'philippines_physical_national_id_qr']
101
+ end
102
+
103
+ if attributes.key?(:'philippines_digital_national_id_qr')
104
+ self.philippines_digital_national_id_qr = attributes[:'philippines_digital_national_id_qr']
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ italy_spid == o.italy_spid &&
129
+ mexico_curp_lookup == o.mexico_curp_lookup &&
130
+ ethiopia_fayda == o.ethiopia_fayda &&
131
+ philippines_physical_national_id_qr == o.philippines_physical_national_id_qr &&
132
+ philippines_digital_national_id_qr == o.philippines_digital_national_id_qr
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [italy_spid, mexico_curp_lookup, ethiopia_fayda, philippines_physical_national_id_qr, philippines_digital_national_id_qr].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ openapi_types.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
162
+ end
163
+ elsif !attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
+ end
166
+ end
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def self._deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = TrinsicApi.const_get(type)
209
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end