daytona_api_client 0.126.0.pre.alpha.4 → 0.134.0.alpha.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +23 -0
  3. data/.openapi-generator-ignore +0 -2
  4. data/daytona_api_client.gemspec +1 -1
  5. data/fix-gemspec.sh +1 -1
  6. data/lib/daytona_api_client/api/admin_api.rb +325 -0
  7. data/lib/daytona_api_client/api/docker_registry_api.rb +3 -0
  8. data/lib/daytona_api_client/api/jobs_api.rb +299 -0
  9. data/lib/daytona_api_client/api/organizations_api.rb +518 -0
  10. data/lib/daytona_api_client/api/preview_api.rb +67 -0
  11. data/lib/daytona_api_client/api/regions_api.rb +9 -15
  12. data/lib/daytona_api_client/api/runners_api.rb +291 -23
  13. data/lib/daytona_api_client/api/sandbox_api.rb +277 -0
  14. data/lib/daytona_api_client/api/snapshots_api.rb +66 -0
  15. data/lib/daytona_api_client/models/admin_create_runner.rb +385 -0
  16. data/lib/daytona_api_client/models/build_info.rb +31 -4
  17. data/lib/daytona_api_client/models/create_region.rb +269 -0
  18. data/lib/daytona_api_client/models/create_region_response.rb +280 -0
  19. data/lib/daytona_api_client/models/create_runner.rb +31 -315
  20. data/lib/daytona_api_client/models/create_runner_response.rb +263 -0
  21. data/lib/daytona_api_client/models/create_snapshot.rb +14 -4
  22. data/lib/daytona_api_client/models/{create_audit_log.rb → job.rb} +166 -79
  23. data/lib/daytona_api_client/models/job_status.rb +42 -0
  24. data/lib/daytona_api_client/models/job_type.rb +49 -0
  25. data/lib/daytona_api_client/models/{paginated_snapshots_dto.rb → paginated_jobs.rb} +4 -4
  26. data/lib/daytona_api_client/models/poll_jobs_response.rb +238 -0
  27. data/lib/daytona_api_client/models/regenerate_api_key_response.rb +236 -0
  28. data/lib/daytona_api_client/models/region.rb +86 -4
  29. data/lib/daytona_api_client/models/region_type.rb +41 -0
  30. data/lib/daytona_api_client/models/runner.rb +79 -117
  31. data/lib/daytona_api_client/models/runner_full.rb +779 -0
  32. data/lib/daytona_api_client/models/runner_health_metrics.rb +533 -0
  33. data/lib/daytona_api_client/models/runner_healthcheck.rb +276 -0
  34. data/lib/daytona_api_client/models/runner_snapshot_dto.rb +0 -17
  35. data/lib/daytona_api_client/models/sandbox.rb +14 -4
  36. data/lib/daytona_api_client/models/signed_port_preview_url.rb +317 -0
  37. data/lib/daytona_api_client/models/snapshot_dto.rb +36 -4
  38. data/lib/daytona_api_client/models/snapshot_manager_credentials.rb +263 -0
  39. data/lib/daytona_api_client/models/ssh_access_dto.rb +31 -4
  40. data/lib/daytona_api_client/models/toolbox_proxy_url.rb +236 -0
  41. data/lib/daytona_api_client/models/update_job_status.rb +278 -0
  42. data/lib/daytona_api_client/models/update_region.rb +242 -0
  43. data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +14 -4
  44. data/lib/daytona_api_client/models/url.rb +236 -0
  45. data/lib/daytona_api_client/models/workspace.rb +11 -1
  46. data/lib/daytona_api_client/version.rb +1 -1
  47. data/lib/daytona_api_client.rb +22 -0
  48. data/project.json +10 -4
  49. metadata +23 -5
  50. data/Gemfile +0 -9
  51. data/Gemfile.lock +0 -101
@@ -0,0 +1,533 @@
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 RunnerHealthMetrics
18
+ # Current CPU load average
19
+ attr_accessor :current_cpu_load_average
20
+
21
+ # Current CPU usage percentage
22
+ attr_accessor :current_cpu_usage_percentage
23
+
24
+ # Current memory usage percentage
25
+ attr_accessor :current_memory_usage_percentage
26
+
27
+ # Current disk usage percentage
28
+ attr_accessor :current_disk_usage_percentage
29
+
30
+ # Currently allocated CPU cores
31
+ attr_accessor :current_allocated_cpu
32
+
33
+ # Currently allocated memory in GiB
34
+ attr_accessor :current_allocated_memory_gi_b
35
+
36
+ # Currently allocated disk in GiB
37
+ attr_accessor :current_allocated_disk_gi_b
38
+
39
+ # Number of snapshots currently stored
40
+ attr_accessor :current_snapshot_count
41
+
42
+ # Number of started sandboxes
43
+ attr_accessor :current_started_sandboxes
44
+
45
+ # Total CPU cores on the runner
46
+ attr_accessor :cpu
47
+
48
+ # Total RAM in GiB on the runner
49
+ attr_accessor :memory_gi_b
50
+
51
+ # Total disk space in GiB on the runner
52
+ attr_accessor :disk_gi_b
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'current_cpu_load_average' => :'currentCpuLoadAverage',
58
+ :'current_cpu_usage_percentage' => :'currentCpuUsagePercentage',
59
+ :'current_memory_usage_percentage' => :'currentMemoryUsagePercentage',
60
+ :'current_disk_usage_percentage' => :'currentDiskUsagePercentage',
61
+ :'current_allocated_cpu' => :'currentAllocatedCpu',
62
+ :'current_allocated_memory_gi_b' => :'currentAllocatedMemoryGiB',
63
+ :'current_allocated_disk_gi_b' => :'currentAllocatedDiskGiB',
64
+ :'current_snapshot_count' => :'currentSnapshotCount',
65
+ :'current_started_sandboxes' => :'currentStartedSandboxes',
66
+ :'cpu' => :'cpu',
67
+ :'memory_gi_b' => :'memoryGiB',
68
+ :'disk_gi_b' => :'diskGiB'
69
+ }
70
+ end
71
+
72
+ # Returns attribute mapping this model knows about
73
+ def self.acceptable_attribute_map
74
+ attribute_map
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ acceptable_attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'current_cpu_load_average' => :'Float',
86
+ :'current_cpu_usage_percentage' => :'Float',
87
+ :'current_memory_usage_percentage' => :'Float',
88
+ :'current_disk_usage_percentage' => :'Float',
89
+ :'current_allocated_cpu' => :'Float',
90
+ :'current_allocated_memory_gi_b' => :'Float',
91
+ :'current_allocated_disk_gi_b' => :'Float',
92
+ :'current_snapshot_count' => :'Float',
93
+ :'current_started_sandboxes' => :'Float',
94
+ :'cpu' => :'Float',
95
+ :'memory_gi_b' => :'Float',
96
+ :'disk_gi_b' => :'Float'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::RunnerHealthMetrics` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ acceptable_attribute_map = self.class.acceptable_attribute_map
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!acceptable_attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::RunnerHealthMetrics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'current_cpu_load_average')
123
+ self.current_cpu_load_average = attributes[:'current_cpu_load_average']
124
+ else
125
+ self.current_cpu_load_average = nil
126
+ end
127
+
128
+ if attributes.key?(:'current_cpu_usage_percentage')
129
+ self.current_cpu_usage_percentage = attributes[:'current_cpu_usage_percentage']
130
+ else
131
+ self.current_cpu_usage_percentage = nil
132
+ end
133
+
134
+ if attributes.key?(:'current_memory_usage_percentage')
135
+ self.current_memory_usage_percentage = attributes[:'current_memory_usage_percentage']
136
+ else
137
+ self.current_memory_usage_percentage = nil
138
+ end
139
+
140
+ if attributes.key?(:'current_disk_usage_percentage')
141
+ self.current_disk_usage_percentage = attributes[:'current_disk_usage_percentage']
142
+ else
143
+ self.current_disk_usage_percentage = nil
144
+ end
145
+
146
+ if attributes.key?(:'current_allocated_cpu')
147
+ self.current_allocated_cpu = attributes[:'current_allocated_cpu']
148
+ else
149
+ self.current_allocated_cpu = nil
150
+ end
151
+
152
+ if attributes.key?(:'current_allocated_memory_gi_b')
153
+ self.current_allocated_memory_gi_b = attributes[:'current_allocated_memory_gi_b']
154
+ else
155
+ self.current_allocated_memory_gi_b = nil
156
+ end
157
+
158
+ if attributes.key?(:'current_allocated_disk_gi_b')
159
+ self.current_allocated_disk_gi_b = attributes[:'current_allocated_disk_gi_b']
160
+ else
161
+ self.current_allocated_disk_gi_b = nil
162
+ end
163
+
164
+ if attributes.key?(:'current_snapshot_count')
165
+ self.current_snapshot_count = attributes[:'current_snapshot_count']
166
+ else
167
+ self.current_snapshot_count = nil
168
+ end
169
+
170
+ if attributes.key?(:'current_started_sandboxes')
171
+ self.current_started_sandboxes = attributes[:'current_started_sandboxes']
172
+ else
173
+ self.current_started_sandboxes = nil
174
+ end
175
+
176
+ if attributes.key?(:'cpu')
177
+ self.cpu = attributes[:'cpu']
178
+ else
179
+ self.cpu = nil
180
+ end
181
+
182
+ if attributes.key?(:'memory_gi_b')
183
+ self.memory_gi_b = attributes[:'memory_gi_b']
184
+ else
185
+ self.memory_gi_b = nil
186
+ end
187
+
188
+ if attributes.key?(:'disk_gi_b')
189
+ self.disk_gi_b = attributes[:'disk_gi_b']
190
+ else
191
+ self.disk_gi_b = nil
192
+ end
193
+ end
194
+
195
+ # Show invalid properties with the reasons. Usually used together with valid?
196
+ # @return Array for valid properties with the reasons
197
+ def list_invalid_properties
198
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
199
+ invalid_properties = Array.new
200
+ if @current_cpu_load_average.nil?
201
+ invalid_properties.push('invalid value for "current_cpu_load_average", current_cpu_load_average cannot be nil.')
202
+ end
203
+
204
+ if @current_cpu_usage_percentage.nil?
205
+ invalid_properties.push('invalid value for "current_cpu_usage_percentage", current_cpu_usage_percentage cannot be nil.')
206
+ end
207
+
208
+ if @current_memory_usage_percentage.nil?
209
+ invalid_properties.push('invalid value for "current_memory_usage_percentage", current_memory_usage_percentage cannot be nil.')
210
+ end
211
+
212
+ if @current_disk_usage_percentage.nil?
213
+ invalid_properties.push('invalid value for "current_disk_usage_percentage", current_disk_usage_percentage cannot be nil.')
214
+ end
215
+
216
+ if @current_allocated_cpu.nil?
217
+ invalid_properties.push('invalid value for "current_allocated_cpu", current_allocated_cpu cannot be nil.')
218
+ end
219
+
220
+ if @current_allocated_memory_gi_b.nil?
221
+ invalid_properties.push('invalid value for "current_allocated_memory_gi_b", current_allocated_memory_gi_b cannot be nil.')
222
+ end
223
+
224
+ if @current_allocated_disk_gi_b.nil?
225
+ invalid_properties.push('invalid value for "current_allocated_disk_gi_b", current_allocated_disk_gi_b cannot be nil.')
226
+ end
227
+
228
+ if @current_snapshot_count.nil?
229
+ invalid_properties.push('invalid value for "current_snapshot_count", current_snapshot_count cannot be nil.')
230
+ end
231
+
232
+ if @current_started_sandboxes.nil?
233
+ invalid_properties.push('invalid value for "current_started_sandboxes", current_started_sandboxes cannot be nil.')
234
+ end
235
+
236
+ if @cpu.nil?
237
+ invalid_properties.push('invalid value for "cpu", cpu cannot be nil.')
238
+ end
239
+
240
+ if @memory_gi_b.nil?
241
+ invalid_properties.push('invalid value for "memory_gi_b", memory_gi_b cannot be nil.')
242
+ end
243
+
244
+ if @disk_gi_b.nil?
245
+ invalid_properties.push('invalid value for "disk_gi_b", disk_gi_b cannot be nil.')
246
+ end
247
+
248
+ invalid_properties
249
+ end
250
+
251
+ # Check to see if the all the properties in the model are valid
252
+ # @return true if the model is valid
253
+ def valid?
254
+ warn '[DEPRECATED] the `valid?` method is obsolete'
255
+ return false if @current_cpu_load_average.nil?
256
+ return false if @current_cpu_usage_percentage.nil?
257
+ return false if @current_memory_usage_percentage.nil?
258
+ return false if @current_disk_usage_percentage.nil?
259
+ return false if @current_allocated_cpu.nil?
260
+ return false if @current_allocated_memory_gi_b.nil?
261
+ return false if @current_allocated_disk_gi_b.nil?
262
+ return false if @current_snapshot_count.nil?
263
+ return false if @current_started_sandboxes.nil?
264
+ return false if @cpu.nil?
265
+ return false if @memory_gi_b.nil?
266
+ return false if @disk_gi_b.nil?
267
+ true
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] current_cpu_load_average Value to be assigned
272
+ def current_cpu_load_average=(current_cpu_load_average)
273
+ if current_cpu_load_average.nil?
274
+ fail ArgumentError, 'current_cpu_load_average cannot be nil'
275
+ end
276
+
277
+ @current_cpu_load_average = current_cpu_load_average
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] current_cpu_usage_percentage Value to be assigned
282
+ def current_cpu_usage_percentage=(current_cpu_usage_percentage)
283
+ if current_cpu_usage_percentage.nil?
284
+ fail ArgumentError, 'current_cpu_usage_percentage cannot be nil'
285
+ end
286
+
287
+ @current_cpu_usage_percentage = current_cpu_usage_percentage
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] current_memory_usage_percentage Value to be assigned
292
+ def current_memory_usage_percentage=(current_memory_usage_percentage)
293
+ if current_memory_usage_percentage.nil?
294
+ fail ArgumentError, 'current_memory_usage_percentage cannot be nil'
295
+ end
296
+
297
+ @current_memory_usage_percentage = current_memory_usage_percentage
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] current_disk_usage_percentage Value to be assigned
302
+ def current_disk_usage_percentage=(current_disk_usage_percentage)
303
+ if current_disk_usage_percentage.nil?
304
+ fail ArgumentError, 'current_disk_usage_percentage cannot be nil'
305
+ end
306
+
307
+ @current_disk_usage_percentage = current_disk_usage_percentage
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] current_allocated_cpu Value to be assigned
312
+ def current_allocated_cpu=(current_allocated_cpu)
313
+ if current_allocated_cpu.nil?
314
+ fail ArgumentError, 'current_allocated_cpu cannot be nil'
315
+ end
316
+
317
+ @current_allocated_cpu = current_allocated_cpu
318
+ end
319
+
320
+ # Custom attribute writer method with validation
321
+ # @param [Object] current_allocated_memory_gi_b Value to be assigned
322
+ def current_allocated_memory_gi_b=(current_allocated_memory_gi_b)
323
+ if current_allocated_memory_gi_b.nil?
324
+ fail ArgumentError, 'current_allocated_memory_gi_b cannot be nil'
325
+ end
326
+
327
+ @current_allocated_memory_gi_b = current_allocated_memory_gi_b
328
+ end
329
+
330
+ # Custom attribute writer method with validation
331
+ # @param [Object] current_allocated_disk_gi_b Value to be assigned
332
+ def current_allocated_disk_gi_b=(current_allocated_disk_gi_b)
333
+ if current_allocated_disk_gi_b.nil?
334
+ fail ArgumentError, 'current_allocated_disk_gi_b cannot be nil'
335
+ end
336
+
337
+ @current_allocated_disk_gi_b = current_allocated_disk_gi_b
338
+ end
339
+
340
+ # Custom attribute writer method with validation
341
+ # @param [Object] current_snapshot_count Value to be assigned
342
+ def current_snapshot_count=(current_snapshot_count)
343
+ if current_snapshot_count.nil?
344
+ fail ArgumentError, 'current_snapshot_count cannot be nil'
345
+ end
346
+
347
+ @current_snapshot_count = current_snapshot_count
348
+ end
349
+
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] current_started_sandboxes Value to be assigned
352
+ def current_started_sandboxes=(current_started_sandboxes)
353
+ if current_started_sandboxes.nil?
354
+ fail ArgumentError, 'current_started_sandboxes cannot be nil'
355
+ end
356
+
357
+ @current_started_sandboxes = current_started_sandboxes
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] cpu Value to be assigned
362
+ def cpu=(cpu)
363
+ if cpu.nil?
364
+ fail ArgumentError, 'cpu cannot be nil'
365
+ end
366
+
367
+ @cpu = cpu
368
+ end
369
+
370
+ # Custom attribute writer method with validation
371
+ # @param [Object] memory_gi_b Value to be assigned
372
+ def memory_gi_b=(memory_gi_b)
373
+ if memory_gi_b.nil?
374
+ fail ArgumentError, 'memory_gi_b cannot be nil'
375
+ end
376
+
377
+ @memory_gi_b = memory_gi_b
378
+ end
379
+
380
+ # Custom attribute writer method with validation
381
+ # @param [Object] disk_gi_b Value to be assigned
382
+ def disk_gi_b=(disk_gi_b)
383
+ if disk_gi_b.nil?
384
+ fail ArgumentError, 'disk_gi_b cannot be nil'
385
+ end
386
+
387
+ @disk_gi_b = disk_gi_b
388
+ end
389
+
390
+ # Checks equality by comparing each attribute.
391
+ # @param [Object] Object to be compared
392
+ def ==(o)
393
+ return true if self.equal?(o)
394
+ self.class == o.class &&
395
+ current_cpu_load_average == o.current_cpu_load_average &&
396
+ current_cpu_usage_percentage == o.current_cpu_usage_percentage &&
397
+ current_memory_usage_percentage == o.current_memory_usage_percentage &&
398
+ current_disk_usage_percentage == o.current_disk_usage_percentage &&
399
+ current_allocated_cpu == o.current_allocated_cpu &&
400
+ current_allocated_memory_gi_b == o.current_allocated_memory_gi_b &&
401
+ current_allocated_disk_gi_b == o.current_allocated_disk_gi_b &&
402
+ current_snapshot_count == o.current_snapshot_count &&
403
+ current_started_sandboxes == o.current_started_sandboxes &&
404
+ cpu == o.cpu &&
405
+ memory_gi_b == o.memory_gi_b &&
406
+ disk_gi_b == o.disk_gi_b
407
+ end
408
+
409
+ # @see the `==` method
410
+ # @param [Object] Object to be compared
411
+ def eql?(o)
412
+ self == o
413
+ end
414
+
415
+ # Calculates hash code according to all attributes.
416
+ # @return [Integer] Hash code
417
+ def hash
418
+ [current_cpu_load_average, current_cpu_usage_percentage, current_memory_usage_percentage, current_disk_usage_percentage, current_allocated_cpu, current_allocated_memory_gi_b, current_allocated_disk_gi_b, current_snapshot_count, current_started_sandboxes, cpu, memory_gi_b, disk_gi_b].hash
419
+ end
420
+
421
+ # Builds the object from hash
422
+ # @param [Hash] attributes Model attributes in the form of hash
423
+ # @return [Object] Returns the model itself
424
+ def self.build_from_hash(attributes)
425
+ return nil unless attributes.is_a?(Hash)
426
+ attributes = attributes.transform_keys(&:to_sym)
427
+ transformed_hash = {}
428
+ openapi_types.each_pair do |key, type|
429
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
430
+ transformed_hash["#{key}"] = nil
431
+ elsif type =~ /\AArray<(.*)>/i
432
+ # check to ensure the input is an array given that the attribute
433
+ # is documented as an array but the input is not
434
+ if attributes[attribute_map[key]].is_a?(Array)
435
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
436
+ end
437
+ elsif !attributes[attribute_map[key]].nil?
438
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
439
+ end
440
+ end
441
+ new(transformed_hash)
442
+ end
443
+
444
+ # Deserializes the data based on type
445
+ # @param string type Data type
446
+ # @param string value Value to be deserialized
447
+ # @return [Object] Deserialized data
448
+ def self._deserialize(type, value)
449
+ case type.to_sym
450
+ when :Time
451
+ Time.parse(value)
452
+ when :Date
453
+ Date.parse(value)
454
+ when :String
455
+ value.to_s
456
+ when :Integer
457
+ value.to_i
458
+ when :Float
459
+ value.to_f
460
+ when :Boolean
461
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
462
+ true
463
+ else
464
+ false
465
+ end
466
+ when :Object
467
+ # generic object (usually a Hash), return directly
468
+ value
469
+ when /\AArray<(?<inner_type>.+)>\z/
470
+ inner_type = Regexp.last_match[:inner_type]
471
+ value.map { |v| _deserialize(inner_type, v) }
472
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
473
+ k_type = Regexp.last_match[:k_type]
474
+ v_type = Regexp.last_match[:v_type]
475
+ {}.tap do |hash|
476
+ value.each do |k, v|
477
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
478
+ end
479
+ end
480
+ else # model
481
+ # models (e.g. Pet) or oneOf
482
+ klass = DaytonaApiClient.const_get(type)
483
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
484
+ end
485
+ end
486
+
487
+ # Returns the string representation of the object
488
+ # @return [String] String presentation of the object
489
+ def to_s
490
+ to_hash.to_s
491
+ end
492
+
493
+ # to_body is an alias to to_hash (backward compatibility)
494
+ # @return [Hash] Returns the object in the form of hash
495
+ def to_body
496
+ to_hash
497
+ end
498
+
499
+ # Returns the object in the form of hash
500
+ # @return [Hash] Returns the object in the form of hash
501
+ def to_hash
502
+ hash = {}
503
+ self.class.attribute_map.each_pair do |attr, param|
504
+ value = self.send(attr)
505
+ if value.nil?
506
+ is_nullable = self.class.openapi_nullable.include?(attr)
507
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
508
+ end
509
+
510
+ hash[param] = _to_hash(value)
511
+ end
512
+ hash
513
+ end
514
+
515
+ # Outputs non-array value in the form of hash
516
+ # For object, use to_hash. Otherwise, just return the value
517
+ # @param [Object] value Any valid value
518
+ # @return [Hash] Returns the value in the form of hash
519
+ def _to_hash(value)
520
+ if value.is_a?(Array)
521
+ value.compact.map { |v| _to_hash(v) }
522
+ elsif value.is_a?(Hash)
523
+ {}.tap do |hash|
524
+ value.each { |k, v| hash[k] = _to_hash(v) }
525
+ end
526
+ elsif value.respond_to? :to_hash
527
+ value.to_hash
528
+ else
529
+ value
530
+ end
531
+ end
532
+ end
533
+ end