zest 0.0.1 → 0.0.2

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 +4 -4
  2. data/README.md +4 -4
  3. data/lib/zest/version.rb +1 -1
  4. data/spec/api/pulp_api_spec.rb +3 -3
  5. data/spec/api_client_spec.rb +29 -29
  6. data/spec/configuration_spec.rb +3 -3
  7. data/spec/models/artifact_spec.rb +3 -3
  8. data/spec/models/async_operation_response_spec.rb +3 -3
  9. data/spec/models/distribution_spec.rb +3 -3
  10. data/spec/models/file_content_spec.rb +3 -3
  11. data/spec/models/file_publisher_spec.rb +3 -3
  12. data/spec/models/file_remote_spec.rb +3 -3
  13. data/spec/models/inline_response_200_10_spec.rb +3 -3
  14. data/spec/models/inline_response_200_1_spec.rb +3 -3
  15. data/spec/models/inline_response_200_2_spec.rb +3 -3
  16. data/spec/models/inline_response_200_3_spec.rb +3 -3
  17. data/spec/models/inline_response_200_4_spec.rb +3 -3
  18. data/spec/models/inline_response_200_5_spec.rb +3 -3
  19. data/spec/models/inline_response_200_6_spec.rb +3 -3
  20. data/spec/models/inline_response_200_7_spec.rb +3 -3
  21. data/spec/models/inline_response_200_8_spec.rb +3 -3
  22. data/spec/models/inline_response_200_9_spec.rb +3 -3
  23. data/spec/models/inline_response_200_spec.rb +3 -3
  24. data/spec/models/progress_report_spec.rb +3 -3
  25. data/spec/models/publication_spec.rb +3 -3
  26. data/spec/models/repository_publish_url_spec.rb +3 -3
  27. data/spec/models/repository_spec.rb +3 -3
  28. data/spec/models/repository_sync_url_spec.rb +3 -3
  29. data/spec/models/repository_version_create_spec.rb +3 -3
  30. data/spec/models/repository_version_spec.rb +3 -3
  31. data/spec/models/task_spec.rb +3 -3
  32. data/spec/models/user_spec.rb +3 -3
  33. data/spec/models/worker_spec.rb +3 -3
  34. data/spec/spec_helper.rb +1 -1
  35. data/zest.gemspec +3 -4
  36. metadata +6 -44
  37. data/api.json +0 -1
  38. data/config.json +0 -6
  39. data/katello_pulp_api-0.0.1.gem +0 -0
  40. data/katello_pulp_api.gemspec +0 -46
  41. data/lib/katello_pulp_api.rb +0 -67
  42. data/lib/katello_pulp_api/api/pulp_api.rb +0 -3277
  43. data/lib/katello_pulp_api/api_client.rb +0 -389
  44. data/lib/katello_pulp_api/api_error.rb +0 -38
  45. data/lib/katello_pulp_api/configuration.rb +0 -209
  46. data/lib/katello_pulp_api/models/artifact.rb +0 -278
  47. data/lib/katello_pulp_api/models/async_operation_response.rb +0 -194
  48. data/lib/katello_pulp_api/models/distribution.rb +0 -350
  49. data/lib/katello_pulp_api/models/file_content.rb +0 -272
  50. data/lib/katello_pulp_api/models/file_publisher.rb +0 -306
  51. data/lib/katello_pulp_api/models/file_remote.rb +0 -452
  52. data/lib/katello_pulp_api/models/inline_response_200.rb +0 -227
  53. data/lib/katello_pulp_api/models/inline_response_200_1.rb +0 -227
  54. data/lib/katello_pulp_api/models/inline_response_200_10.rb +0 -227
  55. data/lib/katello_pulp_api/models/inline_response_200_2.rb +0 -227
  56. data/lib/katello_pulp_api/models/inline_response_200_3.rb +0 -227
  57. data/lib/katello_pulp_api/models/inline_response_200_4.rb +0 -227
  58. data/lib/katello_pulp_api/models/inline_response_200_5.rb +0 -227
  59. data/lib/katello_pulp_api/models/inline_response_200_6.rb +0 -227
  60. data/lib/katello_pulp_api/models/inline_response_200_7.rb +0 -227
  61. data/lib/katello_pulp_api/models/inline_response_200_8.rb +0 -227
  62. data/lib/katello_pulp_api/models/inline_response_200_9.rb +0 -227
  63. data/lib/katello_pulp_api/models/progress_report.rb +0 -271
  64. data/lib/katello_pulp_api/models/publication.rb +0 -249
  65. data/lib/katello_pulp_api/models/repository.rb +0 -260
  66. data/lib/katello_pulp_api/models/repository_publish_url.rb +0 -199
  67. data/lib/katello_pulp_api/models/repository_sync_url.rb +0 -206
  68. data/lib/katello_pulp_api/models/repository_version.rb +0 -277
  69. data/lib/katello_pulp_api/models/repository_version_create.rb +0 -223
  70. data/lib/katello_pulp_api/models/task.rb +0 -363
  71. data/lib/katello_pulp_api/models/user.rb +0 -284
  72. data/lib/katello_pulp_api/models/worker.rb +0 -254
  73. data/lib/katello_pulp_api/version.rb +0 -15
@@ -1,350 +0,0 @@
1
- =begin
2
- #Pulp3 API
3
-
4
- #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
-
6
- OpenAPI spec version: v3
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module KatelloPulpApi
16
-
17
- class Distribution
18
- attr_accessor :_href
19
-
20
- # Timestamp of creation.
21
- attr_accessor :_created
22
-
23
- # A unique distribution name. Ex, `rawhide` and `stable`.
24
- attr_accessor :name
25
-
26
- # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
27
- attr_accessor :base_path
28
-
29
- # Publications created by this publisher and repository are automaticallyserved as defined by this distribution
30
- attr_accessor :publisher
31
-
32
- # The publication being served as defined by this distribution
33
- attr_accessor :publication
34
-
35
- # The URL for accessing the publication as defined by this distribution.
36
- attr_accessor :base_url
37
-
38
- # Publications created by this repository and publisher are automaticallyserved as defined by this distribution
39
- attr_accessor :repository
40
-
41
- # An optional content-guard.
42
- attr_accessor :content_guard
43
-
44
-
45
- # Attribute mapping from ruby-style variable name to JSON key.
46
- def self.attribute_map
47
- {
48
- :'_href' => :'_href',
49
- :'_created' => :'_created',
50
- :'name' => :'name',
51
- :'base_path' => :'base_path',
52
- :'publisher' => :'publisher',
53
- :'publication' => :'publication',
54
- :'base_url' => :'base_url',
55
- :'repository' => :'repository',
56
- :'content_guard' => :'content_guard'
57
- }
58
- end
59
-
60
- # Attribute type mapping.
61
- def self.swagger_types
62
- {
63
- :'_href' => :'String',
64
- :'_created' => :'DateTime',
65
- :'name' => :'String',
66
- :'base_path' => :'String',
67
- :'publisher' => :'String',
68
- :'publication' => :'String',
69
- :'base_url' => :'String',
70
- :'repository' => :'String',
71
- :'content_guard' => :'String'
72
- }
73
- end
74
-
75
- # Initializes the object
76
- # @param [Hash] attributes Model attributes in the form of hash
77
- def initialize(attributes = {})
78
- return unless attributes.is_a?(Hash)
79
-
80
- # convert string to symbol for hash key
81
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
82
-
83
- if attributes.has_key?(:'_href')
84
- self._href = attributes[:'_href']
85
- end
86
-
87
- if attributes.has_key?(:'_created')
88
- self._created = attributes[:'_created']
89
- end
90
-
91
- if attributes.has_key?(:'name')
92
- self.name = attributes[:'name']
93
- end
94
-
95
- if attributes.has_key?(:'base_path')
96
- self.base_path = attributes[:'base_path']
97
- end
98
-
99
- if attributes.has_key?(:'publisher')
100
- self.publisher = attributes[:'publisher']
101
- end
102
-
103
- if attributes.has_key?(:'publication')
104
- self.publication = attributes[:'publication']
105
- end
106
-
107
- if attributes.has_key?(:'base_url')
108
- self.base_url = attributes[:'base_url']
109
- end
110
-
111
- if attributes.has_key?(:'repository')
112
- self.repository = attributes[:'repository']
113
- end
114
-
115
- if attributes.has_key?(:'content_guard')
116
- self.content_guard = attributes[:'content_guard']
117
- end
118
-
119
- end
120
-
121
- # Show invalid properties with the reasons. Usually used together with valid?
122
- # @return Array for valid properties with the reasons
123
- def list_invalid_properties
124
- invalid_properties = Array.new
125
- if @name.nil?
126
- invalid_properties.push("invalid value for 'name', name cannot be nil.")
127
- end
128
-
129
- if @name.to_s.length > 255
130
- invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 255.")
131
- end
132
-
133
- if @name.to_s.length < 1
134
- invalid_properties.push("invalid value for 'name', the character length must be great than or equal to 1.")
135
- end
136
-
137
- if @base_path.nil?
138
- invalid_properties.push("invalid value for 'base_path', base_path cannot be nil.")
139
- end
140
-
141
- if @base_path.to_s.length > 255
142
- invalid_properties.push("invalid value for 'base_path', the character length must be smaller than or equal to 255.")
143
- end
144
-
145
- if @base_path.to_s.length < 1
146
- invalid_properties.push("invalid value for 'base_path', the character length must be great than or equal to 1.")
147
- end
148
-
149
- if !@base_url.nil? && @base_url.to_s.length < 1
150
- invalid_properties.push("invalid value for 'base_url', the character length must be great than or equal to 1.")
151
- end
152
-
153
- return invalid_properties
154
- end
155
-
156
- # Check to see if the all the properties in the model are valid
157
- # @return true if the model is valid
158
- def valid?
159
- return false if @name.nil?
160
- return false if @name.to_s.length > 255
161
- return false if @name.to_s.length < 1
162
- return false if @base_path.nil?
163
- return false if @base_path.to_s.length > 255
164
- return false if @base_path.to_s.length < 1
165
- return false if !@base_url.nil? && @base_url.to_s.length < 1
166
- return true
167
- end
168
-
169
- # Custom attribute writer method with validation
170
- # @param [Object] name Value to be assigned
171
- def name=(name)
172
- if name.nil?
173
- fail ArgumentError, "name cannot be nil"
174
- end
175
-
176
- if name.to_s.length > 255
177
- fail ArgumentError, "invalid value for 'name', the character length must be smaller than or equal to 255."
178
- end
179
-
180
- if name.to_s.length < 1
181
- fail ArgumentError, "invalid value for 'name', the character length must be great than or equal to 1."
182
- end
183
-
184
- @name = name
185
- end
186
-
187
- # Custom attribute writer method with validation
188
- # @param [Object] base_path Value to be assigned
189
- def base_path=(base_path)
190
- if base_path.nil?
191
- fail ArgumentError, "base_path cannot be nil"
192
- end
193
-
194
- if base_path.to_s.length > 255
195
- fail ArgumentError, "invalid value for 'base_path', the character length must be smaller than or equal to 255."
196
- end
197
-
198
- if base_path.to_s.length < 1
199
- fail ArgumentError, "invalid value for 'base_path', the character length must be great than or equal to 1."
200
- end
201
-
202
- @base_path = base_path
203
- end
204
-
205
- # Custom attribute writer method with validation
206
- # @param [Object] base_url Value to be assigned
207
- def base_url=(base_url)
208
-
209
- if !base_url.nil? && base_url.to_s.length < 1
210
- fail ArgumentError, "invalid value for 'base_url', the character length must be great than or equal to 1."
211
- end
212
-
213
- @base_url = base_url
214
- end
215
-
216
- # Checks equality by comparing each attribute.
217
- # @param [Object] Object to be compared
218
- def ==(o)
219
- return true if self.equal?(o)
220
- self.class == o.class &&
221
- _href == o._href &&
222
- _created == o._created &&
223
- name == o.name &&
224
- base_path == o.base_path &&
225
- publisher == o.publisher &&
226
- publication == o.publication &&
227
- base_url == o.base_url &&
228
- repository == o.repository &&
229
- content_guard == o.content_guard
230
- end
231
-
232
- # @see the `==` method
233
- # @param [Object] Object to be compared
234
- def eql?(o)
235
- self == o
236
- end
237
-
238
- # Calculates hash code according to all attributes.
239
- # @return [Fixnum] Hash code
240
- def hash
241
- [_href, _created, name, base_path, publisher, publication, base_url, repository, content_guard].hash
242
- end
243
-
244
- # Builds the object from hash
245
- # @param [Hash] attributes Model attributes in the form of hash
246
- # @return [Object] Returns the model itself
247
- def build_from_hash(attributes)
248
- return nil unless attributes.is_a?(Hash)
249
- self.class.swagger_types.each_pair do |key, type|
250
- if type =~ /\AArray<(.*)>/i
251
- # check to ensure the input is an array given that the the attribute
252
- # is documented as an array but the input is not
253
- if attributes[self.class.attribute_map[key]].is_a?(Array)
254
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
255
- end
256
- elsif !attributes[self.class.attribute_map[key]].nil?
257
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
258
- end # or else data not found in attributes(hash), not an issue as the data can be optional
259
- end
260
-
261
- self
262
- end
263
-
264
- # Deserializes the data based on type
265
- # @param string type Data type
266
- # @param string value Value to be deserialized
267
- # @return [Object] Deserialized data
268
- def _deserialize(type, value)
269
- case type.to_sym
270
- when :DateTime
271
- DateTime.parse(value)
272
- when :Date
273
- Date.parse(value)
274
- when :String
275
- value.to_s
276
- when :Integer
277
- value.to_i
278
- when :Float
279
- value.to_f
280
- when :BOOLEAN
281
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
282
- true
283
- else
284
- false
285
- end
286
- when :Object
287
- # generic object (usually a Hash), return directly
288
- value
289
- when /\AArray<(?<inner_type>.+)>\z/
290
- inner_type = Regexp.last_match[:inner_type]
291
- value.map { |v| _deserialize(inner_type, v) }
292
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
293
- k_type = Regexp.last_match[:k_type]
294
- v_type = Regexp.last_match[:v_type]
295
- {}.tap do |hash|
296
- value.each do |k, v|
297
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
298
- end
299
- end
300
- else # model
301
- temp_model = KatelloPulpApi.const_get(type).new
302
- temp_model.build_from_hash(value)
303
- end
304
- end
305
-
306
- # Returns the string representation of the object
307
- # @return [String] String presentation of the object
308
- def to_s
309
- to_hash.to_s
310
- end
311
-
312
- # to_body is an alias to to_hash (backward compatibility)
313
- # @return [Hash] Returns the object in the form of hash
314
- def to_body
315
- to_hash
316
- end
317
-
318
- # Returns the object in the form of hash
319
- # @return [Hash] Returns the object in the form of hash
320
- def to_hash
321
- hash = {}
322
- self.class.attribute_map.each_pair do |attr, param|
323
- value = self.send(attr)
324
- next if value.nil?
325
- hash[param] = _to_hash(value)
326
- end
327
- hash
328
- end
329
-
330
- # Outputs non-array value in the form of hash
331
- # For object, use to_hash. Otherwise, just return the value
332
- # @param [Object] value Any valid value
333
- # @return [Hash] Returns the value in the form of hash
334
- def _to_hash(value)
335
- if value.is_a?(Array)
336
- value.compact.map{ |v| _to_hash(v) }
337
- elsif value.is_a?(Hash)
338
- {}.tap do |hash|
339
- value.each { |k, v| hash[k] = _to_hash(v) }
340
- end
341
- elsif value.respond_to? :to_hash
342
- value.to_hash
343
- else
344
- value
345
- end
346
- end
347
-
348
- end
349
-
350
- end
@@ -1,272 +0,0 @@
1
- =begin
2
- #Pulp3 API
3
-
4
- #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
-
6
- OpenAPI spec version: v3
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module KatelloPulpApi
16
-
17
- class FileContent
18
- attr_accessor :_href
19
-
20
- # Timestamp of creation.
21
- attr_accessor :_created
22
-
23
- attr_accessor :_type
24
-
25
- # Artifact file representing the physical content
26
- attr_accessor :_artifact
27
-
28
- # Relative location of the file within the repository
29
- attr_accessor :relative_path
30
-
31
-
32
- # Attribute mapping from ruby-style variable name to JSON key.
33
- def self.attribute_map
34
- {
35
- :'_href' => :'_href',
36
- :'_created' => :'_created',
37
- :'_type' => :'_type',
38
- :'_artifact' => :'_artifact',
39
- :'relative_path' => :'relative_path'
40
- }
41
- end
42
-
43
- # Attribute type mapping.
44
- def self.swagger_types
45
- {
46
- :'_href' => :'String',
47
- :'_created' => :'DateTime',
48
- :'_type' => :'String',
49
- :'_artifact' => :'String',
50
- :'relative_path' => :'String'
51
- }
52
- end
53
-
54
- # Initializes the object
55
- # @param [Hash] attributes Model attributes in the form of hash
56
- def initialize(attributes = {})
57
- return unless attributes.is_a?(Hash)
58
-
59
- # convert string to symbol for hash key
60
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
61
-
62
- if attributes.has_key?(:'_href')
63
- self._href = attributes[:'_href']
64
- end
65
-
66
- if attributes.has_key?(:'_created')
67
- self._created = attributes[:'_created']
68
- end
69
-
70
- if attributes.has_key?(:'_type')
71
- self._type = attributes[:'_type']
72
- end
73
-
74
- if attributes.has_key?(:'_artifact')
75
- self._artifact = attributes[:'_artifact']
76
- end
77
-
78
- if attributes.has_key?(:'relative_path')
79
- self.relative_path = attributes[:'relative_path']
80
- end
81
-
82
- end
83
-
84
- # Show invalid properties with the reasons. Usually used together with valid?
85
- # @return Array for valid properties with the reasons
86
- def list_invalid_properties
87
- invalid_properties = Array.new
88
- if !@_type.nil? && @_type.to_s.length < 1
89
- invalid_properties.push("invalid value for '_type', the character length must be great than or equal to 1.")
90
- end
91
-
92
- if @_artifact.nil?
93
- invalid_properties.push("invalid value for '_artifact', _artifact cannot be nil.")
94
- end
95
-
96
- if @relative_path.nil?
97
- invalid_properties.push("invalid value for 'relative_path', relative_path cannot be nil.")
98
- end
99
-
100
- if @relative_path.to_s.length < 1
101
- invalid_properties.push("invalid value for 'relative_path', the character length must be great than or equal to 1.")
102
- end
103
-
104
- return invalid_properties
105
- end
106
-
107
- # Check to see if the all the properties in the model are valid
108
- # @return true if the model is valid
109
- def valid?
110
- return false if !@_type.nil? && @_type.to_s.length < 1
111
- return false if @_artifact.nil?
112
- return false if @relative_path.nil?
113
- return false if @relative_path.to_s.length < 1
114
- return true
115
- end
116
-
117
- # Custom attribute writer method with validation
118
- # @param [Object] _type Value to be assigned
119
- def _type=(_type)
120
-
121
- if !_type.nil? && _type.to_s.length < 1
122
- fail ArgumentError, "invalid value for '_type', the character length must be great than or equal to 1."
123
- end
124
-
125
- @_type = _type
126
- end
127
-
128
- # Custom attribute writer method with validation
129
- # @param [Object] relative_path Value to be assigned
130
- def relative_path=(relative_path)
131
- if relative_path.nil?
132
- fail ArgumentError, "relative_path cannot be nil"
133
- end
134
-
135
- if relative_path.to_s.length < 1
136
- fail ArgumentError, "invalid value for 'relative_path', the character length must be great than or equal to 1."
137
- end
138
-
139
- @relative_path = relative_path
140
- end
141
-
142
- # Checks equality by comparing each attribute.
143
- # @param [Object] Object to be compared
144
- def ==(o)
145
- return true if self.equal?(o)
146
- self.class == o.class &&
147
- _href == o._href &&
148
- _created == o._created &&
149
- _type == o._type &&
150
- _artifact == o._artifact &&
151
- relative_path == o.relative_path
152
- end
153
-
154
- # @see the `==` method
155
- # @param [Object] Object to be compared
156
- def eql?(o)
157
- self == o
158
- end
159
-
160
- # Calculates hash code according to all attributes.
161
- # @return [Fixnum] Hash code
162
- def hash
163
- [_href, _created, _type, _artifact, relative_path].hash
164
- end
165
-
166
- # Builds the object from hash
167
- # @param [Hash] attributes Model attributes in the form of hash
168
- # @return [Object] Returns the model itself
169
- def build_from_hash(attributes)
170
- return nil unless attributes.is_a?(Hash)
171
- self.class.swagger_types.each_pair do |key, type|
172
- if type =~ /\AArray<(.*)>/i
173
- # check to ensure the input is an array given that the the attribute
174
- # is documented as an array but the input is not
175
- if attributes[self.class.attribute_map[key]].is_a?(Array)
176
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
177
- end
178
- elsif !attributes[self.class.attribute_map[key]].nil?
179
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
- end # or else data not found in attributes(hash), not an issue as the data can be optional
181
- end
182
-
183
- self
184
- end
185
-
186
- # Deserializes the data based on type
187
- # @param string type Data type
188
- # @param string value Value to be deserialized
189
- # @return [Object] Deserialized data
190
- def _deserialize(type, value)
191
- case type.to_sym
192
- when :DateTime
193
- DateTime.parse(value)
194
- when :Date
195
- Date.parse(value)
196
- when :String
197
- value.to_s
198
- when :Integer
199
- value.to_i
200
- when :Float
201
- value.to_f
202
- when :BOOLEAN
203
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
- true
205
- else
206
- false
207
- end
208
- when :Object
209
- # generic object (usually a Hash), return directly
210
- value
211
- when /\AArray<(?<inner_type>.+)>\z/
212
- inner_type = Regexp.last_match[:inner_type]
213
- value.map { |v| _deserialize(inner_type, v) }
214
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
- k_type = Regexp.last_match[:k_type]
216
- v_type = Regexp.last_match[:v_type]
217
- {}.tap do |hash|
218
- value.each do |k, v|
219
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
- end
221
- end
222
- else # model
223
- temp_model = KatelloPulpApi.const_get(type).new
224
- temp_model.build_from_hash(value)
225
- end
226
- end
227
-
228
- # Returns the string representation of the object
229
- # @return [String] String presentation of the object
230
- def to_s
231
- to_hash.to_s
232
- end
233
-
234
- # to_body is an alias to to_hash (backward compatibility)
235
- # @return [Hash] Returns the object in the form of hash
236
- def to_body
237
- to_hash
238
- end
239
-
240
- # Returns the object in the form of hash
241
- # @return [Hash] Returns the object in the form of hash
242
- def to_hash
243
- hash = {}
244
- self.class.attribute_map.each_pair do |attr, param|
245
- value = self.send(attr)
246
- next if value.nil?
247
- hash[param] = _to_hash(value)
248
- end
249
- hash
250
- end
251
-
252
- # Outputs non-array value in the form of hash
253
- # For object, use to_hash. Otherwise, just return the value
254
- # @param [Object] value Any valid value
255
- # @return [Hash] Returns the value in the form of hash
256
- def _to_hash(value)
257
- if value.is_a?(Array)
258
- value.compact.map{ |v| _to_hash(v) }
259
- elsif value.is_a?(Hash)
260
- {}.tap do |hash|
261
- value.each { |k, v| hash[k] = _to_hash(v) }
262
- end
263
- elsif value.respond_to? :to_hash
264
- value.to_hash
265
- else
266
- value
267
- end
268
- end
269
-
270
- end
271
-
272
- end