daytona_api_client 0.126.0.pre.alpha.5 → 1.0.0

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/daytona_api_client.gemspec +2 -2
  4. data/lib/daytona_api_client/api/audit_api.rb +66 -18
  5. data/lib/daytona_api_client/api/organizations_api.rb +12 -219
  6. data/lib/daytona_api_client/api/preview_api.rb +5 -7
  7. data/lib/daytona_api_client/api/runners_api.rb +0 -55
  8. data/lib/daytona_api_client/api/sandbox_api.rb +222 -309
  9. data/lib/daytona_api_client/api/toolbox_api.rb +711 -711
  10. data/lib/daytona_api_client/api/workspace_api.rb +3 -3
  11. data/lib/daytona_api_client/models/create_organization.rb +4 -31
  12. data/lib/daytona_api_client/models/create_sandbox.rb +1 -11
  13. data/lib/daytona_api_client/models/create_user.rb +1 -10
  14. data/lib/daytona_api_client/models/daytona_configuration.rb +4 -41
  15. data/lib/daytona_api_client/models/organization.rb +85 -53
  16. data/lib/daytona_api_client/models/organization_usage_overview.rb +146 -18
  17. data/lib/daytona_api_client/models/paginated_audit_logs.rb +4 -14
  18. data/lib/daytona_api_client/models/port_preview_url.rb +14 -31
  19. data/lib/daytona_api_client/models/region.rb +4 -96
  20. data/lib/daytona_api_client/models/sandbox.rb +11 -38
  21. data/lib/daytona_api_client/models/sandbox_volume.rb +4 -14
  22. data/lib/daytona_api_client/models/snapshot_state.rb +4 -1
  23. data/lib/daytona_api_client/models/ssh_access_validation_dto.rb +24 -4
  24. data/lib/daytona_api_client/models/update_organization_quota.rb +41 -41
  25. data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +4 -14
  26. data/lib/daytona_api_client/models/workspace.rb +38 -38
  27. data/lib/daytona_api_client/version.rb +1 -1
  28. data/lib/daytona_api_client.rb +1 -8
  29. data/project.json +7 -29
  30. metadata +1 -16
  31. data/.gitignore +0 -39
  32. data/.openapi-generator/FILES +0 -171
  33. data/.openapi-generator/VERSION +0 -1
  34. data/.openapi-generator-ignore +0 -33
  35. data/.rspec +0 -2
  36. data/.rubocop.yml +0 -148
  37. data/fix-gemspec.sh +0 -11
  38. data/lib/daytona_api_client/api/regions_api.rb +0 -83
  39. data/lib/daytona_api_client/models/rate_limit_config.rb +0 -249
  40. data/lib/daytona_api_client/models/rate_limit_entry.rb +0 -229
  41. data/lib/daytona_api_client/models/region_quota.rb +0 -339
  42. data/lib/daytona_api_client/models/region_usage_overview.rb +0 -391
  43. data/lib/daytona_api_client/models/update_organization_default_region.rb +0 -236
  44. data/lib/daytona_api_client/models/update_organization_region_quota.rb +0 -245
  45. data/lib/daytona_api_client/models/workspace_port_preview_url.rb +0 -263
@@ -1,391 +0,0 @@
1
- =begin
2
- #Daytona
3
-
4
- #Daytona AI platform API Docs
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@daytona.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.12.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class RegionUsageOverview
18
- attr_accessor :region_id
19
-
20
- attr_accessor :total_cpu_quota
21
-
22
- attr_accessor :current_cpu_usage
23
-
24
- attr_accessor :total_memory_quota
25
-
26
- attr_accessor :current_memory_usage
27
-
28
- attr_accessor :total_disk_quota
29
-
30
- attr_accessor :current_disk_usage
31
-
32
- # Attribute mapping from ruby-style variable name to JSON key.
33
- def self.attribute_map
34
- {
35
- :'region_id' => :'regionId',
36
- :'total_cpu_quota' => :'totalCpuQuota',
37
- :'current_cpu_usage' => :'currentCpuUsage',
38
- :'total_memory_quota' => :'totalMemoryQuota',
39
- :'current_memory_usage' => :'currentMemoryUsage',
40
- :'total_disk_quota' => :'totalDiskQuota',
41
- :'current_disk_usage' => :'currentDiskUsage'
42
- }
43
- end
44
-
45
- # Returns attribute mapping this model knows about
46
- def self.acceptable_attribute_map
47
- attribute_map
48
- end
49
-
50
- # Returns all the JSON keys this model knows about
51
- def self.acceptable_attributes
52
- acceptable_attribute_map.values
53
- end
54
-
55
- # Attribute type mapping.
56
- def self.openapi_types
57
- {
58
- :'region_id' => :'String',
59
- :'total_cpu_quota' => :'Float',
60
- :'current_cpu_usage' => :'Float',
61
- :'total_memory_quota' => :'Float',
62
- :'current_memory_usage' => :'Float',
63
- :'total_disk_quota' => :'Float',
64
- :'current_disk_usage' => :'Float'
65
- }
66
- end
67
-
68
- # List of attributes with nullable: true
69
- def self.openapi_nullable
70
- Set.new([
71
- ])
72
- end
73
-
74
- # Initializes the object
75
- # @param [Hash] attributes Model attributes in the form of hash
76
- def initialize(attributes = {})
77
- if (!attributes.is_a?(Hash))
78
- fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::RegionUsageOverview` initialize method"
79
- end
80
-
81
- # check to see if the attribute exists and convert string to symbol for hash key
82
- acceptable_attribute_map = self.class.acceptable_attribute_map
83
- attributes = attributes.each_with_object({}) { |(k, v), h|
84
- if (!acceptable_attribute_map.key?(k.to_sym))
85
- fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::RegionUsageOverview`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
86
- end
87
- h[k.to_sym] = v
88
- }
89
-
90
- if attributes.key?(:'region_id')
91
- self.region_id = attributes[:'region_id']
92
- else
93
- self.region_id = nil
94
- end
95
-
96
- if attributes.key?(:'total_cpu_quota')
97
- self.total_cpu_quota = attributes[:'total_cpu_quota']
98
- else
99
- self.total_cpu_quota = nil
100
- end
101
-
102
- if attributes.key?(:'current_cpu_usage')
103
- self.current_cpu_usage = attributes[:'current_cpu_usage']
104
- else
105
- self.current_cpu_usage = nil
106
- end
107
-
108
- if attributes.key?(:'total_memory_quota')
109
- self.total_memory_quota = attributes[:'total_memory_quota']
110
- else
111
- self.total_memory_quota = nil
112
- end
113
-
114
- if attributes.key?(:'current_memory_usage')
115
- self.current_memory_usage = attributes[:'current_memory_usage']
116
- else
117
- self.current_memory_usage = nil
118
- end
119
-
120
- if attributes.key?(:'total_disk_quota')
121
- self.total_disk_quota = attributes[:'total_disk_quota']
122
- else
123
- self.total_disk_quota = nil
124
- end
125
-
126
- if attributes.key?(:'current_disk_usage')
127
- self.current_disk_usage = attributes[:'current_disk_usage']
128
- else
129
- self.current_disk_usage = nil
130
- end
131
- end
132
-
133
- # Show invalid properties with the reasons. Usually used together with valid?
134
- # @return Array for valid properties with the reasons
135
- def list_invalid_properties
136
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
137
- invalid_properties = Array.new
138
- if @region_id.nil?
139
- invalid_properties.push('invalid value for "region_id", region_id cannot be nil.')
140
- end
141
-
142
- if @total_cpu_quota.nil?
143
- invalid_properties.push('invalid value for "total_cpu_quota", total_cpu_quota cannot be nil.')
144
- end
145
-
146
- if @current_cpu_usage.nil?
147
- invalid_properties.push('invalid value for "current_cpu_usage", current_cpu_usage cannot be nil.')
148
- end
149
-
150
- if @total_memory_quota.nil?
151
- invalid_properties.push('invalid value for "total_memory_quota", total_memory_quota cannot be nil.')
152
- end
153
-
154
- if @current_memory_usage.nil?
155
- invalid_properties.push('invalid value for "current_memory_usage", current_memory_usage cannot be nil.')
156
- end
157
-
158
- if @total_disk_quota.nil?
159
- invalid_properties.push('invalid value for "total_disk_quota", total_disk_quota cannot be nil.')
160
- end
161
-
162
- if @current_disk_usage.nil?
163
- invalid_properties.push('invalid value for "current_disk_usage", current_disk_usage cannot be nil.')
164
- end
165
-
166
- invalid_properties
167
- end
168
-
169
- # Check to see if the all the properties in the model are valid
170
- # @return true if the model is valid
171
- def valid?
172
- warn '[DEPRECATED] the `valid?` method is obsolete'
173
- return false if @region_id.nil?
174
- return false if @total_cpu_quota.nil?
175
- return false if @current_cpu_usage.nil?
176
- return false if @total_memory_quota.nil?
177
- return false if @current_memory_usage.nil?
178
- return false if @total_disk_quota.nil?
179
- return false if @current_disk_usage.nil?
180
- true
181
- end
182
-
183
- # Custom attribute writer method with validation
184
- # @param [Object] region_id Value to be assigned
185
- def region_id=(region_id)
186
- if region_id.nil?
187
- fail ArgumentError, 'region_id cannot be nil'
188
- end
189
-
190
- @region_id = region_id
191
- end
192
-
193
- # Custom attribute writer method with validation
194
- # @param [Object] total_cpu_quota Value to be assigned
195
- def total_cpu_quota=(total_cpu_quota)
196
- if total_cpu_quota.nil?
197
- fail ArgumentError, 'total_cpu_quota cannot be nil'
198
- end
199
-
200
- @total_cpu_quota = total_cpu_quota
201
- end
202
-
203
- # Custom attribute writer method with validation
204
- # @param [Object] current_cpu_usage Value to be assigned
205
- def current_cpu_usage=(current_cpu_usage)
206
- if current_cpu_usage.nil?
207
- fail ArgumentError, 'current_cpu_usage cannot be nil'
208
- end
209
-
210
- @current_cpu_usage = current_cpu_usage
211
- end
212
-
213
- # Custom attribute writer method with validation
214
- # @param [Object] total_memory_quota Value to be assigned
215
- def total_memory_quota=(total_memory_quota)
216
- if total_memory_quota.nil?
217
- fail ArgumentError, 'total_memory_quota cannot be nil'
218
- end
219
-
220
- @total_memory_quota = total_memory_quota
221
- end
222
-
223
- # Custom attribute writer method with validation
224
- # @param [Object] current_memory_usage Value to be assigned
225
- def current_memory_usage=(current_memory_usage)
226
- if current_memory_usage.nil?
227
- fail ArgumentError, 'current_memory_usage cannot be nil'
228
- end
229
-
230
- @current_memory_usage = current_memory_usage
231
- end
232
-
233
- # Custom attribute writer method with validation
234
- # @param [Object] total_disk_quota Value to be assigned
235
- def total_disk_quota=(total_disk_quota)
236
- if total_disk_quota.nil?
237
- fail ArgumentError, 'total_disk_quota cannot be nil'
238
- end
239
-
240
- @total_disk_quota = total_disk_quota
241
- end
242
-
243
- # Custom attribute writer method with validation
244
- # @param [Object] current_disk_usage Value to be assigned
245
- def current_disk_usage=(current_disk_usage)
246
- if current_disk_usage.nil?
247
- fail ArgumentError, 'current_disk_usage cannot be nil'
248
- end
249
-
250
- @current_disk_usage = current_disk_usage
251
- end
252
-
253
- # Checks equality by comparing each attribute.
254
- # @param [Object] Object to be compared
255
- def ==(o)
256
- return true if self.equal?(o)
257
- self.class == o.class &&
258
- region_id == o.region_id &&
259
- total_cpu_quota == o.total_cpu_quota &&
260
- current_cpu_usage == o.current_cpu_usage &&
261
- total_memory_quota == o.total_memory_quota &&
262
- current_memory_usage == o.current_memory_usage &&
263
- total_disk_quota == o.total_disk_quota &&
264
- current_disk_usage == o.current_disk_usage
265
- end
266
-
267
- # @see the `==` method
268
- # @param [Object] Object to be compared
269
- def eql?(o)
270
- self == o
271
- end
272
-
273
- # Calculates hash code according to all attributes.
274
- # @return [Integer] Hash code
275
- def hash
276
- [region_id, total_cpu_quota, current_cpu_usage, total_memory_quota, current_memory_usage, total_disk_quota, current_disk_usage].hash
277
- end
278
-
279
- # Builds the object from hash
280
- # @param [Hash] attributes Model attributes in the form of hash
281
- # @return [Object] Returns the model itself
282
- def self.build_from_hash(attributes)
283
- return nil unless attributes.is_a?(Hash)
284
- attributes = attributes.transform_keys(&:to_sym)
285
- transformed_hash = {}
286
- openapi_types.each_pair do |key, type|
287
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
288
- transformed_hash["#{key}"] = nil
289
- elsif type =~ /\AArray<(.*)>/i
290
- # check to ensure the input is an array given that the attribute
291
- # is documented as an array but the input is not
292
- if attributes[attribute_map[key]].is_a?(Array)
293
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
294
- end
295
- elsif !attributes[attribute_map[key]].nil?
296
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
297
- end
298
- end
299
- new(transformed_hash)
300
- end
301
-
302
- # Deserializes the data based on type
303
- # @param string type Data type
304
- # @param string value Value to be deserialized
305
- # @return [Object] Deserialized data
306
- def self._deserialize(type, value)
307
- case type.to_sym
308
- when :Time
309
- Time.parse(value)
310
- when :Date
311
- Date.parse(value)
312
- when :String
313
- value.to_s
314
- when :Integer
315
- value.to_i
316
- when :Float
317
- value.to_f
318
- when :Boolean
319
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
320
- true
321
- else
322
- false
323
- end
324
- when :Object
325
- # generic object (usually a Hash), return directly
326
- value
327
- when /\AArray<(?<inner_type>.+)>\z/
328
- inner_type = Regexp.last_match[:inner_type]
329
- value.map { |v| _deserialize(inner_type, v) }
330
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
331
- k_type = Regexp.last_match[:k_type]
332
- v_type = Regexp.last_match[:v_type]
333
- {}.tap do |hash|
334
- value.each do |k, v|
335
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
336
- end
337
- end
338
- else # model
339
- # models (e.g. Pet) or oneOf
340
- klass = DaytonaApiClient.const_get(type)
341
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
342
- end
343
- end
344
-
345
- # Returns the string representation of the object
346
- # @return [String] String presentation of the object
347
- def to_s
348
- to_hash.to_s
349
- end
350
-
351
- # to_body is an alias to to_hash (backward compatibility)
352
- # @return [Hash] Returns the object in the form of hash
353
- def to_body
354
- to_hash
355
- end
356
-
357
- # Returns the object in the form of hash
358
- # @return [Hash] Returns the object in the form of hash
359
- def to_hash
360
- hash = {}
361
- self.class.attribute_map.each_pair do |attr, param|
362
- value = self.send(attr)
363
- if value.nil?
364
- is_nullable = self.class.openapi_nullable.include?(attr)
365
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
366
- end
367
-
368
- hash[param] = _to_hash(value)
369
- end
370
- hash
371
- end
372
-
373
- # Outputs non-array value in the form of hash
374
- # For object, use to_hash. Otherwise, just return the value
375
- # @param [Object] value Any valid value
376
- # @return [Hash] Returns the value in the form of hash
377
- def _to_hash(value)
378
- if value.is_a?(Array)
379
- value.compact.map { |v| _to_hash(v) }
380
- elsif value.is_a?(Hash)
381
- {}.tap do |hash|
382
- value.each { |k, v| hash[k] = _to_hash(v) }
383
- end
384
- elsif value.respond_to? :to_hash
385
- value.to_hash
386
- else
387
- value
388
- end
389
- end
390
- end
391
- end
@@ -1,236 +0,0 @@
1
- =begin
2
- #Daytona
3
-
4
- #Daytona AI platform API Docs
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@daytona.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.12.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class UpdateOrganizationDefaultRegion
18
- # The ID of the default region for the organization
19
- attr_accessor :default_region_id
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'default_region_id' => :'defaultRegionId'
25
- }
26
- end
27
-
28
- # Returns attribute mapping this model knows about
29
- def self.acceptable_attribute_map
30
- attribute_map
31
- end
32
-
33
- # Returns all the JSON keys this model knows about
34
- def self.acceptable_attributes
35
- acceptable_attribute_map.values
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.openapi_types
40
- {
41
- :'default_region_id' => :'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 `DaytonaApiClient::UpdateOrganizationDefaultRegion` initialize method"
56
- end
57
-
58
- # check to see if the attribute exists and convert string to symbol for hash key
59
- acceptable_attribute_map = self.class.acceptable_attribute_map
60
- attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!acceptable_attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::UpdateOrganizationDefaultRegion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
- end
64
- h[k.to_sym] = v
65
- }
66
-
67
- if attributes.key?(:'default_region_id')
68
- self.default_region_id = attributes[:'default_region_id']
69
- else
70
- self.default_region_id = nil
71
- end
72
- end
73
-
74
- # Show invalid properties with the reasons. Usually used together with valid?
75
- # @return Array for valid properties with the reasons
76
- def list_invalid_properties
77
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
- invalid_properties = Array.new
79
- if @default_region_id.nil?
80
- invalid_properties.push('invalid value for "default_region_id", default_region_id cannot be nil.')
81
- end
82
-
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
- warn '[DEPRECATED] the `valid?` method is obsolete'
90
- return false if @default_region_id.nil?
91
- true
92
- end
93
-
94
- # Custom attribute writer method with validation
95
- # @param [Object] default_region_id Value to be assigned
96
- def default_region_id=(default_region_id)
97
- if default_region_id.nil?
98
- fail ArgumentError, 'default_region_id cannot be nil'
99
- end
100
-
101
- @default_region_id = default_region_id
102
- end
103
-
104
- # Checks equality by comparing each attribute.
105
- # @param [Object] Object to be compared
106
- def ==(o)
107
- return true if self.equal?(o)
108
- self.class == o.class &&
109
- default_region_id == o.default_region_id
110
- end
111
-
112
- # @see the `==` method
113
- # @param [Object] Object to be compared
114
- def eql?(o)
115
- self == o
116
- end
117
-
118
- # Calculates hash code according to all attributes.
119
- # @return [Integer] Hash code
120
- def hash
121
- [default_region_id].hash
122
- end
123
-
124
- # Builds the object from hash
125
- # @param [Hash] attributes Model attributes in the form of hash
126
- # @return [Object] Returns the model itself
127
- def self.build_from_hash(attributes)
128
- return nil unless attributes.is_a?(Hash)
129
- attributes = attributes.transform_keys(&:to_sym)
130
- transformed_hash = {}
131
- openapi_types.each_pair do |key, type|
132
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
- transformed_hash["#{key}"] = nil
134
- elsif type =~ /\AArray<(.*)>/i
135
- # check to ensure the input is an array given that the attribute
136
- # is documented as an array but the input is not
137
- if attributes[attribute_map[key]].is_a?(Array)
138
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
- end
140
- elsif !attributes[attribute_map[key]].nil?
141
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
- end
143
- end
144
- new(transformed_hash)
145
- end
146
-
147
- # Deserializes the data based on type
148
- # @param string type Data type
149
- # @param string value Value to be deserialized
150
- # @return [Object] Deserialized data
151
- def self._deserialize(type, value)
152
- case type.to_sym
153
- when :Time
154
- Time.parse(value)
155
- when :Date
156
- Date.parse(value)
157
- when :String
158
- value.to_s
159
- when :Integer
160
- value.to_i
161
- when :Float
162
- value.to_f
163
- when :Boolean
164
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
- true
166
- else
167
- false
168
- end
169
- when :Object
170
- # generic object (usually a Hash), return directly
171
- value
172
- when /\AArray<(?<inner_type>.+)>\z/
173
- inner_type = Regexp.last_match[:inner_type]
174
- value.map { |v| _deserialize(inner_type, v) }
175
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
- k_type = Regexp.last_match[:k_type]
177
- v_type = Regexp.last_match[:v_type]
178
- {}.tap do |hash|
179
- value.each do |k, v|
180
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
- end
182
- end
183
- else # model
184
- # models (e.g. Pet) or oneOf
185
- klass = DaytonaApiClient.const_get(type)
186
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
- end
188
- end
189
-
190
- # Returns the string representation of the object
191
- # @return [String] String presentation of the object
192
- def to_s
193
- to_hash.to_s
194
- end
195
-
196
- # to_body is an alias to to_hash (backward compatibility)
197
- # @return [Hash] Returns the object in the form of hash
198
- def to_body
199
- to_hash
200
- end
201
-
202
- # Returns the object in the form of hash
203
- # @return [Hash] Returns the object in the form of hash
204
- def to_hash
205
- hash = {}
206
- self.class.attribute_map.each_pair do |attr, param|
207
- value = self.send(attr)
208
- if value.nil?
209
- is_nullable = self.class.openapi_nullable.include?(attr)
210
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
- end
212
-
213
- hash[param] = _to_hash(value)
214
- end
215
- hash
216
- end
217
-
218
- # Outputs non-array value in the form of hash
219
- # For object, use to_hash. Otherwise, just return the value
220
- # @param [Object] value Any valid value
221
- # @return [Hash] Returns the value in the form of hash
222
- def _to_hash(value)
223
- if value.is_a?(Array)
224
- value.compact.map { |v| _to_hash(v) }
225
- elsif value.is_a?(Hash)
226
- {}.tap do |hash|
227
- value.each { |k, v| hash[k] = _to_hash(v) }
228
- end
229
- elsif value.respond_to? :to_hash
230
- value.to_hash
231
- else
232
- value
233
- end
234
- end
235
- end
236
- end