pulpcore_client 3.4.0.dev01590354301 → 3.5.0.dev01590700404

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

Potentially problematic release.


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

Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -9
  3. data/docs/{Artifact.md → ArtifactRead.md} +2 -2
  4. data/docs/ArtifactsApi.md +4 -4
  5. data/docs/ExportersCoreExportsApi.md +2 -2
  6. data/docs/ExportersPulpApi.md +8 -8
  7. data/docs/{Import.md → ImportRead.md} +2 -2
  8. data/docs/ImportersCoreImportsApi.md +2 -2
  9. data/docs/ImportersPulpApi.md +8 -8
  10. data/docs/InlineResponse200.md +1 -1
  11. data/docs/InlineResponse2001.md +1 -1
  12. data/docs/InlineResponse2002.md +1 -1
  13. data/docs/InlineResponse2003.md +1 -1
  14. data/docs/InlineResponse2004.md +1 -1
  15. data/docs/InlineResponse2005.md +1 -1
  16. data/docs/InlineResponse2006.md +1 -1
  17. data/docs/InlineResponse2007.md +1 -1
  18. data/docs/InlineResponse2008.md +1 -1
  19. data/docs/InlineResponse2009.md +1 -1
  20. data/docs/PulpExport.md +10 -4
  21. data/docs/PulpExportRead.md +27 -0
  22. data/docs/PulpExporterRead.md +27 -0
  23. data/docs/PulpImporterRead.md +23 -0
  24. data/docs/{SigningService.md → SigningServiceRead.md} +2 -2
  25. data/docs/SigningServicesApi.md +2 -2
  26. data/docs/{TaskGroup.md → TaskGroupRead.md} +2 -2
  27. data/docs/TaskGroupsApi.md +2 -2
  28. data/docs/TaskRead.md +43 -0
  29. data/docs/TasksApi.md +2 -2
  30. data/docs/{UploadDetail.md → UploadDetailRead.md} +2 -2
  31. data/docs/UploadRead.md +23 -0
  32. data/docs/UploadsApi.md +4 -4
  33. data/docs/WorkerRead.md +23 -0
  34. data/docs/WorkersApi.md +2 -2
  35. data/lib/pulpcore_client.rb +11 -5
  36. data/lib/pulpcore_client/api/artifacts_api.rb +6 -6
  37. data/lib/pulpcore_client/api/exporters_core_exports_api.rb +3 -3
  38. data/lib/pulpcore_client/api/exporters_pulp_api.rb +12 -12
  39. data/lib/pulpcore_client/api/importers_core_imports_api.rb +3 -3
  40. data/lib/pulpcore_client/api/importers_pulp_api.rb +12 -12
  41. data/lib/pulpcore_client/api/signing_services_api.rb +3 -3
  42. data/lib/pulpcore_client/api/task_groups_api.rb +3 -3
  43. data/lib/pulpcore_client/api/tasks_api.rb +3 -3
  44. data/lib/pulpcore_client/api/uploads_api.rb +6 -6
  45. data/lib/pulpcore_client/api/workers_api.rb +3 -3
  46. data/lib/pulpcore_client/models/{artifact.rb → artifact_read.rb} +3 -3
  47. data/lib/pulpcore_client/models/{import.rb → import_read.rb} +3 -3
  48. data/lib/pulpcore_client/models/inline_response200.rb +1 -1
  49. data/lib/pulpcore_client/models/inline_response2001.rb +1 -1
  50. data/lib/pulpcore_client/models/inline_response2002.rb +1 -1
  51. data/lib/pulpcore_client/models/inline_response2003.rb +1 -1
  52. data/lib/pulpcore_client/models/inline_response2004.rb +1 -1
  53. data/lib/pulpcore_client/models/inline_response2005.rb +1 -1
  54. data/lib/pulpcore_client/models/inline_response2006.rb +1 -1
  55. data/lib/pulpcore_client/models/inline_response2007.rb +1 -1
  56. data/lib/pulpcore_client/models/inline_response2008.rb +1 -1
  57. data/lib/pulpcore_client/models/inline_response2009.rb +1 -1
  58. data/lib/pulpcore_client/models/pulp_export.rb +59 -38
  59. data/lib/pulpcore_client/models/pulp_export_read.rb +259 -0
  60. data/lib/pulpcore_client/models/pulp_exporter_read.rb +311 -0
  61. data/lib/pulpcore_client/models/pulp_importer_read.rb +262 -0
  62. data/lib/pulpcore_client/models/{signing_service.rb → signing_service_read.rb} +3 -3
  63. data/lib/pulpcore_client/models/{task_group.rb → task_group_read.rb} +3 -3
  64. data/lib/pulpcore_client/models/task_read.rb +383 -0
  65. data/lib/pulpcore_client/models/{upload_detail.rb → upload_detail_read.rb} +3 -3
  66. data/lib/pulpcore_client/models/upload_read.rb +241 -0
  67. data/lib/pulpcore_client/models/worker_read.rb +251 -0
  68. data/lib/pulpcore_client/version.rb +1 -1
  69. data/spec/api/artifacts_api_spec.rb +2 -2
  70. data/spec/api/exporters_core_exports_api_spec.rb +1 -1
  71. data/spec/api/exporters_pulp_api_spec.rb +4 -4
  72. data/spec/api/importers_core_imports_api_spec.rb +1 -1
  73. data/spec/api/importers_pulp_api_spec.rb +4 -4
  74. data/spec/api/signing_services_api_spec.rb +1 -1
  75. data/spec/api/task_groups_api_spec.rb +1 -1
  76. data/spec/api/tasks_api_spec.rb +1 -1
  77. data/spec/api/uploads_api_spec.rb +2 -2
  78. data/spec/api/workers_api_spec.rb +1 -1
  79. data/spec/models/{artifact_spec.rb → artifact_read_spec.rb} +6 -6
  80. data/spec/models/{import_spec.rb → import_read_spec.rb} +6 -6
  81. data/spec/models/pulp_export_read_spec.rb +71 -0
  82. data/spec/models/pulp_export_spec.rb +20 -2
  83. data/spec/models/pulp_exporter_read_spec.rb +71 -0
  84. data/spec/models/pulp_importer_read_spec.rb +59 -0
  85. data/spec/models/{signing_service_spec.rb → signing_service_read_spec.rb} +6 -6
  86. data/spec/models/{task_group_spec.rb → task_group_read_spec.rb} +6 -6
  87. data/spec/models/task_read_spec.rb +119 -0
  88. data/spec/models/{upload_detail_spec.rb → upload_detail_read_spec.rb} +6 -6
  89. data/spec/models/upload_read_spec.rb +59 -0
  90. data/spec/models/worker_read_spec.rb +59 -0
  91. metadata +46 -22
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<PulpExporter>'
41
+ :'results' => :'Array<PulpExporterRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<PulpExport>'
41
+ :'results' => :'Array<PulpExportRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<PulpImporter>'
41
+ :'results' => :'Array<PulpImporterRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<Import>'
41
+ :'results' => :'Array<ImportRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<SigningService>'
41
+ :'results' => :'Array<SigningServiceRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<TaskGroup>'
41
+ :'results' => :'Array<TaskGroupRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<Task>'
41
+ :'results' => :'Array<TaskRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<Upload>'
41
+ :'results' => :'Array<UploadRead>'
42
42
  }
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<Worker>'
41
+ :'results' => :'Array<WorkerRead>'
42
42
  }
43
43
  end
44
44
 
@@ -28,11 +28,20 @@ module PulpcoreClient
28
28
  # Any additional parameters that were used to create the export.
29
29
  attr_accessor :params
30
30
 
31
- # The SHA-256 checksum of the exported .tar.gz.
32
- attr_accessor :sha256
31
+ # Do a Full (true) or Incremental (false) export.
32
+ attr_accessor :full
33
33
 
34
- # The full-path filename of the exported .tar.gz.
35
- attr_accessor :filename
34
+ # Generate report on what would be exported and disk-space required.
35
+ attr_accessor :dry_run
36
+
37
+ # List of explicit repo-version hrefs to export
38
+ attr_accessor :versions
39
+
40
+ # Chunk export-tarfile into pieces of chunk_size bytes.Recognizes units of B/KB/MB/GB/TB.
41
+ attr_accessor :chunk_size
42
+
43
+ # Dictionary of filename: sha256hash entries for export-output-file(s)
44
+ attr_accessor :output_file_info
36
45
 
37
46
  # Attribute mapping from ruby-style variable name to JSON key.
38
47
  def self.attribute_map
@@ -42,8 +51,11 @@ module PulpcoreClient
42
51
  :'task' => :'task',
43
52
  :'exported_resources' => :'exported_resources',
44
53
  :'params' => :'params',
45
- :'sha256' => :'sha256',
46
- :'filename' => :'filename'
54
+ :'full' => :'full',
55
+ :'dry_run' => :'dry_run',
56
+ :'versions' => :'versions',
57
+ :'chunk_size' => :'chunk_size',
58
+ :'output_file_info' => :'output_file_info'
47
59
  }
48
60
  end
49
61
 
@@ -55,8 +67,11 @@ module PulpcoreClient
55
67
  :'task' => :'String',
56
68
  :'exported_resources' => :'Array<Object>',
57
69
  :'params' => :'Object',
58
- :'sha256' => :'String',
59
- :'filename' => :'String'
70
+ :'full' => :'Boolean',
71
+ :'dry_run' => :'Boolean',
72
+ :'versions' => :'Array<String>',
73
+ :'chunk_size' => :'String',
74
+ :'output_file_info' => :'Object'
60
75
  }
61
76
  end
62
77
 
@@ -104,12 +119,30 @@ module PulpcoreClient
104
119
  self.params = attributes[:'params']
105
120
  end
106
121
 
107
- if attributes.key?(:'sha256')
108
- self.sha256 = attributes[:'sha256']
122
+ if attributes.key?(:'full')
123
+ self.full = attributes[:'full']
124
+ else
125
+ self.full = true
126
+ end
127
+
128
+ if attributes.key?(:'dry_run')
129
+ self.dry_run = attributes[:'dry_run']
130
+ else
131
+ self.dry_run = false
132
+ end
133
+
134
+ if attributes.key?(:'versions')
135
+ if (value = attributes[:'versions']).is_a?(Array)
136
+ self.versions = value
137
+ end
109
138
  end
110
139
 
111
- if attributes.key?(:'filename')
112
- self.filename = attributes[:'filename']
140
+ if attributes.key?(:'chunk_size')
141
+ self.chunk_size = attributes[:'chunk_size']
142
+ end
143
+
144
+ if attributes.key?(:'output_file_info')
145
+ self.output_file_info = attributes[:'output_file_info']
113
146
  end
114
147
  end
115
148
 
@@ -117,12 +150,8 @@ module PulpcoreClient
117
150
  # @return Array for valid properties with the reasons
118
151
  def list_invalid_properties
119
152
  invalid_properties = Array.new
120
- if !@sha256.nil? && @sha256.to_s.length < 1
121
- invalid_properties.push('invalid value for "sha256", the character length must be great than or equal to 1.')
122
- end
123
-
124
- if !@filename.nil? && @filename.to_s.length < 1
125
- invalid_properties.push('invalid value for "filename", the character length must be great than or equal to 1.')
153
+ if !@chunk_size.nil? && @chunk_size.to_s.length < 1
154
+ invalid_properties.push('invalid value for "chunk_size", the character length must be great than or equal to 1.')
126
155
  end
127
156
 
128
157
  invalid_properties
@@ -131,29 +160,18 @@ module PulpcoreClient
131
160
  # Check to see if the all the properties in the model are valid
132
161
  # @return true if the model is valid
133
162
  def valid?
134
- return false if !@sha256.nil? && @sha256.to_s.length < 1
135
- return false if !@filename.nil? && @filename.to_s.length < 1
163
+ return false if !@chunk_size.nil? && @chunk_size.to_s.length < 1
136
164
  true
137
165
  end
138
166
 
139
167
  # Custom attribute writer method with validation
140
- # @param [Object] sha256 Value to be assigned
141
- def sha256=(sha256)
142
- if !sha256.nil? && sha256.to_s.length < 1
143
- fail ArgumentError, 'invalid value for "sha256", the character length must be great than or equal to 1.'
144
- end
145
-
146
- @sha256 = sha256
147
- end
148
-
149
- # Custom attribute writer method with validation
150
- # @param [Object] filename Value to be assigned
151
- def filename=(filename)
152
- if !filename.nil? && filename.to_s.length < 1
153
- fail ArgumentError, 'invalid value for "filename", the character length must be great than or equal to 1.'
168
+ # @param [Object] chunk_size Value to be assigned
169
+ def chunk_size=(chunk_size)
170
+ if !chunk_size.nil? && chunk_size.to_s.length < 1
171
+ fail ArgumentError, 'invalid value for "chunk_size", the character length must be great than or equal to 1.'
154
172
  end
155
173
 
156
- @filename = filename
174
+ @chunk_size = chunk_size
157
175
  end
158
176
 
159
177
  # Checks equality by comparing each attribute.
@@ -166,8 +184,11 @@ module PulpcoreClient
166
184
  task == o.task &&
167
185
  exported_resources == o.exported_resources &&
168
186
  params == o.params &&
169
- sha256 == o.sha256 &&
170
- filename == o.filename
187
+ full == o.full &&
188
+ dry_run == o.dry_run &&
189
+ versions == o.versions &&
190
+ chunk_size == o.chunk_size &&
191
+ output_file_info == o.output_file_info
171
192
  end
172
193
 
173
194
  # @see the `==` method
@@ -179,7 +200,7 @@ module PulpcoreClient
179
200
  # Calculates hash code according to all attributes.
180
201
  # @return [Integer] Hash code
181
202
  def hash
182
- [pulp_href, pulp_created, task, exported_resources, params, sha256, filename].hash
203
+ [pulp_href, pulp_created, task, exported_resources, params, full, dry_run, versions, chunk_size, output_file_info].hash
183
204
  end
184
205
 
185
206
  # Builds the object from hash
@@ -0,0 +1,259 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpcoreClient
16
+ class PulpExportRead
17
+ attr_accessor :pulp_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :pulp_created
21
+
22
+ # A URI of the task that ran the Export.
23
+ attr_accessor :task
24
+
25
+ # Resources that were exported.
26
+ attr_accessor :exported_resources
27
+
28
+ # Any additional parameters that were used to create the export.
29
+ attr_accessor :params
30
+
31
+ # Dictionary of filename: sha256hash entries for export-output-file(s)
32
+ attr_accessor :output_file_info
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'pulp_href' => :'pulp_href',
38
+ :'pulp_created' => :'pulp_created',
39
+ :'task' => :'task',
40
+ :'exported_resources' => :'exported_resources',
41
+ :'params' => :'params',
42
+ :'output_file_info' => :'output_file_info'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'pulp_href' => :'String',
50
+ :'pulp_created' => :'DateTime',
51
+ :'task' => :'String',
52
+ :'exported_resources' => :'Array<Object>',
53
+ :'params' => :'Object',
54
+ :'output_file_info' => :'Object'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ :'task',
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PulpExportRead` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PulpExportRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'pulp_href')
81
+ self.pulp_href = attributes[:'pulp_href']
82
+ end
83
+
84
+ if attributes.key?(:'pulp_created')
85
+ self.pulp_created = attributes[:'pulp_created']
86
+ end
87
+
88
+ if attributes.key?(:'task')
89
+ self.task = attributes[:'task']
90
+ end
91
+
92
+ if attributes.key?(:'exported_resources')
93
+ if (value = attributes[:'exported_resources']).is_a?(Array)
94
+ self.exported_resources = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'params')
99
+ self.params = attributes[:'params']
100
+ end
101
+
102
+ if attributes.key?(:'output_file_info')
103
+ self.output_file_info = attributes[:'output_file_info']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ pulp_href == o.pulp_href &&
126
+ pulp_created == o.pulp_created &&
127
+ task == o.task &&
128
+ exported_resources == o.exported_resources &&
129
+ params == o.params &&
130
+ output_file_info == o.output_file_info
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [pulp_href, pulp_created, task, exported_resources, params, output_file_info].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ PulpcoreClient.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end