trinsic_api 2.1.1.pre.alpha1 → 2.2.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AppleWalletInput.md +18 -0
  3. data/docs/AttachmentsApi.md +1 -1
  4. data/docs/{CreateAdvancedProviderSessionRequest.md → CreateDirectProviderSessionRequest.md} +5 -3
  5. data/docs/{CreateAdvancedProviderSessionResponse.md → CreateDirectProviderSessionResponse.md} +2 -2
  6. data/docs/CreateHostedProviderSessionRequest.md +3 -1
  7. data/docs/CreateMdlExchangeRequest.md +32 -0
  8. data/docs/CreateMdlExchangeResponse.md +22 -0
  9. data/docs/CreateWidgetSessionRequest.md +3 -1
  10. data/docs/ExternalMdlFieldData.md +20 -0
  11. data/docs/FinalizeMdlExchangeRequest.md +24 -0
  12. data/docs/FinalizeMdlExchangeResponse.md +24 -0
  13. data/docs/GetAttachmentRequest.md +3 -1
  14. data/docs/GoogleWalletInput.md +18 -0
  15. data/docs/IdentityData.md +2 -0
  16. data/docs/{IndonesiaDukcapilBiometricMatchInput.md → IndonesiaDukcapilMatchInput.md} +3 -3
  17. data/docs/Match.md +20 -0
  18. data/docs/MatchData.md +36 -0
  19. data/docs/MdlApi.md +151 -0
  20. data/docs/MdlCertificateData.md +26 -0
  21. data/docs/MdlExchangeMechanism.md +15 -0
  22. data/docs/MdlFieldDataType.md +15 -0
  23. data/docs/MdlIdentityData.md +22 -0
  24. data/docs/NetworkApi.md +21 -18
  25. data/docs/ProviderContract.md +7 -5
  26. data/docs/ProviderInput.md +6 -2
  27. data/docs/RecommendRequest.md +2 -0
  28. data/docs/SessionsApi.md +103 -27
  29. data/docs/SubmitNativeChallengeResponseRequest.md +20 -0
  30. data/docs/SubmitNativeChallengeResponseResponse.md +18 -0
  31. data/lib/trinsic_api/api/mdl_api.rb +150 -0
  32. data/lib/trinsic_api/api/network_api.rb +22 -14
  33. data/lib/trinsic_api/api/sessions_api.rb +99 -23
  34. data/lib/trinsic_api/models/apple_wallet_input.rb +244 -0
  35. data/lib/trinsic_api/models/{create_advanced_provider_session_request.rb → create_direct_provider_session_request.rb} +32 -5
  36. data/lib/trinsic_api/models/{create_advanced_provider_session_response.rb → create_direct_provider_session_response.rb} +3 -3
  37. data/lib/trinsic_api/models/create_hosted_provider_session_request.rb +29 -2
  38. data/lib/trinsic_api/models/create_mdl_exchange_request.rb +404 -0
  39. data/lib/trinsic_api/models/create_mdl_exchange_response.rb +292 -0
  40. data/lib/trinsic_api/models/create_widget_session_request.rb +29 -2
  41. data/lib/trinsic_api/models/external_mdl_field_data.rb +287 -0
  42. data/lib/trinsic_api/models/finalize_mdl_exchange_request.rb +319 -0
  43. data/lib/trinsic_api/models/finalize_mdl_exchange_response.rb +287 -0
  44. data/lib/trinsic_api/models/get_attachment_request.rb +31 -4
  45. data/lib/trinsic_api/models/google_wallet_input.rb +244 -0
  46. data/lib/trinsic_api/models/identity_data.rb +11 -1
  47. data/lib/trinsic_api/models/{indonesia_dukcapil_biometric_match_input.rb → indonesia_dukcapil_match_input.rb} +4 -4
  48. data/lib/trinsic_api/models/integration_capability.rb +2 -1
  49. data/lib/trinsic_api/models/integration_launch_method.rb +2 -1
  50. data/lib/trinsic_api/models/integration_step.rb +1 -1
  51. data/lib/trinsic_api/models/match.rb +231 -0
  52. data/lib/trinsic_api/models/match_data.rb +311 -0
  53. data/lib/trinsic_api/models/mdl_certificate_data.rb +346 -0
  54. data/lib/trinsic_api/models/mdl_exchange_mechanism.rb +40 -0
  55. data/lib/trinsic_api/models/mdl_field_data_type.rb +43 -0
  56. data/lib/trinsic_api/models/mdl_identity_data.rb +294 -0
  57. data/lib/trinsic_api/models/provider_contract.rb +33 -6
  58. data/lib/trinsic_api/models/provider_input.rb +31 -9
  59. data/lib/trinsic_api/models/recommend_request.rb +28 -1
  60. data/lib/trinsic_api/models/result_collection_method.rb +2 -1
  61. data/lib/trinsic_api/models/session_error_code.rb +3 -1
  62. data/lib/trinsic_api/models/submit_native_challenge_response_request.rb +283 -0
  63. data/lib/trinsic_api/models/submit_native_challenge_response_response.rb +238 -0
  64. data/lib/trinsic_api/version.rb +1 -1
  65. data/lib/trinsic_api.rb +19 -3
  66. data/spec/api/mdl_api_spec.rb +59 -0
  67. data/spec/api/network_api_spec.rb +3 -3
  68. data/spec/api/sessions_api_spec.rb +21 -7
  69. data/spec/models/apple_wallet_input_spec.rb +36 -0
  70. data/spec/models/{create_advanced_provider_session_request_spec.rb → create_direct_provider_session_request_spec.rb} +12 -6
  71. data/spec/models/{create_advanced_provider_session_response_spec.rb → create_direct_provider_session_response_spec.rb} +6 -6
  72. data/spec/models/create_hosted_provider_session_request_spec.rb +6 -0
  73. data/spec/models/create_mdl_exchange_request_spec.rb +78 -0
  74. data/spec/models/create_mdl_exchange_response_spec.rb +48 -0
  75. data/spec/models/create_widget_session_request_spec.rb +6 -0
  76. data/spec/models/external_mdl_field_data_spec.rb +42 -0
  77. data/spec/models/finalize_mdl_exchange_request_spec.rb +54 -0
  78. data/spec/models/finalize_mdl_exchange_response_spec.rb +54 -0
  79. data/spec/models/get_attachment_request_spec.rb +6 -0
  80. data/spec/models/google_wallet_input_spec.rb +36 -0
  81. data/spec/models/identity_data_spec.rb +6 -0
  82. data/spec/models/{indonesia_dukcapil_biometric_match_input_spec.rb → indonesia_dukcapil_match_input_spec.rb} +6 -6
  83. data/spec/models/match_data_spec.rb +90 -0
  84. data/spec/models/match_spec.rb +42 -0
  85. data/spec/models/mdl_certificate_data_spec.rb +60 -0
  86. data/spec/models/mdl_exchange_mechanism_spec.rb +30 -0
  87. data/spec/models/mdl_field_data_type_spec.rb +30 -0
  88. data/spec/models/mdl_identity_data_spec.rb +48 -0
  89. data/spec/models/provider_contract_spec.rb +6 -0
  90. data/spec/models/provider_input_spec.rb +13 -1
  91. data/spec/models/recommend_request_spec.rb +6 -0
  92. data/spec/models/submit_native_challenge_response_request_spec.rb +42 -0
  93. data/spec/models/submit_native_challenge_response_response_spec.rb +36 -0
  94. metadata +130 -66
@@ -0,0 +1,292 @@
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 CreateMdlExchangeResponse
18
+ # The ID of the mDL exchange which was created.
19
+ attr_accessor :exchange_id
20
+
21
+ # The request object for this mDL exchange. Pass this into a Trinsic mDL SDK (Web, iOS, Android) exactly as-is to initiate the mDL exchange.
22
+ attr_accessor :request_object_base64_url
23
+
24
+ # The encrypted exchange context for this mDL exchange. This must be passed back to the API during finalization, alongside the response token from the wallet.
25
+ attr_accessor :exchange_context
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'exchange_id' => :'exchangeId',
31
+ :'request_object_base64_url' => :'requestObjectBase64Url',
32
+ :'exchange_context' => :'exchangeContext'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'exchange_id' => :'String',
50
+ :'request_object_base64_url' => :'String',
51
+ :'exchange_context' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::CreateMdlExchangeResponse` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::CreateMdlExchangeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'exchange_id')
78
+ self.exchange_id = attributes[:'exchange_id']
79
+ else
80
+ self.exchange_id = nil
81
+ end
82
+
83
+ if attributes.key?(:'request_object_base64_url')
84
+ self.request_object_base64_url = attributes[:'request_object_base64_url']
85
+ else
86
+ self.request_object_base64_url = nil
87
+ end
88
+
89
+ if attributes.key?(:'exchange_context')
90
+ self.exchange_context = attributes[:'exchange_context']
91
+ else
92
+ self.exchange_context = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @exchange_id.nil?
102
+ invalid_properties.push('invalid value for "exchange_id", exchange_id cannot be nil.')
103
+ end
104
+
105
+ if @request_object_base64_url.nil?
106
+ invalid_properties.push('invalid value for "request_object_base64_url", request_object_base64_url cannot be nil.')
107
+ end
108
+
109
+ if @exchange_context.nil?
110
+ invalid_properties.push('invalid value for "exchange_context", exchange_context cannot be nil.')
111
+ end
112
+
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
+ return false if @exchange_id.nil?
121
+ return false if @request_object_base64_url.nil?
122
+ return false if @exchange_context.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] exchange_id Value to be assigned
128
+ def exchange_id=(exchange_id)
129
+ if exchange_id.nil?
130
+ fail ArgumentError, 'exchange_id cannot be nil'
131
+ end
132
+
133
+ @exchange_id = exchange_id
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] request_object_base64_url Value to be assigned
138
+ def request_object_base64_url=(request_object_base64_url)
139
+ if request_object_base64_url.nil?
140
+ fail ArgumentError, 'request_object_base64_url cannot be nil'
141
+ end
142
+
143
+ @request_object_base64_url = request_object_base64_url
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] exchange_context Value to be assigned
148
+ def exchange_context=(exchange_context)
149
+ if exchange_context.nil?
150
+ fail ArgumentError, 'exchange_context cannot be nil'
151
+ end
152
+
153
+ @exchange_context = exchange_context
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ exchange_id == o.exchange_id &&
162
+ request_object_base64_url == o.request_object_base64_url &&
163
+ exchange_context == o.exchange_context
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [exchange_id, request_object_base64_url, exchange_context].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ transformed_hash = {}
185
+ openapi_types.each_pair do |key, type|
186
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = nil
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[attribute_map[key]].is_a?(Array)
192
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
193
+ end
194
+ elsif !attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
196
+ end
197
+ end
198
+ new(transformed_hash)
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def self._deserialize(type, value)
206
+ case type.to_sym
207
+ when :Time
208
+ Time.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ # models (e.g. Pet) or oneOf
239
+ klass = TrinsicApi.const_get(type)
240
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+
292
+ end
@@ -15,7 +15,10 @@ require 'time'
15
15
 
16
16
  module TrinsicApi
17
17
  class CreateWidgetSessionRequest
18
- # The URL to redirect the user to after the widget session is complete. *Note*: this should NOT be set if you intend to use Trinsic's Web UI SDK to launch the Widget as an embedded iFrame or popup; in that case, session resolution is handled by our SDK, not via redirect.
18
+ # The ID of the Verification Profile to use for this session.
19
+ attr_accessor :verification_profile_id
20
+
21
+ # The URL to redirect the user to after the widget session is complete. *Note*: this should NOT be set if you intend to use Trinsic's Web UI SDK to launch the Widget as a popup; in that case, session resolution is handled by our SDK, not via redirect.
19
22
  attr_accessor :redirect_url
20
23
 
21
24
  # The list of allowed identity providers. If not specified, all available providers will be allowed.
@@ -27,6 +30,7 @@ module TrinsicApi
27
30
  # Attribute mapping from ruby-style variable name to JSON key.
28
31
  def self.attribute_map
29
32
  {
33
+ :'verification_profile_id' => :'verificationProfileId',
30
34
  :'redirect_url' => :'redirectUrl',
31
35
  :'providers' => :'providers',
32
36
  :'recommendation_info' => :'recommendationInfo'
@@ -46,6 +50,7 @@ module TrinsicApi
46
50
  # Attribute type mapping.
47
51
  def self.openapi_types
48
52
  {
53
+ :'verification_profile_id' => :'String',
49
54
  :'redirect_url' => :'String',
50
55
  :'providers' => :'Array<String>',
51
56
  :'recommendation_info' => :'RecommendationInfo'
@@ -77,6 +82,12 @@ module TrinsicApi
77
82
  h[k.to_sym] = v
78
83
  }
79
84
 
85
+ if attributes.key?(:'verification_profile_id')
86
+ self.verification_profile_id = attributes[:'verification_profile_id']
87
+ else
88
+ self.verification_profile_id = nil
89
+ end
90
+
80
91
  if attributes.key?(:'redirect_url')
81
92
  self.redirect_url = attributes[:'redirect_url']
82
93
  end
@@ -97,6 +108,10 @@ module TrinsicApi
97
108
  def list_invalid_properties
98
109
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
110
  invalid_properties = Array.new
111
+ if @verification_profile_id.nil?
112
+ invalid_properties.push('invalid value for "verification_profile_id", verification_profile_id cannot be nil.')
113
+ end
114
+
100
115
  invalid_properties
101
116
  end
102
117
 
@@ -104,14 +119,26 @@ module TrinsicApi
104
119
  # @return true if the model is valid
105
120
  def valid?
106
121
  warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ return false if @verification_profile_id.nil?
107
123
  true
108
124
  end
109
125
 
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] verification_profile_id Value to be assigned
128
+ def verification_profile_id=(verification_profile_id)
129
+ if verification_profile_id.nil?
130
+ fail ArgumentError, 'verification_profile_id cannot be nil'
131
+ end
132
+
133
+ @verification_profile_id = verification_profile_id
134
+ end
135
+
110
136
  # Checks equality by comparing each attribute.
111
137
  # @param [Object] Object to be compared
112
138
  def ==(o)
113
139
  return true if self.equal?(o)
114
140
  self.class == o.class &&
141
+ verification_profile_id == o.verification_profile_id &&
115
142
  redirect_url == o.redirect_url &&
116
143
  providers == o.providers &&
117
144
  recommendation_info == o.recommendation_info
@@ -126,7 +153,7 @@ module TrinsicApi
126
153
  # Calculates hash code according to all attributes.
127
154
  # @return [Integer] Hash code
128
155
  def hash
129
- [redirect_url, providers, recommendation_info].hash
156
+ [verification_profile_id, redirect_url, providers, recommendation_info].hash
130
157
  end
131
158
 
132
159
  # Builds the object from hash
@@ -0,0 +1,287 @@
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 ExternalMdlFieldData
18
+ # The type of data contained in `value`.
19
+ attr_accessor :type
20
+
21
+ # The string-encoded value of the field.
22
+ attr_accessor :value
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'type' => :'type',
50
+ :'value' => :'value'
51
+ }
52
+ end
53
+
54
+ # Returns attribute mapping this model knows about
55
+ def self.acceptable_attribute_map
56
+ attribute_map
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ acceptable_attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'type' => :'MdlFieldDataType',
68
+ :'value' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::ExternalMdlFieldData` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ acceptable_attribute_map = self.class.acceptable_attribute_map
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!acceptable_attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::ExternalMdlFieldData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'type')
95
+ self.type = attributes[:'type']
96
+ else
97
+ self.type = nil
98
+ end
99
+
100
+ if attributes.key?(:'value')
101
+ self.value = attributes[:'value']
102
+ else
103
+ self.value = nil
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @type.nil?
113
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
114
+ end
115
+
116
+ if @value.nil?
117
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @type.nil?
128
+ return false if @value.nil?
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] type Value to be assigned
134
+ def type=(type)
135
+ if type.nil?
136
+ fail ArgumentError, 'type cannot be nil'
137
+ end
138
+
139
+ @type = type
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] value Value to be assigned
144
+ def value=(value)
145
+ if value.nil?
146
+ fail ArgumentError, 'value cannot be nil'
147
+ end
148
+
149
+ @value = value
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(o)
155
+ return true if self.equal?(o)
156
+ self.class == o.class &&
157
+ type == o.type &&
158
+ value == o.value
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [type, value].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ attributes = attributes.transform_keys(&:to_sym)
179
+ transformed_hash = {}
180
+ openapi_types.each_pair do |key, type|
181
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = nil
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[attribute_map[key]].is_a?(Array)
187
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
188
+ end
189
+ elsif !attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
191
+ end
192
+ end
193
+ new(transformed_hash)
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def self._deserialize(type, value)
201
+ case type.to_sym
202
+ when :Time
203
+ Time.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ # models (e.g. Pet) or oneOf
234
+ klass = TrinsicApi.const_get(type)
235
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map { |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+
285
+ end
286
+
287
+ end