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,276 @@
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 RunnerHealthcheck
18
+ # Runner metrics
19
+ attr_accessor :metrics
20
+
21
+ # Runner domain
22
+ attr_accessor :domain
23
+
24
+ # Runner proxy URL
25
+ attr_accessor :proxy_url
26
+
27
+ # Runner API URL
28
+ attr_accessor :api_url
29
+
30
+ # Runner app version
31
+ attr_accessor :app_version
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'metrics' => :'metrics',
37
+ :'domain' => :'domain',
38
+ :'proxy_url' => :'proxyUrl',
39
+ :'api_url' => :'apiUrl',
40
+ :'app_version' => :'appVersion'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'metrics' => :'RunnerHealthMetrics',
58
+ :'domain' => :'String',
59
+ :'proxy_url' => :'String',
60
+ :'api_url' => :'String',
61
+ :'app_version' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::RunnerHealthcheck` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::RunnerHealthcheck`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'metrics')
88
+ self.metrics = attributes[:'metrics']
89
+ end
90
+
91
+ if attributes.key?(:'domain')
92
+ self.domain = attributes[:'domain']
93
+ end
94
+
95
+ if attributes.key?(:'proxy_url')
96
+ self.proxy_url = attributes[:'proxy_url']
97
+ end
98
+
99
+ if attributes.key?(:'api_url')
100
+ self.api_url = attributes[:'api_url']
101
+ end
102
+
103
+ if attributes.key?(:'app_version')
104
+ self.app_version = attributes[:'app_version']
105
+ else
106
+ self.app_version = nil
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
114
+ invalid_properties = Array.new
115
+ if @app_version.nil?
116
+ invalid_properties.push('invalid value for "app_version", app_version cannot be nil.')
117
+ end
118
+
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ warn '[DEPRECATED] the `valid?` method is obsolete'
126
+ return false if @app_version.nil?
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] app_version Value to be assigned
132
+ def app_version=(app_version)
133
+ if app_version.nil?
134
+ fail ArgumentError, 'app_version cannot be nil'
135
+ end
136
+
137
+ @app_version = app_version
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ metrics == o.metrics &&
146
+ domain == o.domain &&
147
+ proxy_url == o.proxy_url &&
148
+ api_url == o.api_url &&
149
+ app_version == o.app_version
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [metrics, domain, proxy_url, api_url, app_version].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ attributes = attributes.transform_keys(&:to_sym)
170
+ transformed_hash = {}
171
+ openapi_types.each_pair do |key, type|
172
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = nil
174
+ elsif type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[attribute_map[key]].is_a?(Array)
178
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
179
+ end
180
+ elsif !attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
182
+ end
183
+ end
184
+ new(transformed_hash)
185
+ end
186
+
187
+ # Deserializes the data based on type
188
+ # @param string type Data type
189
+ # @param string value Value to be deserialized
190
+ # @return [Object] Deserialized data
191
+ def self._deserialize(type, value)
192
+ case type.to_sym
193
+ when :Time
194
+ Time.parse(value)
195
+ when :Date
196
+ Date.parse(value)
197
+ when :String
198
+ value.to_s
199
+ when :Integer
200
+ value.to_i
201
+ when :Float
202
+ value.to_f
203
+ when :Boolean
204
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
205
+ true
206
+ else
207
+ false
208
+ end
209
+ when :Object
210
+ # generic object (usually a Hash), return directly
211
+ value
212
+ when /\AArray<(?<inner_type>.+)>\z/
213
+ inner_type = Regexp.last_match[:inner_type]
214
+ value.map { |v| _deserialize(inner_type, v) }
215
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
216
+ k_type = Regexp.last_match[:k_type]
217
+ v_type = Regexp.last_match[:v_type]
218
+ {}.tap do |hash|
219
+ value.each do |k, v|
220
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
221
+ end
222
+ end
223
+ else # model
224
+ # models (e.g. Pet) or oneOf
225
+ klass = DaytonaApiClient.const_get(type)
226
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end
@@ -88,8 +88,6 @@ module DaytonaApiClient
88
88
 
89
89
  if attributes.key?(:'runner_domain')
90
90
  self.runner_domain = attributes[:'runner_domain']
91
- else
92
- self.runner_domain = nil
93
91
  end
94
92
  end
95
93
 
@@ -106,10 +104,6 @@ module DaytonaApiClient
106
104
  invalid_properties.push('invalid value for "runner_id", runner_id cannot be nil.')
107
105
  end
108
106
 
109
- if @runner_domain.nil?
110
- invalid_properties.push('invalid value for "runner_domain", runner_domain cannot be nil.')
111
- end
112
-
113
107
  invalid_properties
114
108
  end
115
109
 
@@ -119,7 +113,6 @@ module DaytonaApiClient
119
113
  warn '[DEPRECATED] the `valid?` method is obsolete'
120
114
  return false if @runner_snapshot_id.nil?
121
115
  return false if @runner_id.nil?
122
- return false if @runner_domain.nil?
123
116
  true
124
117
  end
125
118
 
@@ -143,16 +136,6 @@ module DaytonaApiClient
143
136
  @runner_id = runner_id
144
137
  end
145
138
 
146
- # Custom attribute writer method with validation
147
- # @param [Object] runner_domain Value to be assigned
148
- def runner_domain=(runner_domain)
149
- if runner_domain.nil?
150
- fail ArgumentError, 'runner_domain cannot be nil'
151
- end
152
-
153
- @runner_domain = runner_domain
154
- end
155
-
156
139
  # Checks equality by comparing each attribute.
157
140
  # @param [Object] Object to be compared
158
141
  def ==(o)
@@ -105,6 +105,9 @@ module DaytonaApiClient
105
105
  # The version of the daemon running in the sandbox
106
106
  attr_accessor :daemon_version
107
107
 
108
+ # The runner ID of the sandbox
109
+ attr_accessor :runner_id
110
+
108
111
  class EnumAttributeValidator
109
112
  attr_reader :datatype
110
113
  attr_reader :allowable_values
@@ -159,7 +162,8 @@ module DaytonaApiClient
159
162
  :'created_at' => :'createdAt',
160
163
  :'updated_at' => :'updatedAt',
161
164
  :'_class' => :'class',
162
- :'daemon_version' => :'daemonVersion'
165
+ :'daemon_version' => :'daemonVersion',
166
+ :'runner_id' => :'runnerId'
163
167
  }
164
168
  end
165
169
 
@@ -205,7 +209,8 @@ module DaytonaApiClient
205
209
  :'created_at' => :'String',
206
210
  :'updated_at' => :'String',
207
211
  :'_class' => :'String',
208
- :'daemon_version' => :'String'
212
+ :'daemon_version' => :'String',
213
+ :'runner_id' => :'String'
209
214
  }
210
215
  end
211
216
 
@@ -382,6 +387,10 @@ module DaytonaApiClient
382
387
  if attributes.key?(:'daemon_version')
383
388
  self.daemon_version = attributes[:'daemon_version']
384
389
  end
390
+
391
+ if attributes.key?(:'runner_id')
392
+ self.runner_id = attributes[:'runner_id']
393
+ end
385
394
  end
386
395
 
387
396
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -652,7 +661,8 @@ module DaytonaApiClient
652
661
  created_at == o.created_at &&
653
662
  updated_at == o.updated_at &&
654
663
  _class == o._class &&
655
- daemon_version == o.daemon_version
664
+ daemon_version == o.daemon_version &&
665
+ runner_id == o.runner_id
656
666
  end
657
667
 
658
668
  # @see the `==` method
@@ -664,7 +674,7 @@ module DaytonaApiClient
664
674
  # Calculates hash code according to all attributes.
665
675
  # @return [Integer] Hash code
666
676
  def hash
667
- [id, organization_id, name, snapshot, user, env, labels, public, network_block_all, network_allow_list, target, cpu, gpu, memory, disk, state, desired_state, error_reason, recoverable, backup_state, backup_created_at, auto_stop_interval, auto_archive_interval, auto_delete_interval, volumes, build_info, created_at, updated_at, _class, daemon_version].hash
677
+ [id, organization_id, name, snapshot, user, env, labels, public, network_block_all, network_allow_list, target, cpu, gpu, memory, disk, state, desired_state, error_reason, recoverable, backup_state, backup_created_at, auto_stop_interval, auto_archive_interval, auto_delete_interval, volumes, build_info, created_at, updated_at, _class, daemon_version, runner_id].hash
668
678
  end
669
679
 
670
680
  # Builds the object from hash
@@ -0,0 +1,317 @@
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 SignedPortPreviewUrl
18
+ # ID of the sandbox
19
+ attr_accessor :sandbox_id
20
+
21
+ # Port number of the signed preview URL
22
+ attr_accessor :port
23
+
24
+ # Token of the signed preview URL
25
+ attr_accessor :token
26
+
27
+ # Signed preview url
28
+ attr_accessor :url
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'sandbox_id' => :'sandboxId',
34
+ :'port' => :'port',
35
+ :'token' => :'token',
36
+ :'url' => :'url'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'sandbox_id' => :'String',
54
+ :'port' => :'Integer',
55
+ :'token' => :'String',
56
+ :'url' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::SignedPortPreviewUrl` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::SignedPortPreviewUrl`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'sandbox_id')
83
+ self.sandbox_id = attributes[:'sandbox_id']
84
+ else
85
+ self.sandbox_id = nil
86
+ end
87
+
88
+ if attributes.key?(:'port')
89
+ self.port = attributes[:'port']
90
+ else
91
+ self.port = nil
92
+ end
93
+
94
+ if attributes.key?(:'token')
95
+ self.token = attributes[:'token']
96
+ else
97
+ self.token = nil
98
+ end
99
+
100
+ if attributes.key?(:'url')
101
+ self.url = attributes[:'url']
102
+ else
103
+ self.url = nil
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @sandbox_id.nil?
113
+ invalid_properties.push('invalid value for "sandbox_id", sandbox_id cannot be nil.')
114
+ end
115
+
116
+ if @port.nil?
117
+ invalid_properties.push('invalid value for "port", port cannot be nil.')
118
+ end
119
+
120
+ if @token.nil?
121
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
122
+ end
123
+
124
+ if @url.nil?
125
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ return false if @sandbox_id.nil?
136
+ return false if @port.nil?
137
+ return false if @token.nil?
138
+ return false if @url.nil?
139
+ true
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] sandbox_id Value to be assigned
144
+ def sandbox_id=(sandbox_id)
145
+ if sandbox_id.nil?
146
+ fail ArgumentError, 'sandbox_id cannot be nil'
147
+ end
148
+
149
+ @sandbox_id = sandbox_id
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] port Value to be assigned
154
+ def port=(port)
155
+ if port.nil?
156
+ fail ArgumentError, 'port cannot be nil'
157
+ end
158
+
159
+ @port = port
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] token Value to be assigned
164
+ def token=(token)
165
+ if token.nil?
166
+ fail ArgumentError, 'token cannot be nil'
167
+ end
168
+
169
+ @token = token
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] url Value to be assigned
174
+ def url=(url)
175
+ if url.nil?
176
+ fail ArgumentError, 'url cannot be nil'
177
+ end
178
+
179
+ @url = url
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ sandbox_id == o.sandbox_id &&
188
+ port == o.port &&
189
+ token == o.token &&
190
+ url == o.url
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Integer] Hash code
201
+ def hash
202
+ [sandbox_id, port, token, url].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def self.build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ attributes = attributes.transform_keys(&:to_sym)
211
+ transformed_hash = {}
212
+ openapi_types.each_pair do |key, type|
213
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
214
+ transformed_hash["#{key}"] = nil
215
+ elsif type =~ /\AArray<(.*)>/i
216
+ # check to ensure the input is an array given that the attribute
217
+ # is documented as an array but the input is not
218
+ if attributes[attribute_map[key]].is_a?(Array)
219
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
220
+ end
221
+ elsif !attributes[attribute_map[key]].nil?
222
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
223
+ end
224
+ end
225
+ new(transformed_hash)
226
+ end
227
+
228
+ # Deserializes the data based on type
229
+ # @param string type Data type
230
+ # @param string value Value to be deserialized
231
+ # @return [Object] Deserialized data
232
+ def self._deserialize(type, value)
233
+ case type.to_sym
234
+ when :Time
235
+ Time.parse(value)
236
+ when :Date
237
+ Date.parse(value)
238
+ when :String
239
+ value.to_s
240
+ when :Integer
241
+ value.to_i
242
+ when :Float
243
+ value.to_f
244
+ when :Boolean
245
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
246
+ true
247
+ else
248
+ false
249
+ end
250
+ when :Object
251
+ # generic object (usually a Hash), return directly
252
+ value
253
+ when /\AArray<(?<inner_type>.+)>\z/
254
+ inner_type = Regexp.last_match[:inner_type]
255
+ value.map { |v| _deserialize(inner_type, v) }
256
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
257
+ k_type = Regexp.last_match[:k_type]
258
+ v_type = Regexp.last_match[:v_type]
259
+ {}.tap do |hash|
260
+ value.each do |k, v|
261
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
262
+ end
263
+ end
264
+ else # model
265
+ # models (e.g. Pet) or oneOf
266
+ klass = DaytonaApiClient.const_get(type)
267
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
268
+ end
269
+ end
270
+
271
+ # Returns the string representation of the object
272
+ # @return [String] String presentation of the object
273
+ def to_s
274
+ to_hash.to_s
275
+ end
276
+
277
+ # to_body is an alias to to_hash (backward compatibility)
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_body
280
+ to_hash
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ if value.nil?
290
+ is_nullable = self.class.openapi_nullable.include?(attr)
291
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
292
+ end
293
+
294
+ hash[param] = _to_hash(value)
295
+ end
296
+ hash
297
+ end
298
+
299
+ # Outputs non-array value in the form of hash
300
+ # For object, use to_hash. Otherwise, just return the value
301
+ # @param [Object] value Any valid value
302
+ # @return [Hash] Returns the value in the form of hash
303
+ def _to_hash(value)
304
+ if value.is_a?(Array)
305
+ value.compact.map { |v| _to_hash(v) }
306
+ elsif value.is_a?(Hash)
307
+ {}.tap do |hash|
308
+ value.each { |k, v| hash[k] = _to_hash(v) }
309
+ end
310
+ elsif value.respond_to? :to_hash
311
+ value.to_hash
312
+ else
313
+ value
314
+ end
315
+ end
316
+ end
317
+ end