pulp_rpm_client 3.0.0b3.dev.1559835992

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pulp_rpm_client might be problematic. Click here for more details.

Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +134 -0
  5. data/Rakefile +10 -0
  6. data/docs/AsyncOperationResponse.md +17 -0
  7. data/docs/ContentApi.md +396 -0
  8. data/docs/DistributionsApi.md +352 -0
  9. data/docs/InlineResponse200.md +23 -0
  10. data/docs/InlineResponse2001.md +23 -0
  11. data/docs/InlineResponse2002.md +23 -0
  12. data/docs/InlineResponse2003.md +23 -0
  13. data/docs/InlineResponse2004.md +23 -0
  14. data/docs/Package.md +95 -0
  15. data/docs/PublicationsApi.md +229 -0
  16. data/docs/RemotesApi.md +412 -0
  17. data/docs/RepositorySyncURL.md +19 -0
  18. data/docs/RpmApi.md +128 -0
  19. data/docs/RpmDistribution.md +29 -0
  20. data/docs/RpmPublication.md +27 -0
  21. data/docs/RpmRemote.md +47 -0
  22. data/docs/UpdateRecord.md +55 -0
  23. data/git_push.sh +55 -0
  24. data/lib/pulp_rpm_client/api/content_api.rb +482 -0
  25. data/lib/pulp_rpm_client/api/distributions_api.rb +430 -0
  26. data/lib/pulp_rpm_client/api/publications_api.rb +273 -0
  27. data/lib/pulp_rpm_client/api/remotes_api.rb +506 -0
  28. data/lib/pulp_rpm_client/api/rpm_api.rb +164 -0
  29. data/lib/pulp_rpm_client/api_client.rb +386 -0
  30. data/lib/pulp_rpm_client/api_error.rb +57 -0
  31. data/lib/pulp_rpm_client/configuration.rb +248 -0
  32. data/lib/pulp_rpm_client/models/async_operation_response.rb +202 -0
  33. data/lib/pulp_rpm_client/models/inline_response200.rb +235 -0
  34. data/lib/pulp_rpm_client/models/inline_response2001.rb +235 -0
  35. data/lib/pulp_rpm_client/models/inline_response2002.rb +235 -0
  36. data/lib/pulp_rpm_client/models/inline_response2003.rb +235 -0
  37. data/lib/pulp_rpm_client/models/inline_response2004.rb +235 -0
  38. data/lib/pulp_rpm_client/models/package.rb +983 -0
  39. data/lib/pulp_rpm_client/models/repository_sync_url.rb +214 -0
  40. data/lib/pulp_rpm_client/models/rpm_distribution.rb +337 -0
  41. data/lib/pulp_rpm_client/models/rpm_publication.rb +258 -0
  42. data/lib/pulp_rpm_client/models/rpm_remote.rb +549 -0
  43. data/lib/pulp_rpm_client/models/update_record.rb +764 -0
  44. data/lib/pulp_rpm_client/version.rb +15 -0
  45. data/lib/pulp_rpm_client.rb +56 -0
  46. data/pulp_rpm_client.gemspec +45 -0
  47. data/spec/api/content_api_spec.rb +137 -0
  48. data/spec/api/distributions_api_spec.rb +116 -0
  49. data/spec/api/publications_api_spec.rb +85 -0
  50. data/spec/api/remotes_api_spec.rb +131 -0
  51. data/spec/api/rpm_api_spec.rb +63 -0
  52. data/spec/api_client_spec.rb +226 -0
  53. data/spec/configuration_spec.rb +42 -0
  54. data/spec/models/async_operation_response_spec.rb +41 -0
  55. data/spec/models/inline_response2001_spec.rb +59 -0
  56. data/spec/models/inline_response2002_spec.rb +59 -0
  57. data/spec/models/inline_response2003_spec.rb +59 -0
  58. data/spec/models/inline_response2004_spec.rb +59 -0
  59. data/spec/models/inline_response200_spec.rb +59 -0
  60. data/spec/models/package_spec.rb +275 -0
  61. data/spec/models/repository_sync_url_spec.rb +47 -0
  62. data/spec/models/rpm_distribution_spec.rb +77 -0
  63. data/spec/models/rpm_publication_spec.rb +71 -0
  64. data/spec/models/rpm_remote_spec.rb +135 -0
  65. data/spec/models/update_record_spec.rb +155 -0
  66. data/spec/spec_helper.rb +111 -0
  67. metadata +309 -0
@@ -0,0 +1,549 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.2-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpRpmClient
16
+ class RpmRemote
17
+ attr_accessor :_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :_created
21
+
22
+ attr_accessor :_type
23
+
24
+ # A unique name for this remote.
25
+ attr_accessor :name
26
+
27
+ # The URL of an external content source.
28
+ attr_accessor :url
29
+
30
+ # If True, the plugin will validate imported artifacts.
31
+ attr_accessor :validate
32
+
33
+ # A PEM encoded CA certificate used to validate the server certificate presented by the remote server. Returns SHA256 sum on GET.
34
+ attr_accessor :ssl_ca_certificate
35
+
36
+ # A PEM encoded client certificate used for authentication. Returns SHA256 sum on GET.
37
+ attr_accessor :ssl_client_certificate
38
+
39
+ # A PEM encoded private key used for authentication. Returns SHA256 sum on GET.
40
+ attr_accessor :ssl_client_key
41
+
42
+ # If True, SSL peer validation must be performed.
43
+ attr_accessor :ssl_validation
44
+
45
+ # The proxy URL. Format: scheme://user:password@host:port
46
+ attr_accessor :proxy_url
47
+
48
+ # The username to be used for authentication when syncing.
49
+ attr_accessor :username
50
+
51
+ # The password to be used for authentication when syncing.
52
+ attr_accessor :password
53
+
54
+ # Timestamp of the most recent update of the remote.
55
+ attr_accessor :_last_updated
56
+
57
+ # Total number of simultaneous connections.
58
+ attr_accessor :download_concurrency
59
+
60
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'cache_only'. 'immediate' is the default.
61
+ attr_accessor :policy
62
+
63
+ class EnumAttributeValidator
64
+ attr_reader :datatype
65
+ attr_reader :allowable_values
66
+
67
+ def initialize(datatype, allowable_values)
68
+ @allowable_values = allowable_values.map do |value|
69
+ case datatype.to_s
70
+ when /Integer/i
71
+ value.to_i
72
+ when /Float/i
73
+ value.to_f
74
+ else
75
+ value
76
+ end
77
+ end
78
+ end
79
+
80
+ def valid?(value)
81
+ !value || allowable_values.include?(value)
82
+ end
83
+ end
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'_href' => :'_href',
89
+ :'_created' => :'_created',
90
+ :'_type' => :'_type',
91
+ :'name' => :'name',
92
+ :'url' => :'url',
93
+ :'validate' => :'validate',
94
+ :'ssl_ca_certificate' => :'ssl_ca_certificate',
95
+ :'ssl_client_certificate' => :'ssl_client_certificate',
96
+ :'ssl_client_key' => :'ssl_client_key',
97
+ :'ssl_validation' => :'ssl_validation',
98
+ :'proxy_url' => :'proxy_url',
99
+ :'username' => :'username',
100
+ :'password' => :'password',
101
+ :'_last_updated' => :'_last_updated',
102
+ :'download_concurrency' => :'download_concurrency',
103
+ :'policy' => :'policy'
104
+ }
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.openapi_types
109
+ {
110
+ :'_href' => :'String',
111
+ :'_created' => :'DateTime',
112
+ :'_type' => :'String',
113
+ :'name' => :'String',
114
+ :'url' => :'String',
115
+ :'validate' => :'Boolean',
116
+ :'ssl_ca_certificate' => :'String',
117
+ :'ssl_client_certificate' => :'String',
118
+ :'ssl_client_key' => :'String',
119
+ :'ssl_validation' => :'Boolean',
120
+ :'proxy_url' => :'String',
121
+ :'username' => :'String',
122
+ :'password' => :'String',
123
+ :'_last_updated' => :'DateTime',
124
+ :'download_concurrency' => :'Integer',
125
+ :'policy' => :'String'
126
+ }
127
+ end
128
+
129
+ # Initializes the object
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ def initialize(attributes = {})
132
+ if (!attributes.is_a?(Hash))
133
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::RpmRemote` initialize method"
134
+ end
135
+
136
+ # check to see if the attribute exists and convert string to symbol for hash key
137
+ attributes = attributes.each_with_object({}) { |(k, v), h|
138
+ if (!self.class.attribute_map.key?(k.to_sym))
139
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::RpmRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
140
+ end
141
+ h[k.to_sym] = v
142
+ }
143
+
144
+ if attributes.key?(:'_href')
145
+ self._href = attributes[:'_href']
146
+ end
147
+
148
+ if attributes.key?(:'_created')
149
+ self._created = attributes[:'_created']
150
+ end
151
+
152
+ if attributes.key?(:'_type')
153
+ self._type = attributes[:'_type']
154
+ end
155
+
156
+ if attributes.key?(:'name')
157
+ self.name = attributes[:'name']
158
+ end
159
+
160
+ if attributes.key?(:'url')
161
+ self.url = attributes[:'url']
162
+ end
163
+
164
+ if attributes.key?(:'validate')
165
+ self.validate = attributes[:'validate']
166
+ end
167
+
168
+ if attributes.key?(:'ssl_ca_certificate')
169
+ self.ssl_ca_certificate = attributes[:'ssl_ca_certificate']
170
+ end
171
+
172
+ if attributes.key?(:'ssl_client_certificate')
173
+ self.ssl_client_certificate = attributes[:'ssl_client_certificate']
174
+ end
175
+
176
+ if attributes.key?(:'ssl_client_key')
177
+ self.ssl_client_key = attributes[:'ssl_client_key']
178
+ end
179
+
180
+ if attributes.key?(:'ssl_validation')
181
+ self.ssl_validation = attributes[:'ssl_validation']
182
+ end
183
+
184
+ if attributes.key?(:'proxy_url')
185
+ self.proxy_url = attributes[:'proxy_url']
186
+ end
187
+
188
+ if attributes.key?(:'username')
189
+ self.username = attributes[:'username']
190
+ end
191
+
192
+ if attributes.key?(:'password')
193
+ self.password = attributes[:'password']
194
+ end
195
+
196
+ if attributes.key?(:'_last_updated')
197
+ self._last_updated = attributes[:'_last_updated']
198
+ end
199
+
200
+ if attributes.key?(:'download_concurrency')
201
+ self.download_concurrency = attributes[:'download_concurrency']
202
+ end
203
+
204
+ if attributes.key?(:'policy')
205
+ self.policy = attributes[:'policy']
206
+ else
207
+ self.policy = 'immediate'
208
+ end
209
+ end
210
+
211
+ # Show invalid properties with the reasons. Usually used together with valid?
212
+ # @return Array for valid properties with the reasons
213
+ def list_invalid_properties
214
+ invalid_properties = Array.new
215
+ if !@_type.nil? && @_type.to_s.length < 1
216
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
217
+ end
218
+
219
+ if @name.nil?
220
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
221
+ end
222
+
223
+ if @name.to_s.length < 1
224
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
225
+ end
226
+
227
+ if @url.nil?
228
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
229
+ end
230
+
231
+ if @url.to_s.length < 1
232
+ invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
233
+ end
234
+
235
+ if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1
236
+ invalid_properties.push('invalid value for "ssl_ca_certificate", the character length must be great than or equal to 1.')
237
+ end
238
+
239
+ if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1
240
+ invalid_properties.push('invalid value for "ssl_client_certificate", the character length must be great than or equal to 1.')
241
+ end
242
+
243
+ if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1
244
+ invalid_properties.push('invalid value for "ssl_client_key", the character length must be great than or equal to 1.')
245
+ end
246
+
247
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
248
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
249
+ end
250
+
251
+ if !@username.nil? && @username.to_s.length < 1
252
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
253
+ end
254
+
255
+ if !@password.nil? && @password.to_s.length < 1
256
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
257
+ end
258
+
259
+ if !@download_concurrency.nil? && @download_concurrency < 1
260
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
261
+ end
262
+
263
+ invalid_properties
264
+ end
265
+
266
+ # Check to see if the all the properties in the model are valid
267
+ # @return true if the model is valid
268
+ def valid?
269
+ return false if !@_type.nil? && @_type.to_s.length < 1
270
+ return false if @name.nil?
271
+ return false if @name.to_s.length < 1
272
+ return false if @url.nil?
273
+ return false if @url.to_s.length < 1
274
+ return false if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1
275
+ return false if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1
276
+ return false if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1
277
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
278
+ return false if !@username.nil? && @username.to_s.length < 1
279
+ return false if !@password.nil? && @password.to_s.length < 1
280
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
281
+ policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
282
+ return false unless policy_validator.valid?(@policy)
283
+ true
284
+ end
285
+
286
+ # Custom attribute writer method with validation
287
+ # @param [Object] _type Value to be assigned
288
+ def _type=(_type)
289
+ if !_type.nil? && _type.to_s.length < 1
290
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
291
+ end
292
+
293
+ @_type = _type
294
+ end
295
+
296
+ # Custom attribute writer method with validation
297
+ # @param [Object] name Value to be assigned
298
+ def name=(name)
299
+ if name.nil?
300
+ fail ArgumentError, 'name cannot be nil'
301
+ end
302
+
303
+ if name.to_s.length < 1
304
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
305
+ end
306
+
307
+ @name = name
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] url Value to be assigned
312
+ def url=(url)
313
+ if url.nil?
314
+ fail ArgumentError, 'url cannot be nil'
315
+ end
316
+
317
+ if url.to_s.length < 1
318
+ fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
319
+ end
320
+
321
+ @url = url
322
+ end
323
+
324
+ # Custom attribute writer method with validation
325
+ # @param [Object] ssl_ca_certificate Value to be assigned
326
+ def ssl_ca_certificate=(ssl_ca_certificate)
327
+ if !ssl_ca_certificate.nil? && ssl_ca_certificate.to_s.length < 1
328
+ fail ArgumentError, 'invalid value for "ssl_ca_certificate", the character length must be great than or equal to 1.'
329
+ end
330
+
331
+ @ssl_ca_certificate = ssl_ca_certificate
332
+ end
333
+
334
+ # Custom attribute writer method with validation
335
+ # @param [Object] ssl_client_certificate Value to be assigned
336
+ def ssl_client_certificate=(ssl_client_certificate)
337
+ if !ssl_client_certificate.nil? && ssl_client_certificate.to_s.length < 1
338
+ fail ArgumentError, 'invalid value for "ssl_client_certificate", the character length must be great than or equal to 1.'
339
+ end
340
+
341
+ @ssl_client_certificate = ssl_client_certificate
342
+ end
343
+
344
+ # Custom attribute writer method with validation
345
+ # @param [Object] ssl_client_key Value to be assigned
346
+ def ssl_client_key=(ssl_client_key)
347
+ if !ssl_client_key.nil? && ssl_client_key.to_s.length < 1
348
+ fail ArgumentError, 'invalid value for "ssl_client_key", the character length must be great than or equal to 1.'
349
+ end
350
+
351
+ @ssl_client_key = ssl_client_key
352
+ end
353
+
354
+ # Custom attribute writer method with validation
355
+ # @param [Object] proxy_url Value to be assigned
356
+ def proxy_url=(proxy_url)
357
+ if !proxy_url.nil? && proxy_url.to_s.length < 1
358
+ fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
359
+ end
360
+
361
+ @proxy_url = proxy_url
362
+ end
363
+
364
+ # Custom attribute writer method with validation
365
+ # @param [Object] username Value to be assigned
366
+ def username=(username)
367
+ if !username.nil? && username.to_s.length < 1
368
+ fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
369
+ end
370
+
371
+ @username = username
372
+ end
373
+
374
+ # Custom attribute writer method with validation
375
+ # @param [Object] password Value to be assigned
376
+ def password=(password)
377
+ if !password.nil? && password.to_s.length < 1
378
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
379
+ end
380
+
381
+ @password = password
382
+ end
383
+
384
+ # Custom attribute writer method with validation
385
+ # @param [Object] download_concurrency Value to be assigned
386
+ def download_concurrency=(download_concurrency)
387
+ if !download_concurrency.nil? && download_concurrency < 1
388
+ fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
389
+ end
390
+
391
+ @download_concurrency = download_concurrency
392
+ end
393
+
394
+ # Custom attribute writer method checking allowed values (enum).
395
+ # @param [Object] policy Object to be assigned
396
+ def policy=(policy)
397
+ validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
398
+ unless validator.valid?(policy)
399
+ fail ArgumentError, "invalid value for \"policy\", must be one of #{validator.allowable_values}."
400
+ end
401
+ @policy = policy
402
+ end
403
+
404
+ # Checks equality by comparing each attribute.
405
+ # @param [Object] Object to be compared
406
+ def ==(o)
407
+ return true if self.equal?(o)
408
+ self.class == o.class &&
409
+ _href == o._href &&
410
+ _created == o._created &&
411
+ _type == o._type &&
412
+ name == o.name &&
413
+ url == o.url &&
414
+ validate == o.validate &&
415
+ ssl_ca_certificate == o.ssl_ca_certificate &&
416
+ ssl_client_certificate == o.ssl_client_certificate &&
417
+ ssl_client_key == o.ssl_client_key &&
418
+ ssl_validation == o.ssl_validation &&
419
+ proxy_url == o.proxy_url &&
420
+ username == o.username &&
421
+ password == o.password &&
422
+ _last_updated == o._last_updated &&
423
+ download_concurrency == o.download_concurrency &&
424
+ policy == o.policy
425
+ end
426
+
427
+ # @see the `==` method
428
+ # @param [Object] Object to be compared
429
+ def eql?(o)
430
+ self == o
431
+ end
432
+
433
+ # Calculates hash code according to all attributes.
434
+ # @return [Integer] Hash code
435
+ def hash
436
+ [_href, _created, _type, name, url, validate, ssl_ca_certificate, ssl_client_certificate, ssl_client_key, ssl_validation, proxy_url, username, password, _last_updated, download_concurrency, policy].hash
437
+ end
438
+
439
+ # Builds the object from hash
440
+ # @param [Hash] attributes Model attributes in the form of hash
441
+ # @return [Object] Returns the model itself
442
+ def self.build_from_hash(attributes)
443
+ new.build_from_hash(attributes)
444
+ end
445
+
446
+ # Builds the object from hash
447
+ # @param [Hash] attributes Model attributes in the form of hash
448
+ # @return [Object] Returns the model itself
449
+ def build_from_hash(attributes)
450
+ return nil unless attributes.is_a?(Hash)
451
+ self.class.openapi_types.each_pair do |key, type|
452
+ if type =~ /\AArray<(.*)>/i
453
+ # check to ensure the input is an array given that the attribute
454
+ # is documented as an array but the input is not
455
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
456
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
457
+ end
458
+ elsif !attributes[self.class.attribute_map[key]].nil?
459
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
460
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
461
+ end
462
+
463
+ self
464
+ end
465
+
466
+ # Deserializes the data based on type
467
+ # @param string type Data type
468
+ # @param string value Value to be deserialized
469
+ # @return [Object] Deserialized data
470
+ def _deserialize(type, value)
471
+ case type.to_sym
472
+ when :DateTime
473
+ DateTime.parse(value)
474
+ when :Date
475
+ Date.parse(value)
476
+ when :String
477
+ value.to_s
478
+ when :Integer
479
+ value.to_i
480
+ when :Float
481
+ value.to_f
482
+ when :Boolean
483
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
484
+ true
485
+ else
486
+ false
487
+ end
488
+ when :Object
489
+ # generic object (usually a Hash), return directly
490
+ value
491
+ when /\AArray<(?<inner_type>.+)>\z/
492
+ inner_type = Regexp.last_match[:inner_type]
493
+ value.map { |v| _deserialize(inner_type, v) }
494
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
495
+ k_type = Regexp.last_match[:k_type]
496
+ v_type = Regexp.last_match[:v_type]
497
+ {}.tap do |hash|
498
+ value.each do |k, v|
499
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
500
+ end
501
+ end
502
+ else # model
503
+ PulpRpmClient.const_get(type).build_from_hash(value)
504
+ end
505
+ end
506
+
507
+ # Returns the string representation of the object
508
+ # @return [String] String presentation of the object
509
+ def to_s
510
+ to_hash.to_s
511
+ end
512
+
513
+ # to_body is an alias to to_hash (backward compatibility)
514
+ # @return [Hash] Returns the object in the form of hash
515
+ def to_body
516
+ to_hash
517
+ end
518
+
519
+ # Returns the object in the form of hash
520
+ # @return [Hash] Returns the object in the form of hash
521
+ def to_hash
522
+ hash = {}
523
+ self.class.attribute_map.each_pair do |attr, param|
524
+ value = self.send(attr)
525
+ next if value.nil?
526
+ hash[param] = _to_hash(value)
527
+ end
528
+ hash
529
+ end
530
+
531
+ # Outputs non-array value in the form of hash
532
+ # For object, use to_hash. Otherwise, just return the value
533
+ # @param [Object] value Any valid value
534
+ # @return [Hash] Returns the value in the form of hash
535
+ def _to_hash(value)
536
+ if value.is_a?(Array)
537
+ value.compact.map { |v| _to_hash(v) }
538
+ elsif value.is_a?(Hash)
539
+ {}.tap do |hash|
540
+ value.each { |k, v| hash[k] = _to_hash(v) }
541
+ end
542
+ elsif value.respond_to? :to_hash
543
+ value.to_hash
544
+ else
545
+ value
546
+ end
547
+ end
548
+ end
549
+ end