gpd_debtposition_api 3.8.0

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 (73) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +141 -0
  4. data/Rakefile +10 -0
  5. data/docs/AppInfo.md +22 -0
  6. data/docs/DebtPositionActionsAPIApi.md +165 -0
  7. data/docs/DebtPositionsAPIApi.md +424 -0
  8. data/docs/HomeApi.md +82 -0
  9. data/docs/MultipleIUPDModel.md +18 -0
  10. data/docs/MultiplePaymentPositionModel.md +18 -0
  11. data/docs/PageInfo.md +24 -0
  12. data/docs/PaymentOptionMetadataModel.md +20 -0
  13. data/docs/PaymentOptionMetadataModelResponse.md +20 -0
  14. data/docs/PaymentOptionModel.md +38 -0
  15. data/docs/PaymentOptionModelResponse.md +58 -0
  16. data/docs/PaymentPositionModel.md +60 -0
  17. data/docs/PaymentPositionModelBaseResponse.md +44 -0
  18. data/docs/PaymentPositionsInfo.md +20 -0
  19. data/docs/ProblemJson.md +22 -0
  20. data/docs/Stamp.md +22 -0
  21. data/docs/TransferMetadataModel.md +20 -0
  22. data/docs/TransferMetadataModelResponse.md +20 -0
  23. data/docs/TransferModel.md +34 -0
  24. data/docs/TransferModelResponse.md +40 -0
  25. data/git_push.sh +57 -0
  26. data/gpd_debtposition_api.gemspec +39 -0
  27. data/lib/gpd_debtposition_api/api/debt_position_actions_api_api.rb +162 -0
  28. data/lib/gpd_debtposition_api/api/debt_positions_api_api.rb +439 -0
  29. data/lib/gpd_debtposition_api/api/home_api.rb +80 -0
  30. data/lib/gpd_debtposition_api/api_client.rb +394 -0
  31. data/lib/gpd_debtposition_api/api_error.rb +58 -0
  32. data/lib/gpd_debtposition_api/configuration.rb +320 -0
  33. data/lib/gpd_debtposition_api/models/app_info.rb +232 -0
  34. data/lib/gpd_debtposition_api/models/multiple_iupd_model.rb +251 -0
  35. data/lib/gpd_debtposition_api/models/multiple_payment_position_model.rb +223 -0
  36. data/lib/gpd_debtposition_api/models/page_info.rb +273 -0
  37. data/lib/gpd_debtposition_api/models/payment_option_metadata_model.rb +231 -0
  38. data/lib/gpd_debtposition_api/models/payment_option_metadata_model_response.rb +223 -0
  39. data/lib/gpd_debtposition_api/models/payment_option_model.rb +396 -0
  40. data/lib/gpd_debtposition_api/models/payment_option_model_response.rb +432 -0
  41. data/lib/gpd_debtposition_api/models/payment_position_model.rb +568 -0
  42. data/lib/gpd_debtposition_api/models/payment_position_model_base_response.rb +383 -0
  43. data/lib/gpd_debtposition_api/models/payment_positions_info.rb +239 -0
  44. data/lib/gpd_debtposition_api/models/problem_json.rb +259 -0
  45. data/lib/gpd_debtposition_api/models/stamp.rb +305 -0
  46. data/lib/gpd_debtposition_api/models/transfer_metadata_model.rb +231 -0
  47. data/lib/gpd_debtposition_api/models/transfer_metadata_model_response.rb +223 -0
  48. data/lib/gpd_debtposition_api/models/transfer_model.rb +378 -0
  49. data/lib/gpd_debtposition_api/models/transfer_model_response.rb +349 -0
  50. data/lib/gpd_debtposition_api/version.rb +15 -0
  51. data/lib/gpd_debtposition_api.rb +59 -0
  52. data/spec/api/debt_position_actions_api_api_spec.rb +61 -0
  53. data/spec/api/debt_positions_api_api_spec.rb +111 -0
  54. data/spec/api/home_api_spec.rb +46 -0
  55. data/spec/models/app_info_spec.rb +48 -0
  56. data/spec/models/multiple_iupd_model_spec.rb +36 -0
  57. data/spec/models/multiple_payment_position_model_spec.rb +36 -0
  58. data/spec/models/page_info_spec.rb +54 -0
  59. data/spec/models/payment_option_metadata_model_response_spec.rb +42 -0
  60. data/spec/models/payment_option_metadata_model_spec.rb +42 -0
  61. data/spec/models/payment_option_model_response_spec.rb +160 -0
  62. data/spec/models/payment_option_model_spec.rb +96 -0
  63. data/spec/models/payment_position_model_base_response_spec.rb +122 -0
  64. data/spec/models/payment_position_model_spec.rb +170 -0
  65. data/spec/models/payment_positions_info_spec.rb +42 -0
  66. data/spec/models/problem_json_spec.rb +48 -0
  67. data/spec/models/stamp_spec.rb +48 -0
  68. data/spec/models/transfer_metadata_model_response_spec.rb +42 -0
  69. data/spec/models/transfer_metadata_model_spec.rb +42 -0
  70. data/spec/models/transfer_model_response_spec.rb +106 -0
  71. data/spec/models/transfer_model_spec.rb +88 -0
  72. data/spec/spec_helper.rb +111 -0
  73. metadata +175 -0
@@ -0,0 +1,320 @@
1
+ =begin
2
+ #PagoPA API Debt Position
3
+
4
+ #Progetto Gestione Posizioni Debitorie
5
+
6
+ The version of the OpenAPI document: 0.11.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ module GPDDebtPositions
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.uat.platform.pagopa.it'
162
+ @base_path = '/gpd/debt-positions-service/v1'
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
+ 'ApiKey' =>
248
+ {
249
+ type: 'api_key',
250
+ in: 'header',
251
+ key: 'Ocp-Apim-Subscription-Key',
252
+ value: api_key_with_prefix('Ocp-Apim-Subscription-Key')
253
+ },
254
+ 'Authorization' =>
255
+ {
256
+ type: 'bearer',
257
+ in: 'header',
258
+ format: 'JWT',
259
+ key: 'Authorization',
260
+ value: "Bearer #{access_token_with_refresh}"
261
+ },
262
+ }
263
+ end
264
+
265
+ # Returns an array of Server setting
266
+ def server_settings
267
+ [
268
+ {
269
+ url: "https://api.uat.platform.pagopa.it/gpd/debt-positions-service/v1",
270
+ description: "Test environment",
271
+ },
272
+ {
273
+ url: "https://api.platform.pagopa.it/gpd/debt-positions-service/v1",
274
+ description: "Production environment",
275
+ }
276
+ ]
277
+ end
278
+
279
+ def operation_server_settings
280
+ {
281
+ }
282
+ end
283
+
284
+ # Returns URL based on server settings
285
+ #
286
+ # @param index array index of the server settings
287
+ # @param variables hash of variable and the corresponding value
288
+ def server_url(index, variables = {}, servers = nil)
289
+ servers = server_settings if servers == nil
290
+
291
+ # check array index out of bound
292
+ if (index.nil? || index < 0 || index >= servers.size)
293
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
294
+ end
295
+
296
+ server = servers[index]
297
+ url = server[:url]
298
+
299
+ return url unless server.key? :variables
300
+
301
+ # go through variable and assign a value
302
+ server[:variables].each do |name, variable|
303
+ if variables.key?(name)
304
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
305
+ url.gsub! "{" + name.to_s + "}", variables[name]
306
+ else
307
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
308
+ end
309
+ else
310
+ # use default value
311
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
312
+ end
313
+ end
314
+
315
+ url
316
+ end
317
+
318
+
319
+ end
320
+ end
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #PagoPA API Debt Position
3
+
4
+ #Progetto Gestione Posizioni Debitorie
5
+
6
+ The version of the OpenAPI document: 0.11.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module GPDDebtPositions
17
+ class AppInfo
18
+ attr_accessor :name
19
+
20
+ attr_accessor :version
21
+
22
+ attr_accessor :environment
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'name' => :'name',
28
+ :'version' => :'version',
29
+ :'environment' => :'environment'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'name' => :'String',
42
+ :'version' => :'String',
43
+ :'environment' => :'String'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GPDDebtPositions::AppInfo` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GPDDebtPositions::AppInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'name')
69
+ self.name = attributes[:'name']
70
+ end
71
+
72
+ if attributes.key?(:'version')
73
+ self.version = attributes[:'version']
74
+ end
75
+
76
+ if attributes.key?(:'environment')
77
+ self.environment = attributes[:'environment']
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
+ name == o.name &&
102
+ version == o.version &&
103
+ environment == o.environment
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [name, version, environment].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ attributes = attributes.transform_keys(&:to_sym)
124
+ transformed_hash = {}
125
+ openapi_types.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = nil
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
133
+ end
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
136
+ end
137
+ end
138
+ new(transformed_hash)
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def self._deserialize(type, value)
146
+ case type.to_sym
147
+ when :Time
148
+ Time.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ # models (e.g. Pet) or oneOf
179
+ klass = GPDDebtPositions.const_get(type)
180
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+
230
+ end
231
+
232
+ end