pulp_python_client 3.0.0b10 → 3.0.0b11.dev01596663644

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

Potentially problematic release.


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

Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -33
  3. data/docs/ContentPackagesApi.md +54 -54
  4. data/docs/ContentSummary.md +3 -3
  5. data/docs/ContentSummaryResponse.md +21 -0
  6. data/docs/DistributionsPypiApi.md +110 -62
  7. data/docs/InlineResponse200.md +3 -3
  8. data/docs/InlineResponse2001.md +3 -3
  9. data/docs/InlineResponse2002.md +3 -3
  10. data/docs/InlineResponse2003.md +3 -3
  11. data/docs/InlineResponse2004.md +3 -3
  12. data/docs/InlineResponse2005.md +3 -3
  13. data/docs/PatchedpythonPythonDistribution.md +23 -0
  14. data/docs/PatchedpythonPythonRemote.md +43 -0
  15. data/docs/PatchedpythonPythonRepository.md +21 -0
  16. data/docs/PolicyEnum.md +16 -0
  17. data/docs/PublicationsPypiApi.md +43 -43
  18. data/docs/PythonBanderRemote.md +19 -0
  19. data/docs/PythonPythonDistribution.md +1 -7
  20. data/docs/PythonPythonDistributionResponse.md +29 -0
  21. data/docs/PythonPythonPackageContent.md +7 -15
  22. data/docs/PythonPythonPackageContentResponse.md +69 -0
  23. data/docs/PythonPythonPublication.md +2 -8
  24. data/docs/PythonPythonPublicationResponse.md +25 -0
  25. data/docs/PythonPythonRemote.md +4 -10
  26. data/docs/PythonPythonRemoteResponse.md +49 -0
  27. data/docs/PythonPythonRepository.md +4 -10
  28. data/docs/PythonPythonRepositoryResponse.md +29 -0
  29. data/docs/RemotesPythonApi.md +132 -72
  30. data/docs/RepositoriesPythonApi.md +97 -73
  31. data/docs/RepositoriesPythonVersionsApi.md +94 -62
  32. data/docs/RepositoryAddRemoveContent.md +2 -2
  33. data/docs/RepositorySyncURL.md +1 -1
  34. data/docs/RepositoryVersion.md +1 -9
  35. data/docs/RepositoryVersionResponse.md +25 -0
  36. data/lib/pulp_python_client.rb +14 -2
  37. data/lib/pulp_python_client/api/content_packages_api.rb +74 -74
  38. data/lib/pulp_python_client/api/distributions_pypi_api.rb +157 -94
  39. data/lib/pulp_python_client/api/publications_pypi_api.rb +65 -65
  40. data/lib/pulp_python_client/api/remotes_python_api.rb +191 -114
  41. data/lib/pulp_python_client/api/repositories_python_api.rb +145 -118
  42. data/lib/pulp_python_client/api/repositories_python_versions_api.rb +137 -92
  43. data/lib/pulp_python_client/api_client.rb +2 -2
  44. data/lib/pulp_python_client/api_error.rb +2 -2
  45. data/lib/pulp_python_client/configuration.rb +3 -3
  46. data/lib/pulp_python_client/models/async_operation_response.rb +3 -2
  47. data/lib/pulp_python_client/models/content_summary.rb +9 -15
  48. data/lib/pulp_python_client/models/content_summary_response.rb +240 -0
  49. data/lib/pulp_python_client/models/inline_response200.rb +3 -13
  50. data/lib/pulp_python_client/models/inline_response2001.rb +3 -13
  51. data/lib/pulp_python_client/models/inline_response2002.rb +3 -13
  52. data/lib/pulp_python_client/models/inline_response2003.rb +3 -13
  53. data/lib/pulp_python_client/models/inline_response2004.rb +3 -13
  54. data/lib/pulp_python_client/models/inline_response2005.rb +3 -13
  55. data/lib/pulp_python_client/models/patchedpython_python_distribution.rb +240 -0
  56. data/lib/pulp_python_client/models/patchedpython_python_remote.rb +359 -0
  57. data/lib/pulp_python_client/models/patchedpython_python_repository.rb +229 -0
  58. data/lib/pulp_python_client/models/policy_enum.rb +37 -0
  59. data/lib/pulp_python_client/models/python_bander_remote.rb +228 -0
  60. data/lib/pulp_python_client/models/python_python_distribution.rb +4 -85
  61. data/lib/pulp_python_client/models/python_python_distribution_response.rb +279 -0
  62. data/lib/pulp_python_client/models/python_python_package_content.rb +28 -136
  63. data/lib/pulp_python_client/models/python_python_package_content_response.rb +467 -0
  64. data/lib/pulp_python_client/models/python_python_publication.rb +7 -37
  65. data/lib/pulp_python_client/models/python_python_publication_response.rb +248 -0
  66. data/lib/pulp_python_client/models/python_python_remote.rb +7 -199
  67. data/lib/pulp_python_client/models/python_python_remote_response.rb +398 -0
  68. data/lib/pulp_python_client/models/python_python_repository.rb +18 -78
  69. data/lib/pulp_python_client/models/python_python_repository_response.rb +271 -0
  70. data/lib/pulp_python_client/models/repository_add_remove_content.rb +5 -4
  71. data/lib/pulp_python_client/models/repository_sync_url.rb +3 -8
  72. data/lib/pulp_python_client/models/repository_version.rb +7 -43
  73. data/lib/pulp_python_client/models/repository_version_response.rb +246 -0
  74. data/lib/pulp_python_client/version.rb +3 -3
  75. data/pulp_python_client.gemspec +4 -4
  76. data/spec/api/content_packages_api_spec.rb +26 -26
  77. data/spec/api/distributions_pypi_api_spec.rb +41 -20
  78. data/spec/api/publications_pypi_api_spec.rb +17 -17
  79. data/spec/api/remotes_python_api_spec.rb +52 -25
  80. data/spec/api/repositories_python_api_spec.rb +28 -19
  81. data/spec/api/repositories_python_versions_api_spec.rb +38 -23
  82. data/spec/api_client_spec.rb +2 -2
  83. data/spec/configuration_spec.rb +2 -2
  84. data/spec/models/async_operation_response_spec.rb +2 -2
  85. data/spec/models/content_summary_response_spec.rb +53 -0
  86. data/spec/models/content_summary_spec.rb +2 -2
  87. data/spec/models/inline_response2001_spec.rb +2 -2
  88. data/spec/models/inline_response2002_spec.rb +2 -2
  89. data/spec/models/inline_response2003_spec.rb +2 -2
  90. data/spec/models/inline_response2004_spec.rb +2 -2
  91. data/spec/models/inline_response2005_spec.rb +2 -2
  92. data/spec/models/inline_response200_spec.rb +2 -2
  93. data/spec/models/patchedpython_python_distribution_spec.rb +59 -0
  94. data/spec/models/patchedpython_python_remote_spec.rb +119 -0
  95. data/spec/models/patchedpython_python_repository_spec.rb +53 -0
  96. data/spec/models/policy_enum_spec.rb +35 -0
  97. data/spec/models/python_bander_remote_spec.rb +47 -0
  98. data/spec/models/python_python_distribution_response_spec.rb +77 -0
  99. data/spec/models/python_python_distribution_spec.rb +2 -20
  100. data/spec/models/python_python_package_content_response_spec.rb +197 -0
  101. data/spec/models/python_python_package_content_spec.rb +5 -29
  102. data/spec/models/python_python_publication_response_spec.rb +65 -0
  103. data/spec/models/python_python_publication_spec.rb +2 -20
  104. data/spec/models/python_python_remote_response_spec.rb +137 -0
  105. data/spec/models/python_python_remote_spec.rb +2 -24
  106. data/spec/models/python_python_repository_response_spec.rb +77 -0
  107. data/spec/models/python_python_repository_spec.rb +5 -23
  108. data/spec/models/repository_add_remove_content_spec.rb +2 -2
  109. data/spec/models/repository_sync_url_spec.rb +2 -2
  110. data/spec/models/repository_version_response_spec.rb +65 -0
  111. data/spec/models/repository_version_spec.rb +2 -26
  112. data/spec/spec_helper.rb +2 -2
  113. metadata +51 -3
@@ -0,0 +1,229 @@
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 PulpPythonClient
16
+ # Serializer for Python Repositories.
17
+ class PatchedpythonPythonRepository
18
+ # A unique name for this repository.
19
+ attr_accessor :name
20
+
21
+ # An optional description.
22
+ attr_accessor :description
23
+
24
+ attr_accessor :remote
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'name' => :'name',
30
+ :'description' => :'description',
31
+ :'remote' => :'remote'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'name' => :'String',
39
+ :'description' => :'String',
40
+ :'remote' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ :'description',
48
+ :'remote'
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PatchedpythonPythonRepository` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::PatchedpythonPythonRepository`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'name')
68
+ self.name = attributes[:'name']
69
+ end
70
+
71
+ if attributes.key?(:'description')
72
+ self.description = attributes[:'description']
73
+ end
74
+
75
+ if attributes.key?(:'remote')
76
+ self.remote = attributes[:'remote']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ name == o.name &&
99
+ description == o.description &&
100
+ remote == o.remote
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [name, description, remote].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ new.build_from_hash(attributes)
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.openapi_types.each_pair do |key, type|
128
+ if 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[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ DateTime.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ PulpPythonClient.const_get(type).build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+ end
229
+ end
@@ -0,0 +1,37 @@
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 PulpPythonClient
16
+ class PolicyEnum
17
+ IMMEDIATE = "immediate".freeze
18
+ ON_DEMAND = "on_demand".freeze
19
+ STREAMED = "streamed".freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = PolicyEnum.constants.select { |c| PolicyEnum::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #PolicyEnum" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end
@@ -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 PulpPythonClient
16
+ # A Serializer for the initial step of creating a Python Remote from a Bandersnatch config file
17
+ class PythonBanderRemote
18
+ # A Bandersnatch config that may be used to construct a Python Remote.
19
+ attr_accessor :config
20
+
21
+ # A unique name for this remote
22
+ attr_accessor :name
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'config' => :'config',
28
+ :'name' => :'name'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'config' => :'File',
36
+ :'name' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PythonBanderRemote` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::PythonBanderRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'config')
62
+ self.config = attributes[:'config']
63
+ end
64
+
65
+ if attributes.key?(:'name')
66
+ self.name = attributes[:'name']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @config.nil?
75
+ invalid_properties.push('invalid value for "config", config cannot be nil.')
76
+ end
77
+
78
+ if @name.nil?
79
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @config.nil?
89
+ return false if @name.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ config == o.config &&
99
+ name == o.name
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
+ [config, name].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
+ PulpPythonClient.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