ionoscloud-container-registry 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/LICENSE +201 -0
  5. data/README.md +54 -0
  6. data/Rakefile +10 -0
  7. data/docs/api/LocationsApi.md +78 -0
  8. data/docs/api/NamesApi.md +82 -0
  9. data/docs/api/RegistriesApi.md +470 -0
  10. data/docs/api/RepositoriesApi.md +84 -0
  11. data/docs/api/TokensApi.md +478 -0
  12. data/docs/models/ApiErrorMessage.md +20 -0
  13. data/docs/models/ApiErrorResponse.md +20 -0
  14. data/docs/models/ApiResourceMetadata.md +30 -0
  15. data/docs/models/Credentials.md +20 -0
  16. data/docs/models/Day.md +15 -0
  17. data/docs/models/Location.md +18 -0
  18. data/docs/models/LocationsResponse.md +24 -0
  19. data/docs/models/PaginationLinks.md +22 -0
  20. data/docs/models/PatchRegistryInput.md +18 -0
  21. data/docs/models/PatchTokenInput.md +22 -0
  22. data/docs/models/PostRegistryInput.md +18 -0
  23. data/docs/models/PostRegistryOutput.md +26 -0
  24. data/docs/models/PostRegistryProperties.md +22 -0
  25. data/docs/models/PostTokenInput.md +18 -0
  26. data/docs/models/PostTokenOutput.md +26 -0
  27. data/docs/models/PostTokenProperties.md +24 -0
  28. data/docs/models/PutRegistryInput.md +18 -0
  29. data/docs/models/PutRegistryOutput.md +26 -0
  30. data/docs/models/PutTokenInput.md +18 -0
  31. data/docs/models/PutTokenOutput.md +26 -0
  32. data/docs/models/RegistriesResponse.md +30 -0
  33. data/docs/models/RegistryProperties.md +26 -0
  34. data/docs/models/RegistryResponse.md +26 -0
  35. data/docs/models/Scope.md +22 -0
  36. data/docs/models/StorageUsage.md +20 -0
  37. data/docs/models/TokenProperties.md +26 -0
  38. data/docs/models/TokenResponse.md +26 -0
  39. data/docs/models/TokensResponse.md +34 -0
  40. data/docs/models/WeeklySchedule.md +20 -0
  41. data/docs/summary.md +44 -0
  42. data/git_push.sh +56 -0
  43. data/ionoscloud-container-registry.gemspec +38 -0
  44. data/lib/ionoscloud-container-registry/api/locations_api.rb +77 -0
  45. data/lib/ionoscloud-container-registry/api/names_api.rb +90 -0
  46. data/lib/ionoscloud-container-registry/api/registries_api.rb +439 -0
  47. data/lib/ionoscloud-container-registry/api/repositories_api.rb +99 -0
  48. data/lib/ionoscloud-container-registry/api/tokens_api.rb +500 -0
  49. data/lib/ionoscloud-container-registry/api_client.rb +471 -0
  50. data/lib/ionoscloud-container-registry/api_error.rb +57 -0
  51. data/lib/ionoscloud-container-registry/configuration.rb +276 -0
  52. data/lib/ionoscloud-container-registry/models/api_error_message.rb +237 -0
  53. data/lib/ionoscloud-container-registry/models/api_error_response.rb +233 -0
  54. data/lib/ionoscloud-container-registry/models/api_resource_metadata.rb +293 -0
  55. data/lib/ionoscloud-container-registry/models/credentials.rb +237 -0
  56. data/lib/ionoscloud-container-registry/models/day.rb +42 -0
  57. data/lib/ionoscloud-container-registry/models/location.rb +218 -0
  58. data/lib/ionoscloud-container-registry/models/locations_response.rb +246 -0
  59. data/lib/ionoscloud-container-registry/models/pagination_links.rb +251 -0
  60. data/lib/ionoscloud-container-registry/models/patch_registry_input.rb +219 -0
  61. data/lib/ionoscloud-container-registry/models/patch_token_input.rb +272 -0
  62. data/lib/ionoscloud-container-registry/models/post_registry_input.rb +223 -0
  63. data/lib/ionoscloud-container-registry/models/post_registry_output.rb +256 -0
  64. data/lib/ionoscloud-container-registry/models/post_registry_properties.rb +268 -0
  65. data/lib/ionoscloud-container-registry/models/post_token_input.rb +223 -0
  66. data/lib/ionoscloud-container-registry/models/post_token_output.rb +256 -0
  67. data/lib/ionoscloud-container-registry/models/post_token_properties.rb +316 -0
  68. data/lib/ionoscloud-container-registry/models/put_registry_input.rb +223 -0
  69. data/lib/ionoscloud-container-registry/models/put_registry_output.rb +256 -0
  70. data/lib/ionoscloud-container-registry/models/put_token_input.rb +223 -0
  71. data/lib/ionoscloud-container-registry/models/put_token_output.rb +256 -0
  72. data/lib/ionoscloud-container-registry/models/registries_response.rb +288 -0
  73. data/lib/ionoscloud-container-registry/models/registry_properties.rb +287 -0
  74. data/lib/ionoscloud-container-registry/models/registry_response.rb +256 -0
  75. data/lib/ionoscloud-container-registry/models/scope.rb +247 -0
  76. data/lib/ionoscloud-container-registry/models/storage_usage.rb +229 -0
  77. data/lib/ionoscloud-container-registry/models/token_properties.rb +326 -0
  78. data/lib/ionoscloud-container-registry/models/token_response.rb +256 -0
  79. data/lib/ionoscloud-container-registry/models/tokens_response.rb +316 -0
  80. data/lib/ionoscloud-container-registry/models/weekly_schedule.rb +234 -0
  81. data/lib/ionoscloud-container-registry/version.rb +15 -0
  82. data/lib/ionoscloud-container-registry.rb +73 -0
  83. data/spec/api_client_spec.rb +226 -0
  84. data/spec/configuration_spec.rb +42 -0
  85. data/spec/spec_helper.rb +111 -0
  86. metadata +173 -0
@@ -0,0 +1,287 @@
1
+ =begin
2
+ #Container Registry service
3
+
4
+ #Container Registry service enables IONOS clients to manage docker and OCI compliant registries for use by their managed Kubernetes clusters. Use a Container Registry to ensure you have a privately accessed registry to efficiently support image pulls.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@cloud.ionos.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IonoscloudContainerRegistry
17
+ class RegistryProperties
18
+ attr_accessor :garbage_collection_schedule
19
+
20
+ attr_accessor :hostname
21
+
22
+ attr_accessor :location
23
+
24
+ attr_accessor :name
25
+
26
+ attr_accessor :storage_usage
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'garbage_collection_schedule' => :'garbageCollectionSchedule',
32
+ :'hostname' => :'hostname',
33
+ :'location' => :'location',
34
+ :'name' => :'name',
35
+ :'storage_usage' => :'storageUsage'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'garbage_collection_schedule' => :'WeeklySchedule',
48
+ :'hostname' => :'String',
49
+ :'location' => :'String',
50
+ :'name' => :'String',
51
+ :'storage_usage' => :'StorageUsage'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'garbage_collection_schedule',
59
+ :'storage_usage'
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudContainerRegistry::RegistryProperties` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudContainerRegistry::RegistryProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'garbage_collection_schedule')
79
+ self.garbage_collection_schedule = attributes[:'garbage_collection_schedule']
80
+ end
81
+
82
+ if attributes.key?(:'hostname')
83
+ self.hostname = attributes[:'hostname']
84
+ end
85
+
86
+ if attributes.key?(:'location')
87
+ self.location = attributes[:'location']
88
+ end
89
+
90
+ if attributes.key?(:'name')
91
+ self.name = attributes[:'name']
92
+ end
93
+
94
+ if attributes.key?(:'storage_usage')
95
+ self.storage_usage = attributes[:'storage_usage']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @location.nil?
104
+ invalid_properties.push('invalid value for "location", location cannot be nil.')
105
+ end
106
+
107
+ if @name.nil?
108
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
109
+ end
110
+
111
+ pattern = Regexp.new(/^[a-z][-a-z0-9]{1,61}[a-z0-9]$/)
112
+ if @name !~ pattern
113
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
114
+ end
115
+
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ return false if @location.nil?
123
+ return false if @name.nil?
124
+ return false if @name !~ Regexp.new(/^[a-z][-a-z0-9]{1,61}[a-z0-9]$/)
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] name Value to be assigned
130
+ def name=(name)
131
+ if name.nil?
132
+ fail ArgumentError, 'name cannot be nil'
133
+ end
134
+
135
+ pattern = Regexp.new(/^[a-z][-a-z0-9]{1,61}[a-z0-9]$/)
136
+ if name !~ pattern
137
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
138
+ end
139
+
140
+ @name = name
141
+ end
142
+
143
+ # Checks equality by comparing each attribute.
144
+ # @param [Object] Object to be compared
145
+ def ==(o)
146
+ return true if self.equal?(o)
147
+ self.class == o.class &&
148
+ garbage_collection_schedule == o.garbage_collection_schedule &&
149
+ hostname == o.hostname &&
150
+ location == o.location &&
151
+ name == o.name &&
152
+ storage_usage == o.storage_usage
153
+ end
154
+
155
+ # @see the `==` method
156
+ # @param [Object] Object to be compared
157
+ def eql?(o)
158
+ self == o
159
+ end
160
+
161
+ # Calculates hash code according to all attributes.
162
+ # @return [Integer] Hash code
163
+ def hash
164
+ [garbage_collection_schedule, hostname, location, name, storage_usage].hash
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def self.build_from_hash(attributes)
171
+ new.build_from_hash(attributes)
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def build_from_hash(attributes)
178
+ return nil unless attributes.is_a?(Hash)
179
+ self.class.openapi_types.each_pair do |key, type|
180
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
181
+ self.send("#{key}=", nil)
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
186
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
187
+ end
188
+ elsif !attributes[self.class.attribute_map[key]].nil?
189
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
190
+ end
191
+ end
192
+
193
+ self
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def _deserialize(type, value)
201
+ case type.to_sym
202
+ when :Time
203
+ Time.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ # models (e.g. Pet) or oneOf
234
+ klass = IonoscloudContainerRegistry.const_get(type)
235
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map { |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+
285
+ end
286
+
287
+ end
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #Container Registry service
3
+
4
+ #Container Registry service enables IONOS clients to manage docker and OCI compliant registries for use by their managed Kubernetes clusters. Use a Container Registry to ensure you have a privately accessed registry to efficiently support image pulls.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@cloud.ionos.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IonoscloudContainerRegistry
17
+ class RegistryResponse
18
+ attr_accessor :href
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :metadata
23
+
24
+ attr_accessor :properties
25
+
26
+ attr_accessor :type
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'href' => :'href',
32
+ :'id' => :'id',
33
+ :'metadata' => :'metadata',
34
+ :'properties' => :'properties',
35
+ :'type' => :'type'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'href' => :'String',
48
+ :'id' => :'String',
49
+ :'metadata' => :'ApiResourceMetadata',
50
+ :'properties' => :'RegistryProperties',
51
+ :'type' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'metadata',
59
+ :'properties',
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudContainerRegistry::RegistryResponse` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudContainerRegistry::RegistryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'href')
79
+ self.href = attributes[:'href']
80
+ end
81
+
82
+ if attributes.key?(:'id')
83
+ self.id = attributes[:'id']
84
+ end
85
+
86
+ if attributes.key?(:'metadata')
87
+ self.metadata = attributes[:'metadata']
88
+ end
89
+
90
+ if attributes.key?(:'properties')
91
+ self.properties = attributes[:'properties']
92
+ end
93
+
94
+ if attributes.key?(:'type')
95
+ self.type = attributes[:'type']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ href == o.href &&
118
+ id == o.id &&
119
+ metadata == o.metadata &&
120
+ properties == o.properties &&
121
+ type == o.type
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [href, id, metadata, properties, type].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ new.build_from_hash(attributes)
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = IonoscloudContainerRegistry.const_get(type)
204
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end