trinsic_api 2.2.0.pre.alpha1 → 2.3.0.pre.alpha1

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AddRedirectUriResponse.md +18 -0
  3. data/docs/ContractField.md +2 -0
  4. data/docs/ContractIdentifierField.md +22 -0
  5. data/docs/CreateVerificationProfileResponse.md +18 -0
  6. data/docs/EnvironmentRedirectUrisAddRequest.md +18 -0
  7. data/docs/EnvironmentRedirectUrisApi.md +222 -0
  8. data/docs/FaydaProviderOutput.md +18 -0
  9. data/docs/Identifier.md +22 -0
  10. data/docs/IdentityData.md +5 -1
  11. data/docs/ListEnvironmentRedirectUrisResponse.md +20 -0
  12. data/docs/ListVerificationProfilesResponse.md +20 -0
  13. data/docs/MexicoCurpProviderOutput.md +18 -0
  14. data/docs/NetworkApi.md +7 -5
  15. data/docs/ProviderContract.md +2 -0
  16. data/docs/ProviderOutput.md +22 -0
  17. data/docs/RedirectUriResponse.md +20 -0
  18. data/docs/SessionsApi.md +14 -14
  19. data/docs/SpidBillingInformation.md +22 -0
  20. data/docs/SpidInput.md +3 -1
  21. data/docs/SpidProviderOutput.md +26 -0
  22. data/docs/VerificationProfileResponse.md +28 -0
  23. data/docs/VerificationProfilesApi.md +231 -0
  24. data/lib/trinsic_api/api/environment_redirect_uris_api.rb +228 -0
  25. data/lib/trinsic_api/api/network_api.rb +6 -2
  26. data/lib/trinsic_api/api/sessions_api.rb +18 -18
  27. data/lib/trinsic_api/api/verification_profiles_api.rb +273 -0
  28. data/lib/trinsic_api/models/add_redirect_uri_response.rb +237 -0
  29. data/lib/trinsic_api/models/contract_field.rb +28 -1
  30. data/lib/trinsic_api/models/contract_identifier_field.rb +315 -0
  31. data/lib/trinsic_api/models/create_verification_profile_response.rb +238 -0
  32. data/lib/trinsic_api/models/environment_redirect_uris_add_request.rb +237 -0
  33. data/lib/trinsic_api/models/fayda_provider_output.rb +222 -0
  34. data/lib/trinsic_api/models/identifier.rb +289 -0
  35. data/lib/trinsic_api/models/identity_data.rb +43 -5
  36. data/lib/trinsic_api/models/list_environment_redirect_uris_response.rb +268 -0
  37. data/lib/trinsic_api/models/list_verification_profiles_response.rb +266 -0
  38. data/lib/trinsic_api/models/mexico_curp_provider_output.rb +222 -0
  39. data/lib/trinsic_api/models/provider_contract.rb +14 -1
  40. data/lib/trinsic_api/models/provider_output.rb +241 -0
  41. data/lib/trinsic_api/models/redirect_uri_response.rb +263 -0
  42. data/lib/trinsic_api/models/spid_billing_information.rb +293 -0
  43. data/lib/trinsic_api/models/spid_input.rb +16 -5
  44. data/lib/trinsic_api/models/spid_provider_output.rb +266 -0
  45. data/lib/trinsic_api/models/verification_profile_response.rb +375 -0
  46. data/lib/trinsic_api/version.rb +1 -1
  47. data/lib/trinsic_api.rb +16 -0
  48. data/spec/api/environment_redirect_uris_api_spec.rb +72 -0
  49. data/spec/api/network_api_spec.rb +3 -1
  50. data/spec/api/sessions_api_spec.rb +2 -2
  51. data/spec/api/verification_profiles_api_spec.rb +76 -0
  52. data/spec/models/add_redirect_uri_response_spec.rb +36 -0
  53. data/spec/models/contract_field_spec.rb +6 -0
  54. data/spec/models/contract_identifier_field_spec.rb +48 -0
  55. data/spec/models/create_verification_profile_response_spec.rb +36 -0
  56. data/spec/models/environment_redirect_uris_add_request_spec.rb +36 -0
  57. data/spec/models/fayda_provider_output_spec.rb +36 -0
  58. data/spec/models/identifier_spec.rb +48 -0
  59. data/spec/models/identity_data_spec.rb +12 -0
  60. data/spec/models/list_environment_redirect_uris_response_spec.rb +42 -0
  61. data/spec/models/list_verification_profiles_response_spec.rb +42 -0
  62. data/spec/models/mexico_curp_provider_output_spec.rb +36 -0
  63. data/spec/models/provider_contract_spec.rb +6 -0
  64. data/spec/models/provider_output_spec.rb +48 -0
  65. data/spec/models/redirect_uri_response_spec.rb +42 -0
  66. data/spec/models/spid_billing_information_spec.rb +48 -0
  67. data/spec/models/spid_input_spec.rb +6 -0
  68. data/spec/models/spid_provider_output_spec.rb +60 -0
  69. data/spec/models/verification_profile_response_spec.rb +66 -0
  70. metadata +66 -2
@@ -0,0 +1,289 @@
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 Identifier
18
+ attr_accessor :identifier
19
+
20
+ attr_accessor :scope
21
+
22
+ attr_accessor :description
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'identifier' => :'identifier',
28
+ :'scope' => :'scope',
29
+ :'description' => :'description'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'identifier' => :'String',
47
+ :'scope' => :'String',
48
+ :'description' => :'String'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
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::Identifier` 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::Identifier`. 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?(:'identifier')
75
+ self.identifier = attributes[:'identifier']
76
+ else
77
+ self.identifier = nil
78
+ end
79
+
80
+ if attributes.key?(:'scope')
81
+ self.scope = attributes[:'scope']
82
+ else
83
+ self.scope = nil
84
+ end
85
+
86
+ if attributes.key?(:'description')
87
+ self.description = attributes[:'description']
88
+ else
89
+ self.description = nil
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ if @identifier.nil?
99
+ invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
100
+ end
101
+
102
+ if @scope.nil?
103
+ invalid_properties.push('invalid value for "scope", scope cannot be nil.')
104
+ end
105
+
106
+ if @description.nil?
107
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @identifier.nil?
118
+ return false if @scope.nil?
119
+ return false if @description.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] identifier Value to be assigned
125
+ def identifier=(identifier)
126
+ if identifier.nil?
127
+ fail ArgumentError, 'identifier cannot be nil'
128
+ end
129
+
130
+ @identifier = identifier
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] scope Value to be assigned
135
+ def scope=(scope)
136
+ if scope.nil?
137
+ fail ArgumentError, 'scope cannot be nil'
138
+ end
139
+
140
+ @scope = scope
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] description Value to be assigned
145
+ def description=(description)
146
+ if description.nil?
147
+ fail ArgumentError, 'description cannot be nil'
148
+ end
149
+
150
+ @description = description
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ identifier == o.identifier &&
159
+ scope == o.scope &&
160
+ description == o.description
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [identifier, scope, description].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def self._deserialize(type, value)
203
+ case type.to_sym
204
+ when :Time
205
+ Time.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :Boolean
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ # models (e.g. Pet) or oneOf
236
+ klass = TrinsicApi.const_get(type)
237
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ # Returns the object in the form of hash
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_hash
256
+ hash = {}
257
+ self.class.attribute_map.each_pair do |attr, param|
258
+ value = self.send(attr)
259
+ if value.nil?
260
+ is_nullable = self.class.openapi_nullable.include?(attr)
261
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
262
+ end
263
+
264
+ hash[param] = _to_hash(value)
265
+ end
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+
287
+ end
288
+
289
+ end
@@ -27,6 +27,10 @@ module TrinsicApi
27
27
 
28
28
  attr_accessor :attachment_access_keys
29
29
 
30
+ attr_accessor :provider_output
31
+
32
+ attr_accessor :identifiers
33
+
30
34
  # Attribute mapping from ruby-style variable name to JSON key.
31
35
  def self.attribute_map
32
36
  {
@@ -35,7 +39,9 @@ module TrinsicApi
35
39
  :'person' => :'person',
36
40
  :'document' => :'document',
37
41
  :'match' => :'match',
38
- :'attachment_access_keys' => :'attachmentAccessKeys'
42
+ :'attachment_access_keys' => :'attachmentAccessKeys',
43
+ :'provider_output' => :'providerOutput',
44
+ :'identifiers' => :'identifiers'
39
45
  }
40
46
  end
41
47
 
@@ -57,7 +63,9 @@ module TrinsicApi
57
63
  :'person' => :'PersonData',
58
64
  :'document' => :'DocumentData',
59
65
  :'match' => :'MatchData',
60
- :'attachment_access_keys' => :'AttachmentAccessKeys'
66
+ :'attachment_access_keys' => :'AttachmentAccessKeys',
67
+ :'provider_output' => :'ProviderOutput',
68
+ :'identifiers' => :'Array<Identifier>'
61
69
  }
62
70
  end
63
71
 
@@ -69,7 +77,8 @@ module TrinsicApi
69
77
  :'person',
70
78
  :'document',
71
79
  :'match',
72
- :'attachment_access_keys'
80
+ :'attachment_access_keys',
81
+ :'provider_output',
73
82
  ])
74
83
  end
75
84
 
@@ -112,6 +121,18 @@ module TrinsicApi
112
121
  if attributes.key?(:'attachment_access_keys')
113
122
  self.attachment_access_keys = attributes[:'attachment_access_keys']
114
123
  end
124
+
125
+ if attributes.key?(:'provider_output')
126
+ self.provider_output = attributes[:'provider_output']
127
+ end
128
+
129
+ if attributes.key?(:'identifiers')
130
+ if (value = attributes[:'identifiers']).is_a?(Array)
131
+ self.identifiers = value
132
+ end
133
+ else
134
+ self.identifiers = nil
135
+ end
115
136
  end
116
137
 
117
138
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -119,6 +140,10 @@ module TrinsicApi
119
140
  def list_invalid_properties
120
141
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
142
  invalid_properties = Array.new
143
+ if @identifiers.nil?
144
+ invalid_properties.push('invalid value for "identifiers", identifiers cannot be nil.')
145
+ end
146
+
122
147
  invalid_properties
123
148
  end
124
149
 
@@ -126,9 +151,20 @@ module TrinsicApi
126
151
  # @return true if the model is valid
127
152
  def valid?
128
153
  warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @identifiers.nil?
129
155
  true
130
156
  end
131
157
 
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] identifiers Value to be assigned
160
+ def identifiers=(identifiers)
161
+ if identifiers.nil?
162
+ fail ArgumentError, 'identifiers cannot be nil'
163
+ end
164
+
165
+ @identifiers = identifiers
166
+ end
167
+
132
168
  # Checks equality by comparing each attribute.
133
169
  # @param [Object] Object to be compared
134
170
  def ==(o)
@@ -139,7 +175,9 @@ module TrinsicApi
139
175
  person == o.person &&
140
176
  document == o.document &&
141
177
  match == o.match &&
142
- attachment_access_keys == o.attachment_access_keys
178
+ attachment_access_keys == o.attachment_access_keys &&
179
+ provider_output == o.provider_output &&
180
+ identifiers == o.identifiers
143
181
  end
144
182
 
145
183
  # @see the `==` method
@@ -151,7 +189,7 @@ module TrinsicApi
151
189
  # Calculates hash code according to all attributes.
152
190
  # @return [Integer] Hash code
153
191
  def hash
154
- [originating_provider_id, originating_sub_provider_id, person, document, match, attachment_access_keys].hash
192
+ [originating_provider_id, originating_sub_provider_id, person, document, match, attachment_access_keys, provider_output, identifiers].hash
155
193
  end
156
194
 
157
195
  # Builds the object from hash
@@ -0,0 +1,268 @@
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
+ # Response from listing redirect URIs within an environment.
18
+ class ListEnvironmentRedirectUrisResponse
19
+ # List of redirect uris within the environment.
20
+ attr_accessor :uris
21
+
22
+ # Whether there are additional pages of uris to retrieve
23
+ attr_accessor :more
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'uris' => :'uris',
29
+ :'more' => :'more'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'uris' => :'Array<RedirectUriResponse>',
47
+ :'more' => :'Boolean'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::ListEnvironmentRedirectUrisResponse` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::ListEnvironmentRedirectUrisResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'uris')
74
+ if (value = attributes[:'uris']).is_a?(Array)
75
+ self.uris = value
76
+ end
77
+ else
78
+ self.uris = nil
79
+ end
80
+
81
+ if attributes.key?(:'more')
82
+ self.more = attributes[:'more']
83
+ else
84
+ self.more = nil
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
+ invalid_properties = Array.new
93
+ if @uris.nil?
94
+ invalid_properties.push('invalid value for "uris", uris cannot be nil.')
95
+ end
96
+
97
+ if @more.nil?
98
+ invalid_properties.push('invalid value for "more", more cannot be nil.')
99
+ end
100
+
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ warn '[DEPRECATED] the `valid?` method is obsolete'
108
+ return false if @uris.nil?
109
+ return false if @more.nil?
110
+ true
111
+ end
112
+
113
+ # Custom attribute writer method with validation
114
+ # @param [Object] uris Value to be assigned
115
+ def uris=(uris)
116
+ if uris.nil?
117
+ fail ArgumentError, 'uris cannot be nil'
118
+ end
119
+
120
+ @uris = uris
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] more Value to be assigned
125
+ def more=(more)
126
+ if more.nil?
127
+ fail ArgumentError, 'more cannot be nil'
128
+ end
129
+
130
+ @more = more
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ uris == o.uris &&
139
+ more == o.more
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Integer] Hash code
150
+ def hash
151
+ [uris, more].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ attributes = attributes.transform_keys(&:to_sym)
160
+ transformed_hash = {}
161
+ openapi_types.each_pair do |key, type|
162
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
163
+ transformed_hash["#{key}"] = nil
164
+ elsif type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[attribute_map[key]].is_a?(Array)
168
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
169
+ end
170
+ elsif !attributes[attribute_map[key]].nil?
171
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
172
+ end
173
+ end
174
+ new(transformed_hash)
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def self._deserialize(type, value)
182
+ case type.to_sym
183
+ when :Time
184
+ Time.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ # models (e.g. Pet) or oneOf
215
+ klass = TrinsicApi.const_get(type)
216
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+
268
+ end