daytona_api_client 0.216.0 → 0.216.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +15 -16
  3. data/lib/daytona_api_client/api/organizations_api.rb +260 -484
  4. data/lib/daytona_api_client/api/sandbox_api.rb +14 -163
  5. data/lib/daytona_api_client/api/users_api.rb +82 -90
  6. data/lib/daytona_api_client/models/account_provider.rb +48 -19
  7. data/lib/daytona_api_client/models/api_key_list.rb +14 -4
  8. data/lib/daytona_api_client/models/create_runner.rb +37 -4
  9. data/lib/daytona_api_client/models/create_runner_sandbox_class.rb +42 -0
  10. data/lib/daytona_api_client/models/daytona_configuration.rb +45 -1
  11. data/lib/daytona_api_client/models/{organization_preview_warning.rb → generate_workos_admin_portal_link.rb} +42 -20
  12. data/lib/daytona_api_client/models/{send_webhook_dto.rb → gpu_capacity.rb} +77 -43
  13. data/lib/daytona_api_client/models/{organization_sso_enabled.rb → gpu_capacity_response.rb} +48 -20
  14. data/lib/daytona_api_client/models/oidc_config.rb +65 -4
  15. data/lib/daytona_api_client/models/organization.rb +38 -1
  16. data/lib/daytona_api_client/models/sandbox_created_webhook.rb +349 -0
  17. data/lib/daytona_api_client/models/{organization_sandbox_default_limited_network_egress.rb → sandbox_identity.rb} +47 -20
  18. data/lib/daytona_api_client/models/sandbox_state_updated_webhook.rb +349 -0
  19. data/lib/daytona_api_client/models/snapshot_created_webhook.rb +349 -0
  20. data/lib/daytona_api_client/models/{create_user.rb → snapshot_removed_webhook.rb} +119 -71
  21. data/lib/daytona_api_client/models/snapshot_state_updated_webhook.rb +376 -0
  22. data/lib/daytona_api_client/models/user.rb +11 -1
  23. data/lib/daytona_api_client/models/volume_created_webhook.rb +349 -0
  24. data/lib/daytona_api_client/models/volume_state_updated_webhook.rb +376 -0
  25. data/lib/daytona_api_client/models/workos_admin_portal_intent.rb +41 -0
  26. data/lib/daytona_api_client/models/{set_snapshot_general_status_dto.rb → workos_admin_portal_link.rb} +20 -20
  27. data/lib/daytona_api_client/models/{admin_create_runner.rb → workos_sso_connection.rb} +123 -120
  28. data/lib/daytona_api_client/version.rb +1 -1
  29. data/lib/daytona_api_client.rb +15 -16
  30. metadata +16 -17
  31. data/lib/daytona_api_client/api/admin_api.rb +0 -1618
  32. data/lib/daytona_api_client/models/admin_create_organization.rb +0 -219
  33. data/lib/daytona_api_client/models/admin_get_webhook_status200_response.rb +0 -147
  34. data/lib/daytona_api_client/models/create_organization_quota.rb +0 -238
  35. data/lib/daytona_api_client/models/create_organization_region_quota.rb +0 -386
  36. data/lib/daytona_api_client/models/organization_suspension.rb +0 -221
  37. data/lib/daytona_api_client/models/paginated_sandboxes_deprecated.rb +0 -244
  38. data/lib/daytona_api_client/models/update_organization_quota.rb +0 -333
  39. data/lib/daytona_api_client/models/update_organization_region_quota.rb +0 -313
@@ -1,386 +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.21.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class CreateOrganizationRegionQuota < ApiModelBase
18
- attr_accessor :sandbox_class
19
-
20
- attr_accessor :total_cpu_quota
21
-
22
- attr_accessor :total_memory_quota
23
-
24
- attr_accessor :total_disk_quota
25
-
26
- attr_accessor :total_gpu_quota
27
-
28
- attr_accessor :allowed_gpu_types
29
-
30
- attr_accessor :max_cpu_per_sandbox
31
-
32
- attr_accessor :max_memory_per_sandbox
33
-
34
- attr_accessor :max_disk_per_sandbox
35
-
36
- attr_accessor :max_disk_per_non_ephemeral_sandbox
37
-
38
- # CPU maximum per requested GPU unit for GPU sandboxes.
39
- attr_accessor :max_cpu_per_gpu
40
-
41
- # Memory maximum per requested GPU unit for GPU sandboxes.
42
- attr_accessor :max_memory_per_gpu
43
-
44
- # Disk maximum per requested GPU unit for GPU sandboxes.
45
- attr_accessor :max_disk_per_gpu
46
-
47
- # Maximum sandbox lifespan in minutes, measured from sandbox creation to its auto-destroy deadline. If null or 0, lifespan is unrestricted. When set, sandboxes created without a TTL default to this lifespan and TTL cannot be disabled.
48
- attr_accessor :max_sandbox_lifespan
49
-
50
- class EnumAttributeValidator
51
- attr_reader :datatype
52
- attr_reader :allowable_values
53
-
54
- def initialize(datatype, allowable_values)
55
- @allowable_values = allowable_values.map do |value|
56
- case datatype.to_s
57
- when /Integer/i
58
- value.to_i
59
- when /Float/i
60
- value.to_f
61
- else
62
- value
63
- end
64
- end
65
- end
66
-
67
- def valid?(value)
68
- !value || allowable_values.include?(value)
69
- end
70
- end
71
-
72
- # Attribute mapping from ruby-style variable name to JSON key.
73
- def self.attribute_map
74
- {
75
- :'sandbox_class' => :'sandboxClass',
76
- :'total_cpu_quota' => :'totalCpuQuota',
77
- :'total_memory_quota' => :'totalMemoryQuota',
78
- :'total_disk_quota' => :'totalDiskQuota',
79
- :'total_gpu_quota' => :'totalGpuQuota',
80
- :'allowed_gpu_types' => :'allowedGpuTypes',
81
- :'max_cpu_per_sandbox' => :'maxCpuPerSandbox',
82
- :'max_memory_per_sandbox' => :'maxMemoryPerSandbox',
83
- :'max_disk_per_sandbox' => :'maxDiskPerSandbox',
84
- :'max_disk_per_non_ephemeral_sandbox' => :'maxDiskPerNonEphemeralSandbox',
85
- :'max_cpu_per_gpu' => :'maxCpuPerGpu',
86
- :'max_memory_per_gpu' => :'maxMemoryPerGpu',
87
- :'max_disk_per_gpu' => :'maxDiskPerGpu',
88
- :'max_sandbox_lifespan' => :'maxSandboxLifespan'
89
- }
90
- end
91
-
92
- # Returns attribute mapping this model knows about
93
- def self.acceptable_attribute_map
94
- attribute_map
95
- end
96
-
97
- # Returns all the JSON keys this model knows about
98
- def self.acceptable_attributes
99
- acceptable_attribute_map.values
100
- end
101
-
102
- # Attribute type mapping.
103
- def self.openapi_types
104
- {
105
- :'sandbox_class' => :'SandboxClass',
106
- :'total_cpu_quota' => :'Float',
107
- :'total_memory_quota' => :'Float',
108
- :'total_disk_quota' => :'Float',
109
- :'total_gpu_quota' => :'Float',
110
- :'allowed_gpu_types' => :'Array<GpuType>',
111
- :'max_cpu_per_sandbox' => :'Float',
112
- :'max_memory_per_sandbox' => :'Float',
113
- :'max_disk_per_sandbox' => :'Float',
114
- :'max_disk_per_non_ephemeral_sandbox' => :'Float',
115
- :'max_cpu_per_gpu' => :'Float',
116
- :'max_memory_per_gpu' => :'Float',
117
- :'max_disk_per_gpu' => :'Float',
118
- :'max_sandbox_lifespan' => :'Float'
119
- }
120
- end
121
-
122
- # List of attributes with nullable: true
123
- def self.openapi_nullable
124
- Set.new([
125
- :'allowed_gpu_types',
126
- :'max_cpu_per_sandbox',
127
- :'max_memory_per_sandbox',
128
- :'max_disk_per_sandbox',
129
- :'max_disk_per_non_ephemeral_sandbox',
130
- :'max_cpu_per_gpu',
131
- :'max_memory_per_gpu',
132
- :'max_disk_per_gpu',
133
- :'max_sandbox_lifespan'
134
- ])
135
- end
136
-
137
- # Initializes the object
138
- # @param [Hash] attributes Model attributes in the form of hash
139
- def initialize(attributes = {})
140
- if (!attributes.is_a?(Hash))
141
- fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::CreateOrganizationRegionQuota` initialize method"
142
- end
143
-
144
- # check to see if the attribute exists and convert string to symbol for hash key
145
- acceptable_attribute_map = self.class.acceptable_attribute_map
146
- attributes = attributes.each_with_object({}) { |(k, v), h|
147
- if (!acceptable_attribute_map.key?(k.to_sym))
148
- fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::CreateOrganizationRegionQuota`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
149
- end
150
- h[k.to_sym] = v
151
- }
152
-
153
- if attributes.key?(:'sandbox_class')
154
- self.sandbox_class = attributes[:'sandbox_class']
155
- else
156
- self.sandbox_class = nil
157
- end
158
-
159
- if attributes.key?(:'total_cpu_quota')
160
- self.total_cpu_quota = attributes[:'total_cpu_quota']
161
- else
162
- self.total_cpu_quota = nil
163
- end
164
-
165
- if attributes.key?(:'total_memory_quota')
166
- self.total_memory_quota = attributes[:'total_memory_quota']
167
- else
168
- self.total_memory_quota = nil
169
- end
170
-
171
- if attributes.key?(:'total_disk_quota')
172
- self.total_disk_quota = attributes[:'total_disk_quota']
173
- else
174
- self.total_disk_quota = nil
175
- end
176
-
177
- if attributes.key?(:'total_gpu_quota')
178
- self.total_gpu_quota = attributes[:'total_gpu_quota']
179
- else
180
- self.total_gpu_quota = nil
181
- end
182
-
183
- if attributes.key?(:'allowed_gpu_types')
184
- if (value = attributes[:'allowed_gpu_types']).is_a?(Array)
185
- self.allowed_gpu_types = value
186
- end
187
- end
188
-
189
- if attributes.key?(:'max_cpu_per_sandbox')
190
- self.max_cpu_per_sandbox = attributes[:'max_cpu_per_sandbox']
191
- end
192
-
193
- if attributes.key?(:'max_memory_per_sandbox')
194
- self.max_memory_per_sandbox = attributes[:'max_memory_per_sandbox']
195
- end
196
-
197
- if attributes.key?(:'max_disk_per_sandbox')
198
- self.max_disk_per_sandbox = attributes[:'max_disk_per_sandbox']
199
- end
200
-
201
- if attributes.key?(:'max_disk_per_non_ephemeral_sandbox')
202
- self.max_disk_per_non_ephemeral_sandbox = attributes[:'max_disk_per_non_ephemeral_sandbox']
203
- end
204
-
205
- if attributes.key?(:'max_cpu_per_gpu')
206
- self.max_cpu_per_gpu = attributes[:'max_cpu_per_gpu']
207
- end
208
-
209
- if attributes.key?(:'max_memory_per_gpu')
210
- self.max_memory_per_gpu = attributes[:'max_memory_per_gpu']
211
- end
212
-
213
- if attributes.key?(:'max_disk_per_gpu')
214
- self.max_disk_per_gpu = attributes[:'max_disk_per_gpu']
215
- end
216
-
217
- if attributes.key?(:'max_sandbox_lifespan')
218
- self.max_sandbox_lifespan = attributes[:'max_sandbox_lifespan']
219
- end
220
- end
221
-
222
- # Show invalid properties with the reasons. Usually used together with valid?
223
- # @return Array for valid properties with the reasons
224
- def list_invalid_properties
225
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
226
- invalid_properties = Array.new
227
- if @sandbox_class.nil?
228
- invalid_properties.push('invalid value for "sandbox_class", sandbox_class cannot be nil.')
229
- end
230
-
231
- if @total_cpu_quota.nil?
232
- invalid_properties.push('invalid value for "total_cpu_quota", total_cpu_quota cannot be nil.')
233
- end
234
-
235
- if @total_memory_quota.nil?
236
- invalid_properties.push('invalid value for "total_memory_quota", total_memory_quota cannot be nil.')
237
- end
238
-
239
- if @total_disk_quota.nil?
240
- invalid_properties.push('invalid value for "total_disk_quota", total_disk_quota cannot be nil.')
241
- end
242
-
243
- if @total_gpu_quota.nil?
244
- invalid_properties.push('invalid value for "total_gpu_quota", total_gpu_quota cannot be nil.')
245
- end
246
-
247
- invalid_properties
248
- end
249
-
250
- # Check to see if the all the properties in the model are valid
251
- # @return true if the model is valid
252
- def valid?
253
- warn '[DEPRECATED] the `valid?` method is obsolete'
254
- return false if @sandbox_class.nil?
255
- return false if @total_cpu_quota.nil?
256
- return false if @total_memory_quota.nil?
257
- return false if @total_disk_quota.nil?
258
- return false if @total_gpu_quota.nil?
259
- true
260
- end
261
-
262
- # Custom attribute writer method with validation
263
- # @param [Object] sandbox_class Value to be assigned
264
- def sandbox_class=(sandbox_class)
265
- if sandbox_class.nil?
266
- fail ArgumentError, 'sandbox_class cannot be nil'
267
- end
268
-
269
- @sandbox_class = sandbox_class
270
- end
271
-
272
- # Custom attribute writer method with validation
273
- # @param [Object] total_cpu_quota Value to be assigned
274
- def total_cpu_quota=(total_cpu_quota)
275
- if total_cpu_quota.nil?
276
- fail ArgumentError, 'total_cpu_quota cannot be nil'
277
- end
278
-
279
- @total_cpu_quota = total_cpu_quota
280
- end
281
-
282
- # Custom attribute writer method with validation
283
- # @param [Object] total_memory_quota Value to be assigned
284
- def total_memory_quota=(total_memory_quota)
285
- if total_memory_quota.nil?
286
- fail ArgumentError, 'total_memory_quota cannot be nil'
287
- end
288
-
289
- @total_memory_quota = total_memory_quota
290
- end
291
-
292
- # Custom attribute writer method with validation
293
- # @param [Object] total_disk_quota Value to be assigned
294
- def total_disk_quota=(total_disk_quota)
295
- if total_disk_quota.nil?
296
- fail ArgumentError, 'total_disk_quota cannot be nil'
297
- end
298
-
299
- @total_disk_quota = total_disk_quota
300
- end
301
-
302
- # Custom attribute writer method with validation
303
- # @param [Object] total_gpu_quota Value to be assigned
304
- def total_gpu_quota=(total_gpu_quota)
305
- if total_gpu_quota.nil?
306
- fail ArgumentError, 'total_gpu_quota cannot be nil'
307
- end
308
-
309
- @total_gpu_quota = total_gpu_quota
310
- end
311
-
312
- # Checks equality by comparing each attribute.
313
- # @param [Object] Object to be compared
314
- def ==(o)
315
- return true if self.equal?(o)
316
- self.class == o.class &&
317
- sandbox_class == o.sandbox_class &&
318
- total_cpu_quota == o.total_cpu_quota &&
319
- total_memory_quota == o.total_memory_quota &&
320
- total_disk_quota == o.total_disk_quota &&
321
- total_gpu_quota == o.total_gpu_quota &&
322
- allowed_gpu_types == o.allowed_gpu_types &&
323
- max_cpu_per_sandbox == o.max_cpu_per_sandbox &&
324
- max_memory_per_sandbox == o.max_memory_per_sandbox &&
325
- max_disk_per_sandbox == o.max_disk_per_sandbox &&
326
- max_disk_per_non_ephemeral_sandbox == o.max_disk_per_non_ephemeral_sandbox &&
327
- max_cpu_per_gpu == o.max_cpu_per_gpu &&
328
- max_memory_per_gpu == o.max_memory_per_gpu &&
329
- max_disk_per_gpu == o.max_disk_per_gpu &&
330
- max_sandbox_lifespan == o.max_sandbox_lifespan
331
- end
332
-
333
- # @see the `==` method
334
- # @param [Object] Object to be compared
335
- def eql?(o)
336
- self == o
337
- end
338
-
339
- # Calculates hash code according to all attributes.
340
- # @return [Integer] Hash code
341
- def hash
342
- [sandbox_class, total_cpu_quota, total_memory_quota, total_disk_quota, total_gpu_quota, allowed_gpu_types, max_cpu_per_sandbox, max_memory_per_sandbox, max_disk_per_sandbox, max_disk_per_non_ephemeral_sandbox, max_cpu_per_gpu, max_memory_per_gpu, max_disk_per_gpu, max_sandbox_lifespan].hash
343
- end
344
-
345
- # Builds the object from hash
346
- # @param [Hash] attributes Model attributes in the form of hash
347
- # @return [Object] Returns the model itself
348
- def self.build_from_hash(attributes)
349
- return nil unless attributes.is_a?(Hash)
350
- attributes = attributes.transform_keys(&:to_sym)
351
- transformed_hash = {}
352
- openapi_types.each_pair do |key, type|
353
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
354
- transformed_hash["#{key}"] = nil
355
- elsif type =~ /\AArray<(.*)>/i
356
- # check to ensure the input is an array given that the attribute
357
- # is documented as an array but the input is not
358
- if attributes[attribute_map[key]].is_a?(Array)
359
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
360
- end
361
- elsif !attributes[attribute_map[key]].nil?
362
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
363
- end
364
- end
365
- new(transformed_hash)
366
- end
367
-
368
- # Returns the object in the form of hash
369
- # @return [Hash] Returns the object in the form of hash
370
- def to_hash
371
- hash = {}
372
- self.class.attribute_map.each_pair do |attr, param|
373
- value = self.send(attr)
374
- if value.nil?
375
- is_nullable = self.class.openapi_nullable.include?(attr)
376
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
377
- end
378
-
379
- hash[param] = _to_hash(value)
380
- end
381
- hash
382
- end
383
-
384
- end
385
-
386
- end
@@ -1,221 +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.21.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class OrganizationSuspension < ApiModelBase
18
- # Suspension reason
19
- attr_accessor :reason
20
-
21
- # Suspension until
22
- attr_accessor :_until
23
-
24
- # Suspension cleanup grace period hours
25
- attr_accessor :suspension_cleanup_grace_period_hours
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'reason' => :'reason',
31
- :'_until' => :'until',
32
- :'suspension_cleanup_grace_period_hours' => :'suspensionCleanupGracePeriodHours'
33
- }
34
- end
35
-
36
- # Returns attribute mapping this model knows about
37
- def self.acceptable_attribute_map
38
- attribute_map
39
- end
40
-
41
- # Returns all the JSON keys this model knows about
42
- def self.acceptable_attributes
43
- acceptable_attribute_map.values
44
- end
45
-
46
- # Attribute type mapping.
47
- def self.openapi_types
48
- {
49
- :'reason' => :'String',
50
- :'_until' => :'Time',
51
- :'suspension_cleanup_grace_period_hours' => :'Float'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::OrganizationSuspension` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- acceptable_attribute_map = self.class.acceptable_attribute_map
70
- attributes = attributes.each_with_object({}) { |(k, v), h|
71
- if (!acceptable_attribute_map.key?(k.to_sym))
72
- fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::OrganizationSuspension`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
- end
74
- h[k.to_sym] = v
75
- }
76
-
77
- if attributes.key?(:'reason')
78
- self.reason = attributes[:'reason']
79
- else
80
- self.reason = nil
81
- end
82
-
83
- if attributes.key?(:'_until')
84
- self._until = attributes[:'_until']
85
- else
86
- self._until = nil
87
- end
88
-
89
- if attributes.key?(:'suspension_cleanup_grace_period_hours')
90
- self.suspension_cleanup_grace_period_hours = attributes[:'suspension_cleanup_grace_period_hours']
91
- end
92
- end
93
-
94
- # Show invalid properties with the reasons. Usually used together with valid?
95
- # @return Array for valid properties with the reasons
96
- def list_invalid_properties
97
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
- invalid_properties = Array.new
99
- if @reason.nil?
100
- invalid_properties.push('invalid value for "reason", reason cannot be nil.')
101
- end
102
-
103
- if @_until.nil?
104
- invalid_properties.push('invalid value for "_until", _until cannot be nil.')
105
- end
106
-
107
- if !@suspension_cleanup_grace_period_hours.nil? && @suspension_cleanup_grace_period_hours < 0
108
- invalid_properties.push('invalid value for "suspension_cleanup_grace_period_hours", must be greater than or equal to 0.')
109
- end
110
-
111
- invalid_properties
112
- end
113
-
114
- # Check to see if the all the properties in the model are valid
115
- # @return true if the model is valid
116
- def valid?
117
- warn '[DEPRECATED] the `valid?` method is obsolete'
118
- return false if @reason.nil?
119
- return false if @_until.nil?
120
- return false if !@suspension_cleanup_grace_period_hours.nil? && @suspension_cleanup_grace_period_hours < 0
121
- true
122
- end
123
-
124
- # Custom attribute writer method with validation
125
- # @param [Object] reason Value to be assigned
126
- def reason=(reason)
127
- if reason.nil?
128
- fail ArgumentError, 'reason cannot be nil'
129
- end
130
-
131
- @reason = reason
132
- end
133
-
134
- # Custom attribute writer method with validation
135
- # @param [Object] _until Value to be assigned
136
- def _until=(_until)
137
- if _until.nil?
138
- fail ArgumentError, '_until cannot be nil'
139
- end
140
-
141
- @_until = _until
142
- end
143
-
144
- # Custom attribute writer method with validation
145
- # @param [Object] suspension_cleanup_grace_period_hours Value to be assigned
146
- def suspension_cleanup_grace_period_hours=(suspension_cleanup_grace_period_hours)
147
- if suspension_cleanup_grace_period_hours.nil?
148
- fail ArgumentError, 'suspension_cleanup_grace_period_hours cannot be nil'
149
- end
150
-
151
- if suspension_cleanup_grace_period_hours < 0
152
- fail ArgumentError, 'invalid value for "suspension_cleanup_grace_period_hours", must be greater than or equal to 0.'
153
- end
154
-
155
- @suspension_cleanup_grace_period_hours = suspension_cleanup_grace_period_hours
156
- end
157
-
158
- # Checks equality by comparing each attribute.
159
- # @param [Object] Object to be compared
160
- def ==(o)
161
- return true if self.equal?(o)
162
- self.class == o.class &&
163
- reason == o.reason &&
164
- _until == o._until &&
165
- suspension_cleanup_grace_period_hours == o.suspension_cleanup_grace_period_hours
166
- end
167
-
168
- # @see the `==` method
169
- # @param [Object] Object to be compared
170
- def eql?(o)
171
- self == o
172
- end
173
-
174
- # Calculates hash code according to all attributes.
175
- # @return [Integer] Hash code
176
- def hash
177
- [reason, _until, suspension_cleanup_grace_period_hours].hash
178
- end
179
-
180
- # Builds the object from hash
181
- # @param [Hash] attributes Model attributes in the form of hash
182
- # @return [Object] Returns the model itself
183
- def self.build_from_hash(attributes)
184
- return nil unless attributes.is_a?(Hash)
185
- attributes = attributes.transform_keys(&:to_sym)
186
- transformed_hash = {}
187
- openapi_types.each_pair do |key, type|
188
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
189
- transformed_hash["#{key}"] = nil
190
- elsif type =~ /\AArray<(.*)>/i
191
- # check to ensure the input is an array given that the attribute
192
- # is documented as an array but the input is not
193
- if attributes[attribute_map[key]].is_a?(Array)
194
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
195
- end
196
- elsif !attributes[attribute_map[key]].nil?
197
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
198
- end
199
- end
200
- new(transformed_hash)
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- if value.nil?
210
- is_nullable = self.class.openapi_nullable.include?(attr)
211
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
- end
213
-
214
- hash[param] = _to_hash(value)
215
- end
216
- hash
217
- end
218
-
219
- end
220
-
221
- end