daytona_api_client 0.126.0.pre.alpha.5 → 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
@@ -15,67 +15,15 @@ require 'time'
15
15
 
16
16
  module DaytonaApiClient
17
17
  class CreateRunner
18
- attr_accessor :domain
18
+ attr_accessor :region_id
19
19
 
20
- attr_accessor :api_url
21
-
22
- attr_accessor :proxy_url
23
-
24
- attr_accessor :api_key
25
-
26
- attr_accessor :cpu
27
-
28
- attr_accessor :memory_gi_b
29
-
30
- attr_accessor :disk_gi_b
31
-
32
- attr_accessor :gpu
33
-
34
- attr_accessor :gpu_type
35
-
36
- attr_accessor :_class
37
-
38
- attr_accessor :region
39
-
40
- attr_accessor :version
41
-
42
- class EnumAttributeValidator
43
- attr_reader :datatype
44
- attr_reader :allowable_values
45
-
46
- def initialize(datatype, allowable_values)
47
- @allowable_values = allowable_values.map do |value|
48
- case datatype.to_s
49
- when /Integer/i
50
- value.to_i
51
- when /Float/i
52
- value.to_f
53
- else
54
- value
55
- end
56
- end
57
- end
58
-
59
- def valid?(value)
60
- !value || allowable_values.include?(value)
61
- end
62
- end
20
+ attr_accessor :name
63
21
 
64
22
  # Attribute mapping from ruby-style variable name to JSON key.
65
23
  def self.attribute_map
66
24
  {
67
- :'domain' => :'domain',
68
- :'api_url' => :'apiUrl',
69
- :'proxy_url' => :'proxyUrl',
70
- :'api_key' => :'apiKey',
71
- :'cpu' => :'cpu',
72
- :'memory_gi_b' => :'memoryGiB',
73
- :'disk_gi_b' => :'diskGiB',
74
- :'gpu' => :'gpu',
75
- :'gpu_type' => :'gpuType',
76
- :'_class' => :'class',
77
- :'region' => :'region',
78
- :'version' => :'version'
25
+ :'region_id' => :'regionId',
26
+ :'name' => :'name'
79
27
  }
80
28
  end
81
29
 
@@ -92,18 +40,8 @@ module DaytonaApiClient
92
40
  # Attribute type mapping.
93
41
  def self.openapi_types
94
42
  {
95
- :'domain' => :'String',
96
- :'api_url' => :'String',
97
- :'proxy_url' => :'String',
98
- :'api_key' => :'String',
99
- :'cpu' => :'Float',
100
- :'memory_gi_b' => :'Float',
101
- :'disk_gi_b' => :'Float',
102
- :'gpu' => :'Float',
103
- :'gpu_type' => :'String',
104
- :'_class' => :'String',
105
- :'region' => :'String',
106
- :'version' => :'String'
43
+ :'region_id' => :'String',
44
+ :'name' => :'String'
107
45
  }
108
46
  end
109
47
 
@@ -129,76 +67,16 @@ module DaytonaApiClient
129
67
  h[k.to_sym] = v
130
68
  }
131
69
 
132
- if attributes.key?(:'domain')
133
- self.domain = attributes[:'domain']
134
- else
135
- self.domain = nil
136
- end
137
-
138
- if attributes.key?(:'api_url')
139
- self.api_url = attributes[:'api_url']
140
- else
141
- self.api_url = nil
142
- end
143
-
144
- if attributes.key?(:'proxy_url')
145
- self.proxy_url = attributes[:'proxy_url']
146
- else
147
- self.proxy_url = nil
148
- end
149
-
150
- if attributes.key?(:'api_key')
151
- self.api_key = attributes[:'api_key']
152
- else
153
- self.api_key = nil
154
- end
155
-
156
- if attributes.key?(:'cpu')
157
- self.cpu = attributes[:'cpu']
158
- else
159
- self.cpu = nil
160
- end
161
-
162
- if attributes.key?(:'memory_gi_b')
163
- self.memory_gi_b = attributes[:'memory_gi_b']
70
+ if attributes.key?(:'region_id')
71
+ self.region_id = attributes[:'region_id']
164
72
  else
165
- self.memory_gi_b = nil
73
+ self.region_id = nil
166
74
  end
167
75
 
168
- if attributes.key?(:'disk_gi_b')
169
- self.disk_gi_b = attributes[:'disk_gi_b']
76
+ if attributes.key?(:'name')
77
+ self.name = attributes[:'name']
170
78
  else
171
- self.disk_gi_b = nil
172
- end
173
-
174
- if attributes.key?(:'gpu')
175
- self.gpu = attributes[:'gpu']
176
- else
177
- self.gpu = nil
178
- end
179
-
180
- if attributes.key?(:'gpu_type')
181
- self.gpu_type = attributes[:'gpu_type']
182
- else
183
- self.gpu_type = nil
184
- end
185
-
186
- if attributes.key?(:'_class')
187
- self._class = attributes[:'_class']
188
- else
189
- self._class = nil
190
- end
191
-
192
- if attributes.key?(:'region')
193
- self.region = attributes[:'region']
194
- else
195
- self.region = nil
196
- end
197
-
198
- if attributes.key?(:'version')
199
- self.version = attributes[:'version']
200
- else
201
- self.version = nil
79
+ self.name = nil
202
80
  end
203
81
  end
204
82
 
@@ -207,52 +85,12 @@ module DaytonaApiClient
207
85
  def list_invalid_properties
208
86
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
209
87
  invalid_properties = Array.new
210
- if @domain.nil?
211
- invalid_properties.push('invalid value for "domain", domain cannot be nil.')
212
- end
213
-
214
- if @api_url.nil?
215
- invalid_properties.push('invalid value for "api_url", api_url cannot be nil.')
216
- end
217
-
218
- if @proxy_url.nil?
219
- invalid_properties.push('invalid value for "proxy_url", proxy_url cannot be nil.')
220
- end
221
-
222
- if @api_key.nil?
223
- invalid_properties.push('invalid value for "api_key", api_key cannot be nil.')
224
- end
225
-
226
- if @cpu.nil?
227
- invalid_properties.push('invalid value for "cpu", cpu cannot be nil.')
228
- end
229
-
230
- if @memory_gi_b.nil?
231
- invalid_properties.push('invalid value for "memory_gi_b", memory_gi_b cannot be nil.')
88
+ if @region_id.nil?
89
+ invalid_properties.push('invalid value for "region_id", region_id cannot be nil.')
232
90
  end
233
91
 
234
- if @disk_gi_b.nil?
235
- invalid_properties.push('invalid value for "disk_gi_b", disk_gi_b cannot be nil.')
236
- end
237
-
238
- if @gpu.nil?
239
- invalid_properties.push('invalid value for "gpu", gpu cannot be nil.')
240
- end
241
-
242
- if @gpu_type.nil?
243
- invalid_properties.push('invalid value for "gpu_type", gpu_type cannot be nil.')
244
- end
245
-
246
- if @_class.nil?
247
- invalid_properties.push('invalid value for "_class", _class cannot be nil.')
248
- end
249
-
250
- if @region.nil?
251
- invalid_properties.push('invalid value for "region", region cannot be nil.')
252
- end
253
-
254
- if @version.nil?
255
- invalid_properties.push('invalid value for "version", version cannot be nil.')
92
+ if @name.nil?
93
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
256
94
  end
257
95
 
258
96
  invalid_properties
@@ -262,141 +100,29 @@ module DaytonaApiClient
262
100
  # @return true if the model is valid
263
101
  def valid?
264
102
  warn '[DEPRECATED] the `valid?` method is obsolete'
265
- return false if @domain.nil?
266
- return false if @api_url.nil?
267
- return false if @proxy_url.nil?
268
- return false if @api_key.nil?
269
- return false if @cpu.nil?
270
- return false if @memory_gi_b.nil?
271
- return false if @disk_gi_b.nil?
272
- return false if @gpu.nil?
273
- return false if @gpu_type.nil?
274
- return false if @_class.nil?
275
- _class_validator = EnumAttributeValidator.new('String', ["small", "medium", "large"])
276
- return false unless _class_validator.valid?(@_class)
277
- return false if @region.nil?
278
- return false if @version.nil?
103
+ return false if @region_id.nil?
104
+ return false if @name.nil?
279
105
  true
280
106
  end
281
107
 
282
108
  # Custom attribute writer method with validation
283
- # @param [Object] domain Value to be assigned
284
- def domain=(domain)
285
- if domain.nil?
286
- fail ArgumentError, 'domain cannot be nil'
287
- end
288
-
289
- @domain = domain
290
- end
291
-
292
- # Custom attribute writer method with validation
293
- # @param [Object] api_url Value to be assigned
294
- def api_url=(api_url)
295
- if api_url.nil?
296
- fail ArgumentError, 'api_url cannot be nil'
297
- end
298
-
299
- @api_url = api_url
300
- end
301
-
302
- # Custom attribute writer method with validation
303
- # @param [Object] proxy_url Value to be assigned
304
- def proxy_url=(proxy_url)
305
- if proxy_url.nil?
306
- fail ArgumentError, 'proxy_url cannot be nil'
307
- end
308
-
309
- @proxy_url = proxy_url
310
- end
311
-
312
- # Custom attribute writer method with validation
313
- # @param [Object] api_key Value to be assigned
314
- def api_key=(api_key)
315
- if api_key.nil?
316
- fail ArgumentError, 'api_key cannot be nil'
317
- end
318
-
319
- @api_key = api_key
320
- end
321
-
322
- # Custom attribute writer method with validation
323
- # @param [Object] cpu Value to be assigned
324
- def cpu=(cpu)
325
- if cpu.nil?
326
- fail ArgumentError, 'cpu cannot be nil'
327
- end
328
-
329
- @cpu = cpu
330
- end
331
-
332
- # Custom attribute writer method with validation
333
- # @param [Object] memory_gi_b Value to be assigned
334
- def memory_gi_b=(memory_gi_b)
335
- if memory_gi_b.nil?
336
- fail ArgumentError, 'memory_gi_b cannot be nil'
337
- end
338
-
339
- @memory_gi_b = memory_gi_b
340
- end
341
-
342
- # Custom attribute writer method with validation
343
- # @param [Object] disk_gi_b Value to be assigned
344
- def disk_gi_b=(disk_gi_b)
345
- if disk_gi_b.nil?
346
- fail ArgumentError, 'disk_gi_b cannot be nil'
347
- end
348
-
349
- @disk_gi_b = disk_gi_b
350
- end
351
-
352
- # Custom attribute writer method with validation
353
- # @param [Object] gpu Value to be assigned
354
- def gpu=(gpu)
355
- if gpu.nil?
356
- fail ArgumentError, 'gpu cannot be nil'
357
- end
358
-
359
- @gpu = gpu
360
- end
361
-
362
- # Custom attribute writer method with validation
363
- # @param [Object] gpu_type Value to be assigned
364
- def gpu_type=(gpu_type)
365
- if gpu_type.nil?
366
- fail ArgumentError, 'gpu_type cannot be nil'
367
- end
368
-
369
- @gpu_type = gpu_type
370
- end
371
-
372
- # Custom attribute writer method checking allowed values (enum).
373
- # @param [Object] _class Object to be assigned
374
- def _class=(_class)
375
- validator = EnumAttributeValidator.new('String', ["small", "medium", "large"])
376
- unless validator.valid?(_class)
377
- fail ArgumentError, "invalid value for \"_class\", must be one of #{validator.allowable_values}."
378
- end
379
- @_class = _class
380
- end
381
-
382
- # Custom attribute writer method with validation
383
- # @param [Object] region Value to be assigned
384
- def region=(region)
385
- if region.nil?
386
- fail ArgumentError, 'region cannot be nil'
109
+ # @param [Object] region_id Value to be assigned
110
+ def region_id=(region_id)
111
+ if region_id.nil?
112
+ fail ArgumentError, 'region_id cannot be nil'
387
113
  end
388
114
 
389
- @region = region
115
+ @region_id = region_id
390
116
  end
391
117
 
392
118
  # Custom attribute writer method with validation
393
- # @param [Object] version Value to be assigned
394
- def version=(version)
395
- if version.nil?
396
- fail ArgumentError, 'version cannot be nil'
119
+ # @param [Object] name Value to be assigned
120
+ def name=(name)
121
+ if name.nil?
122
+ fail ArgumentError, 'name cannot be nil'
397
123
  end
398
124
 
399
- @version = version
125
+ @name = name
400
126
  end
401
127
 
402
128
  # Checks equality by comparing each attribute.
@@ -404,18 +130,8 @@ module DaytonaApiClient
404
130
  def ==(o)
405
131
  return true if self.equal?(o)
406
132
  self.class == o.class &&
407
- domain == o.domain &&
408
- api_url == o.api_url &&
409
- proxy_url == o.proxy_url &&
410
- api_key == o.api_key &&
411
- cpu == o.cpu &&
412
- memory_gi_b == o.memory_gi_b &&
413
- disk_gi_b == o.disk_gi_b &&
414
- gpu == o.gpu &&
415
- gpu_type == o.gpu_type &&
416
- _class == o._class &&
417
- region == o.region &&
418
- version == o.version
133
+ region_id == o.region_id &&
134
+ name == o.name
419
135
  end
420
136
 
421
137
  # @see the `==` method
@@ -427,7 +143,7 @@ module DaytonaApiClient
427
143
  # Calculates hash code according to all attributes.
428
144
  # @return [Integer] Hash code
429
145
  def hash
430
- [domain, api_url, proxy_url, api_key, cpu, memory_gi_b, disk_gi_b, gpu, gpu_type, _class, region, version].hash
146
+ [region_id, name].hash
431
147
  end
432
148
 
433
149
  # Builds the object from hash
@@ -0,0 +1,263 @@
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 CreateRunnerResponse
18
+ # The ID of the runner
19
+ attr_accessor :id
20
+
21
+ # The API key for the runner
22
+ attr_accessor :api_key
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'api_key' => :'apiKey'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'api_key' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::CreateRunnerResponse` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::CreateRunnerResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ else
75
+ self.id = nil
76
+ end
77
+
78
+ if attributes.key?(:'api_key')
79
+ self.api_key = attributes[:'api_key']
80
+ else
81
+ self.api_key = nil
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @id.nil?
91
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
92
+ end
93
+
94
+ if @api_key.nil?
95
+ invalid_properties.push('invalid value for "api_key", api_key cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @id.nil?
106
+ return false if @api_key.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] id Value to be assigned
112
+ def id=(id)
113
+ if id.nil?
114
+ fail ArgumentError, 'id cannot be nil'
115
+ end
116
+
117
+ @id = id
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] api_key Value to be assigned
122
+ def api_key=(api_key)
123
+ if api_key.nil?
124
+ fail ArgumentError, 'api_key cannot be nil'
125
+ end
126
+
127
+ @api_key = api_key
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ id == o.id &&
136
+ api_key == o.api_key
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [id, api_key].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def self._deserialize(type, value)
179
+ case type.to_sym
180
+ when :Time
181
+ Time.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ # models (e.g. Pet) or oneOf
212
+ klass = DaytonaApiClient.const_get(type)
213
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+ end
263
+ end