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,244 @@
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 GoogleWalletInput
18
+ # The exchange mechanism to use for this Google Wallet verification. Use `DigitalCredentialsApi` for Digital Credentials API on web, or `NativeApp` for a native Android app.
19
+ attr_accessor :exchange_mechanism
20
+
21
+ class EnumAttributeValidator
22
+ attr_reader :datatype
23
+ attr_reader :allowable_values
24
+
25
+ def initialize(datatype, allowable_values)
26
+ @allowable_values = allowable_values.map do |value|
27
+ case datatype.to_s
28
+ when /Integer/i
29
+ value.to_i
30
+ when /Float/i
31
+ value.to_f
32
+ else
33
+ value
34
+ end
35
+ end
36
+ end
37
+
38
+ def valid?(value)
39
+ !value || allowable_values.include?(value)
40
+ end
41
+ end
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'exchange_mechanism' => :'exchangeMechanism'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'exchange_mechanism' => :'MdlExchangeMechanism'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ :'exchange_mechanism'
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::GoogleWalletInput` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ acceptable_attribute_map = self.class.acceptable_attribute_map
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!acceptable_attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::GoogleWalletInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'exchange_mechanism')
91
+ self.exchange_mechanism = attributes[:'exchange_mechanism']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ exchange_mechanism == o.exchange_mechanism
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [exchange_mechanism].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ attributes = attributes.transform_keys(&:to_sym)
136
+ transformed_hash = {}
137
+ openapi_types.each_pair do |key, type|
138
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
139
+ transformed_hash["#{key}"] = nil
140
+ elsif type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[attribute_map[key]].is_a?(Array)
144
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
145
+ end
146
+ elsif !attributes[attribute_map[key]].nil?
147
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
148
+ end
149
+ end
150
+ new(transformed_hash)
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def self._deserialize(type, value)
158
+ case type.to_sym
159
+ when :Time
160
+ Time.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :Boolean
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ # models (e.g. Pet) or oneOf
191
+ klass = TrinsicApi.const_get(type)
192
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+
242
+ end
243
+
244
+ end
@@ -23,6 +23,8 @@ module TrinsicApi
23
23
 
24
24
  attr_accessor :document
25
25
 
26
+ attr_accessor :match
27
+
26
28
  attr_accessor :attachment_access_keys
27
29
 
28
30
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -32,6 +34,7 @@ module TrinsicApi
32
34
  :'originating_sub_provider_id' => :'originatingSubProviderId',
33
35
  :'person' => :'person',
34
36
  :'document' => :'document',
37
+ :'match' => :'match',
35
38
  :'attachment_access_keys' => :'attachmentAccessKeys'
36
39
  }
37
40
  end
@@ -53,6 +56,7 @@ module TrinsicApi
53
56
  :'originating_sub_provider_id' => :'String',
54
57
  :'person' => :'PersonData',
55
58
  :'document' => :'DocumentData',
59
+ :'match' => :'MatchData',
56
60
  :'attachment_access_keys' => :'AttachmentAccessKeys'
57
61
  }
58
62
  end
@@ -64,6 +68,7 @@ module TrinsicApi
64
68
  :'originating_sub_provider_id',
65
69
  :'person',
66
70
  :'document',
71
+ :'match',
67
72
  :'attachment_access_keys'
68
73
  ])
69
74
  end
@@ -100,6 +105,10 @@ module TrinsicApi
100
105
  self.document = attributes[:'document']
101
106
  end
102
107
 
108
+ if attributes.key?(:'match')
109
+ self.match = attributes[:'match']
110
+ end
111
+
103
112
  if attributes.key?(:'attachment_access_keys')
104
113
  self.attachment_access_keys = attributes[:'attachment_access_keys']
105
114
  end
@@ -129,6 +138,7 @@ module TrinsicApi
129
138
  originating_sub_provider_id == o.originating_sub_provider_id &&
130
139
  person == o.person &&
131
140
  document == o.document &&
141
+ match == o.match &&
132
142
  attachment_access_keys == o.attachment_access_keys
133
143
  end
134
144
 
@@ -141,7 +151,7 @@ module TrinsicApi
141
151
  # Calculates hash code according to all attributes.
142
152
  # @return [Integer] Hash code
143
153
  def hash
144
- [originating_provider_id, originating_sub_provider_id, person, document, attachment_access_keys].hash
154
+ [originating_provider_id, originating_sub_provider_id, person, document, match, attachment_access_keys].hash
145
155
  end
146
156
 
147
157
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module TrinsicApi
17
- class IndonesiaDukcapilBiometricMatchInput
17
+ class IndonesiaDukcapilMatchInput
18
18
  # The user's full name
19
19
  attr_accessor :full_name
20
20
 
@@ -30,7 +30,7 @@ module TrinsicApi
30
30
  # The phone number of the individual. Either email or phone number must be provided.
31
31
  attr_accessor :phone_number
32
32
 
33
- # The raw bytes of the selfie image of the individual. Must be JPEG format; 1MB maximum.
33
+ # The raw bytes of the selfie image of the individual. Must be JPEG or PNG format; 10MB maximum.
34
34
  attr_accessor :selfie_image
35
35
 
36
36
  # The raw bytes of the image of the individual's KTP government ID. Must be JPEG format; 1MB maximum. Optional.
@@ -95,14 +95,14 @@ module TrinsicApi
95
95
  # @param [Hash] attributes Model attributes in the form of hash
96
96
  def initialize(attributes = {})
97
97
  if (!attributes.is_a?(Hash))
98
- fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::IndonesiaDukcapilBiometricMatchInput` initialize method"
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::IndonesiaDukcapilMatchInput` initialize method"
99
99
  end
100
100
 
101
101
  # check to see if the attribute exists and convert string to symbol for hash key
102
102
  acceptable_attribute_map = self.class.acceptable_attribute_map
103
103
  attributes = attributes.each_with_object({}) { |(k, v), h|
104
104
  if (!acceptable_attribute_map.key?(k.to_sym))
105
- fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::IndonesiaDukcapilBiometricMatchInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::IndonesiaDukcapilMatchInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
106
  end
107
107
  h[k.to_sym] = v
108
108
  }
@@ -22,9 +22,10 @@ module TrinsicApi
22
22
  CAPTURE_REDIRECT = "CaptureRedirect".freeze
23
23
  POLL_RESULT = "PollResult".freeze
24
24
  POLL_AFTER_REDIRECT = "PollAfterRedirect".freeze
25
+ NATIVE_CHALLENGE = "NativeChallenge".freeze
25
26
 
26
27
  def self.all_vars
27
- @all_vars ||= [LAUNCH_BROWSER, DEEPLINK_TO_MOBILE, SHOW_CONTENT, REFRESH_STEP_CONTENT, CAPTURE_REDIRECT, POLL_RESULT, POLL_AFTER_REDIRECT].freeze
28
+ @all_vars ||= [LAUNCH_BROWSER, DEEPLINK_TO_MOBILE, SHOW_CONTENT, REFRESH_STEP_CONTENT, CAPTURE_REDIRECT, POLL_RESULT, POLL_AFTER_REDIRECT, NATIVE_CHALLENGE].freeze
28
29
  end
29
30
 
30
31
  # Builds the enum from string
@@ -19,9 +19,10 @@ module TrinsicApi
19
19
  NONE = "None".freeze
20
20
  DEEPLINK_TO_MOBILE = "DeeplinkToMobile".freeze
21
21
  SHOW_CONTENT = "ShowContent".freeze
22
+ PERFORM_NATIVE_CHALLENGE = "PerformNativeChallenge".freeze
22
23
 
23
24
  def self.all_vars
24
- @all_vars ||= [LAUNCH_BROWSER, NONE, DEEPLINK_TO_MOBILE, SHOW_CONTENT].freeze
25
+ @all_vars ||= [LAUNCH_BROWSER, NONE, DEEPLINK_TO_MOBILE, SHOW_CONTENT, PERFORM_NATIVE_CHALLENGE].freeze
25
26
  end
26
27
 
27
28
  # Builds the enum from string
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module TrinsicApi
17
- # A step to perform in the process of executing an Advanced Provider Session
17
+ # A step to perform in the process of executing an Direct Provider Session
18
18
  class IntegrationStep
19
19
  # The launch method to perform
20
20
  attr_accessor :method
@@ -0,0 +1,231 @@
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 Match
18
+ attr_accessor :probability_value
19
+
20
+ attr_accessor :boolean_value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'probability_value' => :'probabilityValue',
26
+ :'boolean_value' => :'booleanValue'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'probability_value' => :'Float',
44
+ :'boolean_value' => :'Boolean'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'probability_value',
52
+ :'boolean_value'
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::Match` 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::Match`. 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?(:'probability_value')
73
+ self.probability_value = attributes[:'probability_value']
74
+ end
75
+
76
+ if attributes.key?(:'boolean_value')
77
+ self.boolean_value = attributes[:'boolean_value']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ probability_value == o.probability_value &&
102
+ boolean_value == o.boolean_value
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [probability_value, boolean_value].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def self._deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = TrinsicApi.const_get(type)
179
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end