trinsic_api 0.2.3

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 (103) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +137 -0
  4. data/Rakefile +10 -0
  5. data/docs/Address.md +32 -0
  6. data/docs/Attachments.md +24 -0
  7. data/docs/AttachmentsApi.md +76 -0
  8. data/docs/CancelSessionResponse.md +18 -0
  9. data/docs/CreateSessionRequest.md +22 -0
  10. data/docs/CreateSessionResponse.md +20 -0
  11. data/docs/DisclosedFields.md +40 -0
  12. data/docs/DisclosedFieldsRequest.md +40 -0
  13. data/docs/DocumentData.md +28 -0
  14. data/docs/ExchangeAttachmentAccessKeyRequest.md +18 -0
  15. data/docs/ExchangeResultsKeyRequest.md +18 -0
  16. data/docs/ExchangeResultsKeyResponse.md +20 -0
  17. data/docs/FailureMessage.md +18 -0
  18. data/docs/GetSessionResponse.md +18 -0
  19. data/docs/IdentityData.md +24 -0
  20. data/docs/IdentityLookupResponse.md +18 -0
  21. data/docs/ListProvidersResponse.md +18 -0
  22. data/docs/ListSessionsResponse.md +22 -0
  23. data/docs/NetworkApi.md +140 -0
  24. data/docs/OrderDirection.md +15 -0
  25. data/docs/PersonData.md +34 -0
  26. data/docs/ProviderInfo.md +22 -0
  27. data/docs/Session.md +30 -0
  28. data/docs/SessionFailCode.md +15 -0
  29. data/docs/SessionOrdering.md +15 -0
  30. data/docs/SessionState.md +15 -0
  31. data/docs/SessionsApi.md +428 -0
  32. data/docs/ValidationResult.md +20 -0
  33. data/docs/Verification.md +20 -0
  34. data/docs/VerificationFailCode.md +15 -0
  35. data/git_push.sh +57 -0
  36. data/lib/trinsic_api/api/attachments_api.rb +84 -0
  37. data/lib/trinsic_api/api/network_api.rb +138 -0
  38. data/lib/trinsic_api/api/sessions_api.rb +418 -0
  39. data/lib/trinsic_api/api_client.rb +394 -0
  40. data/lib/trinsic_api/api_error.rb +58 -0
  41. data/lib/trinsic_api/configuration.rb +308 -0
  42. data/lib/trinsic_api/models/address.rb +279 -0
  43. data/lib/trinsic_api/models/attachments.rb +246 -0
  44. data/lib/trinsic_api/models/cancel_session_response.rb +221 -0
  45. data/lib/trinsic_api/models/create_session_request.rb +237 -0
  46. data/lib/trinsic_api/models/create_session_response.rb +232 -0
  47. data/lib/trinsic_api/models/disclosed_fields.rb +397 -0
  48. data/lib/trinsic_api/models/disclosed_fields_request.rb +313 -0
  49. data/lib/trinsic_api/models/document_data.rb +259 -0
  50. data/lib/trinsic_api/models/exchange_attachment_access_key_request.rb +241 -0
  51. data/lib/trinsic_api/models/exchange_results_key_request.rb +222 -0
  52. data/lib/trinsic_api/models/exchange_results_key_response.rb +230 -0
  53. data/lib/trinsic_api/models/failure_message.rb +221 -0
  54. data/lib/trinsic_api/models/get_session_response.rb +221 -0
  55. data/lib/trinsic_api/models/identity_data.rb +245 -0
  56. data/lib/trinsic_api/models/identity_lookup_response.rb +222 -0
  57. data/lib/trinsic_api/models/list_providers_response.rb +224 -0
  58. data/lib/trinsic_api/models/list_sessions_response.rb +257 -0
  59. data/lib/trinsic_api/models/order_direction.rb +40 -0
  60. data/lib/trinsic_api/models/person_data.rb +292 -0
  61. data/lib/trinsic_api/models/provider_info.rb +257 -0
  62. data/lib/trinsic_api/models/session.rb +338 -0
  63. data/lib/trinsic_api/models/session_fail_code.rb +45 -0
  64. data/lib/trinsic_api/models/session_ordering.rb +41 -0
  65. data/lib/trinsic_api/models/session_state.rb +44 -0
  66. data/lib/trinsic_api/models/validation_result.rb +232 -0
  67. data/lib/trinsic_api/models/verification.rb +248 -0
  68. data/lib/trinsic_api/models/verification_fail_code.rb +43 -0
  69. data/lib/trinsic_api/version.rb +15 -0
  70. data/lib/trinsic_api.rb +69 -0
  71. data/spec/api/attachments_api_spec.rb +46 -0
  72. data/spec/api/network_api_spec.rb +56 -0
  73. data/spec/api/sessions_api_spec.rb +105 -0
  74. data/spec/models/address_spec.rb +78 -0
  75. data/spec/models/attachments_spec.rb +54 -0
  76. data/spec/models/cancel_session_response_spec.rb +36 -0
  77. data/spec/models/create_session_request_spec.rb +48 -0
  78. data/spec/models/create_session_response_spec.rb +42 -0
  79. data/spec/models/disclosed_fields_request_spec.rb +102 -0
  80. data/spec/models/disclosed_fields_spec.rb +102 -0
  81. data/spec/models/document_data_spec.rb +66 -0
  82. data/spec/models/exchange_attachment_access_key_request_spec.rb +36 -0
  83. data/spec/models/exchange_results_key_request_spec.rb +36 -0
  84. data/spec/models/exchange_results_key_response_spec.rb +42 -0
  85. data/spec/models/failure_message_spec.rb +36 -0
  86. data/spec/models/get_session_response_spec.rb +36 -0
  87. data/spec/models/identity_data_spec.rb +54 -0
  88. data/spec/models/identity_lookup_response_spec.rb +36 -0
  89. data/spec/models/list_providers_response_spec.rb +36 -0
  90. data/spec/models/list_sessions_response_spec.rb +48 -0
  91. data/spec/models/order_direction_spec.rb +30 -0
  92. data/spec/models/person_data_spec.rb +84 -0
  93. data/spec/models/provider_info_spec.rb +48 -0
  94. data/spec/models/session_fail_code_spec.rb +30 -0
  95. data/spec/models/session_ordering_spec.rb +30 -0
  96. data/spec/models/session_spec.rb +72 -0
  97. data/spec/models/session_state_spec.rb +30 -0
  98. data/spec/models/validation_result_spec.rb +42 -0
  99. data/spec/models/verification_fail_code_spec.rb +30 -0
  100. data/spec/models/verification_spec.rb +42 -0
  101. data/spec/spec_helper.rb +111 -0
  102. data/trinsic_api.gemspec +39 -0
  103. metadata +215 -0
@@ -0,0 +1,308 @@
1
+ =begin
2
+ #Connect 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.7.0
10
+
11
+ =end
12
+
13
+ module TrinsicApi
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines API keys used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: parameter value (API key)
39
+ #
40
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
41
+ # config.api_key['api_key'] = 'xxx'
42
+ attr_accessor :api_key
43
+
44
+ # Defines API key prefixes used with API Key authentications.
45
+ #
46
+ # @return [Hash] key: parameter name, value: API key prefix
47
+ #
48
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
49
+ # config.api_key_prefix['api_key'] = 'Token'
50
+ attr_accessor :api_key_prefix
51
+
52
+ # Defines the username used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :username
56
+
57
+ # Defines the password used with HTTP basic authentication.
58
+ #
59
+ # @return [String]
60
+ attr_accessor :password
61
+
62
+ # Defines the access token (Bearer) used with OAuth2.
63
+ attr_accessor :access_token
64
+
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
75
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
76
+ # details will be logged with `logger.debug` (see the `logger` attribute).
77
+ # Default to false.
78
+ #
79
+ # @return [true, false]
80
+ attr_accessor :debugging
81
+
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
90
+ # Defines the logger used for debugging.
91
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
92
+ #
93
+ # @return [#debug]
94
+ attr_accessor :logger
95
+
96
+ # Defines the temporary folder to store downloaded files
97
+ # (for API endpoints that have file response).
98
+ # Default to use `Tempfile`.
99
+ #
100
+ # @return [String]
101
+ attr_accessor :temp_folder_path
102
+
103
+ # The time limit for HTTP request in seconds.
104
+ # Default to 0 (never times out).
105
+ attr_accessor :timeout
106
+
107
+ # Set this to false to skip client side validation in the operation.
108
+ # Default to true.
109
+ # @return [true, false]
110
+ attr_accessor :client_side_validation
111
+
112
+ ### TLS/SSL setting
113
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
114
+ # Default to true.
115
+ #
116
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
117
+ #
118
+ # @return [true, false]
119
+ attr_accessor :verify_ssl
120
+
121
+ ### TLS/SSL setting
122
+ # Set this to false to skip verifying SSL host name
123
+ # Default to true.
124
+ #
125
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
126
+ #
127
+ # @return [true, false]
128
+ attr_accessor :verify_ssl_host
129
+
130
+ ### TLS/SSL setting
131
+ # Set this to customize the certificate file to verify the peer.
132
+ #
133
+ # @return [String] the path to the certificate file
134
+ #
135
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
136
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
137
+ attr_accessor :ssl_ca_cert
138
+
139
+ ### TLS/SSL setting
140
+ # Client certificate file (for client certificate)
141
+ attr_accessor :cert_file
142
+
143
+ ### TLS/SSL setting
144
+ # Client private key file (for client certificate)
145
+ attr_accessor :key_file
146
+
147
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
148
+ # Default to nil.
149
+ #
150
+ # @see The params_encoding option of Ethon. Related source code:
151
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
152
+ attr_accessor :params_encoding
153
+
154
+
155
+ attr_accessor :inject_format
156
+
157
+ attr_accessor :force_ending_format
158
+
159
+ def initialize
160
+ @scheme = 'https'
161
+ @host = 'api.trinsic.id'
162
+ @base_path = ''
163
+ @server_index = nil
164
+ @server_operation_index = {}
165
+ @server_variables = {}
166
+ @server_operation_variables = {}
167
+ @api_key = {}
168
+ @api_key_prefix = {}
169
+ @client_side_validation = true
170
+ @verify_ssl = true
171
+ @verify_ssl_host = true
172
+ @cert_file = nil
173
+ @key_file = nil
174
+ @timeout = 0
175
+ @params_encoding = nil
176
+ @debugging = false
177
+ @ignore_operation_servers = false
178
+ @inject_format = false
179
+ @force_ending_format = false
180
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
181
+
182
+ yield(self) if block_given?
183
+ end
184
+
185
+ # The default Configuration object.
186
+ def self.default
187
+ @@default ||= Configuration.new
188
+ end
189
+
190
+ def configure
191
+ yield(self) if block_given?
192
+ end
193
+
194
+ def scheme=(scheme)
195
+ # remove :// from scheme
196
+ @scheme = scheme.sub(/:\/\//, '')
197
+ end
198
+
199
+ def host=(host)
200
+ # remove http(s):// and anything after a slash
201
+ @host = host.sub(/https?:\/\//, '').split('/').first
202
+ end
203
+
204
+ def base_path=(base_path)
205
+ # Add leading and trailing slashes to base_path
206
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
207
+ @base_path = '' if @base_path == '/'
208
+ end
209
+
210
+ # Returns base URL for specified operation based on server settings
211
+ def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
213
+ if operation_server_settings.key?(operation) then
214
+ index = server_operation_index.fetch(operation, server_index)
215
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
216
+ else
217
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
218
+ end
219
+ end
220
+
221
+ # Gets API key (with prefix if set).
222
+ # @param [String] param_name the parameter name of API key auth
223
+ def api_key_with_prefix(param_name, param_alias = nil)
224
+ key = @api_key[param_name]
225
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
226
+ if @api_key_prefix[param_name]
227
+ "#{@api_key_prefix[param_name]} #{key}"
228
+ else
229
+ key
230
+ end
231
+ end
232
+
233
+ # Gets access_token using access_token_getter or uses the static access_token
234
+ def access_token_with_refresh
235
+ return access_token if access_token_getter.nil?
236
+ access_token_getter.call
237
+ end
238
+
239
+ # Gets Basic Auth token string
240
+ def basic_auth_token
241
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
242
+ end
243
+
244
+ # Returns Auth Settings hash for api client.
245
+ def auth_settings
246
+ {
247
+ 'Bearer' =>
248
+ {
249
+ type: 'bearer',
250
+ in: 'header',
251
+ key: 'Authorization',
252
+ value: "Bearer #{access_token_with_refresh}"
253
+ },
254
+ }
255
+ end
256
+
257
+ # Returns an array of Server setting
258
+ def server_settings
259
+ [
260
+ {
261
+ url: "https://api.trinsic.id",
262
+ description: "Production server",
263
+ }
264
+ ]
265
+ end
266
+
267
+ def operation_server_settings
268
+ {
269
+ }
270
+ end
271
+
272
+ # Returns URL based on server settings
273
+ #
274
+ # @param index array index of the server settings
275
+ # @param variables hash of variable and the corresponding value
276
+ def server_url(index, variables = {}, servers = nil)
277
+ servers = server_settings if servers == nil
278
+
279
+ # check array index out of bound
280
+ if (index.nil? || index < 0 || index >= servers.size)
281
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
282
+ end
283
+
284
+ server = servers[index]
285
+ url = server[:url]
286
+
287
+ return url unless server.key? :variables
288
+
289
+ # go through variable and assign a value
290
+ server[:variables].each do |name, variable|
291
+ if variables.key?(name)
292
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
293
+ url.gsub! "{" + name.to_s + "}", variables[name]
294
+ else
295
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
296
+ end
297
+ else
298
+ # use default value
299
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
300
+ end
301
+ end
302
+
303
+ url
304
+ end
305
+
306
+
307
+ end
308
+ end
@@ -0,0 +1,279 @@
1
+ =begin
2
+ #Connect 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.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ # Address information for an individual
18
+ class Address
19
+ attr_accessor :line1
20
+
21
+ attr_accessor :line2
22
+
23
+ attr_accessor :line3
24
+
25
+ attr_accessor :city
26
+
27
+ attr_accessor :state
28
+
29
+ attr_accessor :postal_code
30
+
31
+ attr_accessor :country
32
+
33
+ # The full address as a single string
34
+ attr_accessor :full_address
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'line1' => :'line1',
40
+ :'line2' => :'line2',
41
+ :'line3' => :'line3',
42
+ :'city' => :'city',
43
+ :'state' => :'state',
44
+ :'postal_code' => :'postalCode',
45
+ :'country' => :'country',
46
+ :'full_address' => :'fullAddress'
47
+ }
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'line1' => :'String',
59
+ :'line2' => :'String',
60
+ :'line3' => :'String',
61
+ :'city' => :'String',
62
+ :'state' => :'String',
63
+ :'postal_code' => :'String',
64
+ :'country' => :'String',
65
+ :'full_address' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::Address` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::Address`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'line1')
91
+ self.line1 = attributes[:'line1']
92
+ end
93
+
94
+ if attributes.key?(:'line2')
95
+ self.line2 = attributes[:'line2']
96
+ end
97
+
98
+ if attributes.key?(:'line3')
99
+ self.line3 = attributes[:'line3']
100
+ end
101
+
102
+ if attributes.key?(:'city')
103
+ self.city = attributes[:'city']
104
+ end
105
+
106
+ if attributes.key?(:'state')
107
+ self.state = attributes[:'state']
108
+ end
109
+
110
+ if attributes.key?(:'postal_code')
111
+ self.postal_code = attributes[:'postal_code']
112
+ end
113
+
114
+ if attributes.key?(:'country')
115
+ self.country = attributes[:'country']
116
+ end
117
+
118
+ if attributes.key?(:'full_address')
119
+ self.full_address = attributes[:'full_address']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
+ invalid_properties = Array.new
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ true
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ line1 == o.line1 &&
144
+ line2 == o.line2 &&
145
+ line3 == o.line3 &&
146
+ city == o.city &&
147
+ state == o.state &&
148
+ postal_code == o.postal_code &&
149
+ country == o.country &&
150
+ full_address == o.full_address
151
+ end
152
+
153
+ # @see the `==` method
154
+ # @param [Object] Object to be compared
155
+ def eql?(o)
156
+ self == o
157
+ end
158
+
159
+ # Calculates hash code according to all attributes.
160
+ # @return [Integer] Hash code
161
+ def hash
162
+ [line1, line2, line3, city, state, postal_code, country, full_address].hash
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def self.build_from_hash(attributes)
169
+ return nil unless attributes.is_a?(Hash)
170
+ attributes = attributes.transform_keys(&:to_sym)
171
+ transformed_hash = {}
172
+ openapi_types.each_pair do |key, type|
173
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = nil
175
+ elsif type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[attribute_map[key]].is_a?(Array)
179
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
180
+ end
181
+ elsif !attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
183
+ end
184
+ end
185
+ new(transformed_hash)
186
+ end
187
+
188
+ # Deserializes the data based on type
189
+ # @param string type Data type
190
+ # @param string value Value to be deserialized
191
+ # @return [Object] Deserialized data
192
+ def self._deserialize(type, value)
193
+ case type.to_sym
194
+ when :Time
195
+ Time.parse(value)
196
+ when :Date
197
+ Date.parse(value)
198
+ when :String
199
+ value.to_s
200
+ when :Integer
201
+ value.to_i
202
+ when :Float
203
+ value.to_f
204
+ when :Boolean
205
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
206
+ true
207
+ else
208
+ false
209
+ end
210
+ when :Object
211
+ # generic object (usually a Hash), return directly
212
+ value
213
+ when /\AArray<(?<inner_type>.+)>\z/
214
+ inner_type = Regexp.last_match[:inner_type]
215
+ value.map { |v| _deserialize(inner_type, v) }
216
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
217
+ k_type = Regexp.last_match[:k_type]
218
+ v_type = Regexp.last_match[:v_type]
219
+ {}.tap do |hash|
220
+ value.each do |k, v|
221
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
222
+ end
223
+ end
224
+ else # model
225
+ # models (e.g. Pet) or oneOf
226
+ klass = TrinsicApi.const_get(type)
227
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
228
+ end
229
+ end
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # to_body is an alias to to_hash (backward compatibility)
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_body
240
+ to_hash
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ if value.nil?
250
+ is_nullable = self.class.openapi_nullable.include?(attr)
251
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
252
+ end
253
+
254
+ hash[param] = _to_hash(value)
255
+ end
256
+ hash
257
+ end
258
+
259
+ # Outputs non-array value in the form of hash
260
+ # For object, use to_hash. Otherwise, just return the value
261
+ # @param [Object] value Any valid value
262
+ # @return [Hash] Returns the value in the form of hash
263
+ def _to_hash(value)
264
+ if value.is_a?(Array)
265
+ value.compact.map { |v| _to_hash(v) }
266
+ elsif value.is_a?(Hash)
267
+ {}.tap do |hash|
268
+ value.each { |k, v| hash[k] = _to_hash(v) }
269
+ end
270
+ elsif value.respond_to? :to_hash
271
+ value.to_hash
272
+ else
273
+ value
274
+ end
275
+ end
276
+
277
+ end
278
+
279
+ end