pulpcore_client 3.9.1 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -16
  3. data/docs/AccessPoliciesApi.md +12 -0
  4. data/docs/AccessPolicy.md +1 -3
  5. data/docs/AccessPolicyResponse.md +4 -2
  6. data/docs/ContentApi.md +78 -0
  7. data/docs/ContentGuardResponse.md +23 -0
  8. data/docs/ContentGuardsApi.md +82 -0
  9. data/docs/EvaluationResponse.md +21 -0
  10. data/docs/ExportersCoreExportsApi.md +15 -15
  11. data/docs/ExportersPulpApi.md +6 -0
  12. data/docs/GroupsApi.md +14 -0
  13. data/docs/GroupsModelPermissionsApi.md +118 -5
  14. data/docs/GroupsObjectPermissionsApi.md +15 -15
  15. data/docs/GroupsUsersApi.md +10 -10
  16. data/docs/ImportersCoreImportCheckApi.md +62 -0
  17. data/docs/ImportersCoreImportsApi.md +15 -15
  18. data/docs/ImportersPulpApi.md +6 -0
  19. data/docs/MultipleArtifactContentResponse.md +21 -0
  20. data/docs/PaginatedContentGuardResponseList.md +23 -0
  21. data/docs/PaginatedMultipleArtifactContentResponseList.md +23 -0
  22. data/docs/PaginatedRepositoryResponseList.md +23 -0
  23. data/docs/PatchedAccessPolicy.md +1 -3
  24. data/docs/PermissionResponse.md +1 -1
  25. data/docs/PulpImportCheck.md +21 -0
  26. data/docs/PulpImportCheckResponse.md +21 -0
  27. data/docs/RepositoriesApi.md +84 -0
  28. data/docs/RepositoryResponse.md +31 -0
  29. data/docs/SigningServiceResponse.md +4 -0
  30. data/docs/UsersApi.md +44 -0
  31. data/docs/WorkerResponse.md +3 -3
  32. data/docs/WorkersApi.md +6 -0
  33. data/lib/pulpcore_client/api/access_policies_api.rb +18 -0
  34. data/lib/pulpcore_client/api/content_api.rb +102 -0
  35. data/lib/pulpcore_client/api/content_guards_api.rb +108 -0
  36. data/lib/pulpcore_client/api/exporters_core_exports_api.rb +27 -27
  37. data/lib/pulpcore_client/api/exporters_pulp_api.rb +9 -0
  38. data/lib/pulpcore_client/api/groups_api.rb +21 -0
  39. data/lib/pulpcore_client/api/groups_model_permissions_api.rb +137 -9
  40. data/lib/pulpcore_client/api/groups_object_permissions_api.rb +27 -27
  41. data/lib/pulpcore_client/api/groups_users_api.rb +18 -18
  42. data/lib/pulpcore_client/api/importers_core_import_check_api.rb +86 -0
  43. data/lib/pulpcore_client/api/importers_core_imports_api.rb +27 -27
  44. data/lib/pulpcore_client/api/importers_pulp_api.rb +9 -0
  45. data/lib/pulpcore_client/api/repositories_api.rb +111 -0
  46. data/lib/pulpcore_client/api/users_api.rb +66 -0
  47. data/lib/pulpcore_client/api/workers_api.rb +9 -0
  48. data/lib/pulpcore_client/models/access_policy.rb +4 -19
  49. data/lib/pulpcore_client/models/access_policy_response.rb +14 -9
  50. data/lib/pulpcore_client/models/content_guard_response.rb +243 -0
  51. data/lib/pulpcore_client/models/evaluation_response.rb +245 -0
  52. data/lib/pulpcore_client/models/multiple_artifact_content_response.rb +232 -0
  53. data/lib/pulpcore_client/models/paginated_content_guard_response_list.rb +237 -0
  54. data/lib/pulpcore_client/models/paginated_multiple_artifact_content_response_list.rb +237 -0
  55. data/lib/pulpcore_client/models/paginated_repository_response_list.rb +237 -0
  56. data/lib/pulpcore_client/models/patched_access_policy.rb +4 -14
  57. data/lib/pulpcore_client/models/permission_response.rb +1 -1
  58. data/lib/pulpcore_client/models/pulp_import_check.rb +228 -0
  59. data/lib/pulpcore_client/models/pulp_import_check_response.rb +228 -0
  60. data/lib/pulpcore_client/models/repository_response.rb +280 -0
  61. data/lib/pulpcore_client/models/signing_service_response.rb +31 -1
  62. data/lib/pulpcore_client/models/worker_response.rb +10 -10
  63. data/lib/pulpcore_client/version.rb +1 -1
  64. data/lib/pulpcore_client.rb +13 -0
  65. data/spec/api/access_policies_api_spec.rb +6 -0
  66. data/spec/api/content_api_spec.rb +54 -0
  67. data/spec/api/content_guards_api_spec.rb +56 -0
  68. data/spec/api/exporters_core_exports_api_spec.rb +3 -3
  69. data/spec/api/exporters_pulp_api_spec.rb +3 -0
  70. data/spec/api/groups_api_spec.rb +7 -0
  71. data/spec/api/groups_model_permissions_api_spec.rb +27 -1
  72. data/spec/api/groups_object_permissions_api_spec.rb +3 -3
  73. data/spec/api/groups_users_api_spec.rb +2 -2
  74. data/spec/api/importers_core_import_check_api_spec.rb +47 -0
  75. data/spec/api/importers_core_imports_api_spec.rb +3 -3
  76. data/spec/api/importers_pulp_api_spec.rb +3 -0
  77. data/spec/api/repositories_api_spec.rb +57 -0
  78. data/spec/api/users_api_spec.rb +22 -0
  79. data/spec/api/workers_api_spec.rb +3 -0
  80. data/spec/models/access_policy_response_spec.rb +6 -0
  81. data/spec/models/access_policy_spec.rb +0 -6
  82. data/spec/models/content_guard_response_spec.rb +59 -0
  83. data/spec/models/evaluation_response_spec.rb +53 -0
  84. data/spec/models/multiple_artifact_content_response_spec.rb +53 -0
  85. data/spec/models/paginated_content_guard_response_list_spec.rb +59 -0
  86. data/spec/models/paginated_multiple_artifact_content_response_list_spec.rb +59 -0
  87. data/spec/models/paginated_repository_response_list_spec.rb +59 -0
  88. data/spec/models/patched_access_policy_spec.rb +0 -6
  89. data/spec/models/pulp_import_check_response_spec.rb +53 -0
  90. data/spec/models/pulp_import_check_spec.rb +53 -0
  91. data/spec/models/repository_response_spec.rb +83 -0
  92. data/spec/models/signing_service_response_spec.rb +12 -0
  93. data/spec/models/worker_response_spec.rb +2 -2
  94. metadata +112 -60
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
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 PaginatedRepositoryResponseList
17
+ attr_accessor :count
18
+
19
+ attr_accessor :_next
20
+
21
+ attr_accessor :previous
22
+
23
+ attr_accessor :results
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'count' => :'count',
29
+ :'_next' => :'next',
30
+ :'previous' => :'previous',
31
+ :'results' => :'results'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'count' => :'Integer',
39
+ :'_next' => :'String',
40
+ :'previous' => :'String',
41
+ :'results' => :'Array<RepositoryResponse>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'_next',
49
+ :'previous',
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 `PulpcoreClient::PaginatedRepositoryResponseList` 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 `PulpcoreClient::PaginatedRepositoryResponseList`. 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?(:'count')
69
+ self.count = attributes[:'count']
70
+ end
71
+
72
+ if attributes.key?(:'_next')
73
+ self._next = attributes[:'_next']
74
+ end
75
+
76
+ if attributes.key?(:'previous')
77
+ self.previous = attributes[:'previous']
78
+ end
79
+
80
+ if attributes.key?(:'results')
81
+ if (value = attributes[:'results']).is_a?(Array)
82
+ self.results = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ count == o.count &&
106
+ _next == o._next &&
107
+ previous == o.previous &&
108
+ results == o.results
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [count, _next, previous, results].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ PulpcoreClient.const_get(type).build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end
@@ -21,15 +21,11 @@ module PulpcoreClient
21
21
  # List of policy statements defining the policy.
22
22
  attr_accessor :statements
23
23
 
24
- # The name of ViewSet this AccessPolicy authorizes.
25
- attr_accessor :viewset_name
26
-
27
24
  # Attribute mapping from ruby-style variable name to JSON key.
28
25
  def self.attribute_map
29
26
  {
30
27
  :'permissions_assignment' => :'permissions_assignment',
31
- :'statements' => :'statements',
32
- :'viewset_name' => :'viewset_name'
28
+ :'statements' => :'statements'
33
29
  }
34
30
  end
35
31
 
@@ -37,8 +33,7 @@ module PulpcoreClient
37
33
  def self.openapi_types
38
34
  {
39
35
  :'permissions_assignment' => :'Array<Object>',
40
- :'statements' => :'Array<Object>',
41
- :'viewset_name' => :'String'
36
+ :'statements' => :'Array<Object>'
42
37
  }
43
38
  end
44
39
 
@@ -74,10 +69,6 @@ module PulpcoreClient
74
69
  self.statements = value
75
70
  end
76
71
  end
77
-
78
- if attributes.key?(:'viewset_name')
79
- self.viewset_name = attributes[:'viewset_name']
80
- end
81
72
  end
82
73
 
83
74
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -99,8 +90,7 @@ module PulpcoreClient
99
90
  return true if self.equal?(o)
100
91
  self.class == o.class &&
101
92
  permissions_assignment == o.permissions_assignment &&
102
- statements == o.statements &&
103
- viewset_name == o.viewset_name
93
+ statements == o.statements
104
94
  end
105
95
 
106
96
  # @see the `==` method
@@ -112,7 +102,7 @@ module PulpcoreClient
112
102
  # Calculates hash code according to all attributes.
113
103
  # @return [Integer] Hash code
114
104
  def hash
115
- [permissions_assignment, statements, viewset_name].hash
105
+ [permissions_assignment, statements].hash
116
106
  end
117
107
 
118
108
  # Builds the object from hash
@@ -38,7 +38,7 @@ module PulpcoreClient
38
38
  def self.openapi_types
39
39
  {
40
40
  :'pulp_href' => :'String',
41
- :'id' => :'String',
41
+ :'id' => :'Integer',
42
42
  :'permission' => :'String',
43
43
  :'obj' => :'String'
44
44
  }
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
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
+ # Check validity of provided import-options. Provides the ability to check that an import is 'sane' without having to actually create an importer.
17
+ class PulpImportCheck
18
+ # Path to export-tar-gz that will be imported.
19
+ attr_accessor :path
20
+
21
+ # Path to a table-of-contents file describing chunks to be validated, reassembled, and imported.
22
+ attr_accessor :toc
23
+
24
+ # Mapping of repo names in an export file to the repo names in Pulp. For example, if the export has a repo named 'foo' and the repo to import content into was 'bar', the mapping would be \"{'foo': 'bar'}\".
25
+ attr_accessor :repo_mapping
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'path' => :'path',
31
+ :'toc' => :'toc',
32
+ :'repo_mapping' => :'repo_mapping'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'path' => :'String',
40
+ :'toc' => :'String',
41
+ :'repo_mapping' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PulpImportCheck` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PulpImportCheck`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'path')
67
+ self.path = attributes[:'path']
68
+ end
69
+
70
+ if attributes.key?(:'toc')
71
+ self.toc = attributes[:'toc']
72
+ end
73
+
74
+ if attributes.key?(:'repo_mapping')
75
+ self.repo_mapping = attributes[:'repo_mapping']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ path == o.path &&
98
+ toc == o.toc &&
99
+ repo_mapping == o.repo_mapping
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [path, toc, repo_mapping].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if 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[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
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 _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.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
+ PulpcoreClient.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end