daytona_api_client 0.134.0.alpha.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +101 -0
  4. data/daytona_api_client.gemspec +2 -2
  5. data/lib/daytona_api_client/api/audit_api.rb +66 -18
  6. data/lib/daytona_api_client/api/docker_registry_api.rb +0 -3
  7. data/lib/daytona_api_client/api/organizations_api.rb +29 -754
  8. data/lib/daytona_api_client/api/preview_api.rb +5 -74
  9. data/lib/daytona_api_client/api/runners_api.rb +20 -343
  10. data/lib/daytona_api_client/api/sandbox_api.rb +194 -558
  11. data/lib/daytona_api_client/api/snapshots_api.rb +0 -66
  12. data/lib/daytona_api_client/api/toolbox_api.rb +711 -711
  13. data/lib/daytona_api_client/api/workspace_api.rb +3 -3
  14. data/lib/daytona_api_client/models/build_info.rb +4 -31
  15. data/lib/daytona_api_client/models/{job.rb → create_audit_log.rb} +79 -166
  16. data/lib/daytona_api_client/models/create_organization.rb +4 -31
  17. data/lib/daytona_api_client/models/create_runner.rb +315 -31
  18. data/lib/daytona_api_client/models/create_sandbox.rb +1 -11
  19. data/lib/daytona_api_client/models/create_snapshot.rb +4 -14
  20. data/lib/daytona_api_client/models/create_user.rb +1 -10
  21. data/lib/daytona_api_client/models/daytona_configuration.rb +4 -41
  22. data/lib/daytona_api_client/models/organization.rb +85 -53
  23. data/lib/daytona_api_client/models/organization_usage_overview.rb +146 -18
  24. data/lib/daytona_api_client/models/paginated_audit_logs.rb +4 -14
  25. data/lib/daytona_api_client/models/{paginated_jobs.rb → paginated_snapshots_dto.rb} +4 -4
  26. data/lib/daytona_api_client/models/port_preview_url.rb +14 -31
  27. data/lib/daytona_api_client/models/region.rb +4 -178
  28. data/lib/daytona_api_client/models/runner.rb +117 -79
  29. data/lib/daytona_api_client/models/runner_snapshot_dto.rb +17 -0
  30. data/lib/daytona_api_client/models/sandbox.rb +14 -51
  31. data/lib/daytona_api_client/models/sandbox_volume.rb +4 -14
  32. data/lib/daytona_api_client/models/snapshot_dto.rb +4 -36
  33. data/lib/daytona_api_client/models/snapshot_state.rb +4 -1
  34. data/lib/daytona_api_client/models/ssh_access_dto.rb +4 -31
  35. data/lib/daytona_api_client/models/ssh_access_validation_dto.rb +24 -4
  36. data/lib/daytona_api_client/models/update_organization_quota.rb +41 -41
  37. data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +4 -24
  38. data/lib/daytona_api_client/models/workspace.rb +35 -45
  39. data/lib/daytona_api_client/version.rb +1 -1
  40. data/lib/daytona_api_client.rb +1 -30
  41. data/project.json +6 -34
  42. metadata +5 -38
  43. data/.gitignore +0 -39
  44. data/.openapi-generator/FILES +0 -194
  45. data/.openapi-generator/VERSION +0 -1
  46. data/.openapi-generator-ignore +0 -31
  47. data/.rspec +0 -2
  48. data/.rubocop.yml +0 -148
  49. data/fix-gemspec.sh +0 -11
  50. data/lib/daytona_api_client/api/admin_api.rb +0 -325
  51. data/lib/daytona_api_client/api/jobs_api.rb +0 -299
  52. data/lib/daytona_api_client/api/regions_api.rb +0 -77
  53. data/lib/daytona_api_client/models/admin_create_runner.rb +0 -385
  54. data/lib/daytona_api_client/models/create_region.rb +0 -269
  55. data/lib/daytona_api_client/models/create_region_response.rb +0 -280
  56. data/lib/daytona_api_client/models/create_runner_response.rb +0 -263
  57. data/lib/daytona_api_client/models/job_status.rb +0 -42
  58. data/lib/daytona_api_client/models/job_type.rb +0 -49
  59. data/lib/daytona_api_client/models/poll_jobs_response.rb +0 -238
  60. data/lib/daytona_api_client/models/rate_limit_config.rb +0 -249
  61. data/lib/daytona_api_client/models/rate_limit_entry.rb +0 -229
  62. data/lib/daytona_api_client/models/regenerate_api_key_response.rb +0 -236
  63. data/lib/daytona_api_client/models/region_quota.rb +0 -339
  64. data/lib/daytona_api_client/models/region_type.rb +0 -41
  65. data/lib/daytona_api_client/models/region_usage_overview.rb +0 -391
  66. data/lib/daytona_api_client/models/runner_full.rb +0 -779
  67. data/lib/daytona_api_client/models/runner_health_metrics.rb +0 -533
  68. data/lib/daytona_api_client/models/runner_healthcheck.rb +0 -276
  69. data/lib/daytona_api_client/models/signed_port_preview_url.rb +0 -317
  70. data/lib/daytona_api_client/models/snapshot_manager_credentials.rb +0 -263
  71. data/lib/daytona_api_client/models/toolbox_proxy_url.rb +0 -236
  72. data/lib/daytona_api_client/models/update_job_status.rb +0 -278
  73. data/lib/daytona_api_client/models/update_organization_default_region.rb +0 -236
  74. data/lib/daytona_api_client/models/update_organization_region_quota.rb +0 -245
  75. data/lib/daytona_api_client/models/update_region.rb +0 -242
  76. data/lib/daytona_api_client/models/url.rb +0 -236
  77. data/lib/daytona_api_client/models/workspace_port_preview_url.rb +0 -263
@@ -1,238 +0,0 @@
1
- =begin
2
- #Daytona
3
-
4
- #Daytona AI platform API Docs
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@daytona.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.12.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class PollJobsResponse
18
- # List of jobs
19
- attr_accessor :jobs
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'jobs' => :'jobs'
25
- }
26
- end
27
-
28
- # Returns attribute mapping this model knows about
29
- def self.acceptable_attribute_map
30
- attribute_map
31
- end
32
-
33
- # Returns all the JSON keys this model knows about
34
- def self.acceptable_attributes
35
- acceptable_attribute_map.values
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.openapi_types
40
- {
41
- :'jobs' => :'Array<Job>'
42
- }
43
- end
44
-
45
- # List of attributes with nullable: true
46
- def self.openapi_nullable
47
- Set.new([
48
- ])
49
- end
50
-
51
- # Initializes the object
52
- # @param [Hash] attributes Model attributes in the form of hash
53
- def initialize(attributes = {})
54
- if (!attributes.is_a?(Hash))
55
- fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::PollJobsResponse` initialize method"
56
- end
57
-
58
- # check to see if the attribute exists and convert string to symbol for hash key
59
- acceptable_attribute_map = self.class.acceptable_attribute_map
60
- attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!acceptable_attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::PollJobsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
- end
64
- h[k.to_sym] = v
65
- }
66
-
67
- if attributes.key?(:'jobs')
68
- if (value = attributes[:'jobs']).is_a?(Array)
69
- self.jobs = value
70
- end
71
- else
72
- self.jobs = nil
73
- end
74
- end
75
-
76
- # Show invalid properties with the reasons. Usually used together with valid?
77
- # @return Array for valid properties with the reasons
78
- def list_invalid_properties
79
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
- invalid_properties = Array.new
81
- if @jobs.nil?
82
- invalid_properties.push('invalid value for "jobs", jobs cannot be nil.')
83
- end
84
-
85
- invalid_properties
86
- end
87
-
88
- # Check to see if the all the properties in the model are valid
89
- # @return true if the model is valid
90
- def valid?
91
- warn '[DEPRECATED] the `valid?` method is obsolete'
92
- return false if @jobs.nil?
93
- true
94
- end
95
-
96
- # Custom attribute writer method with validation
97
- # @param [Object] jobs Value to be assigned
98
- def jobs=(jobs)
99
- if jobs.nil?
100
- fail ArgumentError, 'jobs cannot be nil'
101
- end
102
-
103
- @jobs = jobs
104
- end
105
-
106
- # Checks equality by comparing each attribute.
107
- # @param [Object] Object to be compared
108
- def ==(o)
109
- return true if self.equal?(o)
110
- self.class == o.class &&
111
- jobs == o.jobs
112
- end
113
-
114
- # @see the `==` method
115
- # @param [Object] Object to be compared
116
- def eql?(o)
117
- self == o
118
- end
119
-
120
- # Calculates hash code according to all attributes.
121
- # @return [Integer] Hash code
122
- def hash
123
- [jobs].hash
124
- end
125
-
126
- # Builds the object from hash
127
- # @param [Hash] attributes Model attributes in the form of hash
128
- # @return [Object] Returns the model itself
129
- def self.build_from_hash(attributes)
130
- return nil unless attributes.is_a?(Hash)
131
- attributes = attributes.transform_keys(&:to_sym)
132
- transformed_hash = {}
133
- openapi_types.each_pair do |key, type|
134
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
- transformed_hash["#{key}"] = nil
136
- elsif type =~ /\AArray<(.*)>/i
137
- # check to ensure the input is an array given that the attribute
138
- # is documented as an array but the input is not
139
- if attributes[attribute_map[key]].is_a?(Array)
140
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
- end
142
- elsif !attributes[attribute_map[key]].nil?
143
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
- end
145
- end
146
- new(transformed_hash)
147
- end
148
-
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def self._deserialize(type, value)
154
- case type.to_sym
155
- when :Time
156
- Time.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :Boolean
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
- when :Object
172
- # generic object (usually a Hash), return directly
173
- value
174
- when /\AArray<(?<inner_type>.+)>\z/
175
- inner_type = Regexp.last_match[:inner_type]
176
- value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
- k_type = Regexp.last_match[:k_type]
179
- v_type = Regexp.last_match[:v_type]
180
- {}.tap do |hash|
181
- value.each do |k, v|
182
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
- end
184
- end
185
- else # model
186
- # models (e.g. Pet) or oneOf
187
- klass = DaytonaApiClient.const_get(type)
188
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
- end
190
- end
191
-
192
- # Returns the string representation of the object
193
- # @return [String] String presentation of the object
194
- def to_s
195
- to_hash.to_s
196
- end
197
-
198
- # to_body is an alias to to_hash (backward compatibility)
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_body
201
- to_hash
202
- end
203
-
204
- # Returns the object in the form of hash
205
- # @return [Hash] Returns the object in the form of hash
206
- def to_hash
207
- hash = {}
208
- self.class.attribute_map.each_pair do |attr, param|
209
- value = self.send(attr)
210
- if value.nil?
211
- is_nullable = self.class.openapi_nullable.include?(attr)
212
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
- end
214
-
215
- hash[param] = _to_hash(value)
216
- end
217
- hash
218
- end
219
-
220
- # Outputs non-array value in the form of hash
221
- # For object, use to_hash. Otherwise, just return the value
222
- # @param [Object] value Any valid value
223
- # @return [Hash] Returns the value in the form of hash
224
- def _to_hash(value)
225
- if value.is_a?(Array)
226
- value.compact.map { |v| _to_hash(v) }
227
- elsif value.is_a?(Hash)
228
- {}.tap do |hash|
229
- value.each { |k, v| hash[k] = _to_hash(v) }
230
- end
231
- elsif value.respond_to? :to_hash
232
- value.to_hash
233
- else
234
- value
235
- end
236
- end
237
- end
238
- end
@@ -1,249 +0,0 @@
1
- =begin
2
- #Daytona
3
-
4
- #Daytona AI platform API Docs
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@daytona.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.12.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class RateLimitConfig
18
- # Failed authentication rate limit
19
- attr_accessor :failed_auth
20
-
21
- # Authenticated rate limit
22
- attr_accessor :authenticated
23
-
24
- # Sandbox create rate limit
25
- attr_accessor :sandbox_create
26
-
27
- # Sandbox lifecycle rate limit
28
- attr_accessor :sandbox_lifecycle
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'failed_auth' => :'failedAuth',
34
- :'authenticated' => :'authenticated',
35
- :'sandbox_create' => :'sandboxCreate',
36
- :'sandbox_lifecycle' => :'sandboxLifecycle'
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
- :'failed_auth' => :'RateLimitEntry',
54
- :'authenticated' => :'RateLimitEntry',
55
- :'sandbox_create' => :'RateLimitEntry',
56
- :'sandbox_lifecycle' => :'RateLimitEntry'
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::RateLimitConfig` 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::RateLimitConfig`. 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?(:'failed_auth')
83
- self.failed_auth = attributes[:'failed_auth']
84
- end
85
-
86
- if attributes.key?(:'authenticated')
87
- self.authenticated = attributes[:'authenticated']
88
- end
89
-
90
- if attributes.key?(:'sandbox_create')
91
- self.sandbox_create = attributes[:'sandbox_create']
92
- end
93
-
94
- if attributes.key?(:'sandbox_lifecycle')
95
- self.sandbox_lifecycle = attributes[:'sandbox_lifecycle']
96
- end
97
- end
98
-
99
- # Show invalid properties with the reasons. Usually used together with valid?
100
- # @return Array for valid properties with the reasons
101
- def list_invalid_properties
102
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
- invalid_properties = Array.new
104
- invalid_properties
105
- end
106
-
107
- # Check to see if the all the properties in the model are valid
108
- # @return true if the model is valid
109
- def valid?
110
- warn '[DEPRECATED] the `valid?` method is obsolete'
111
- true
112
- end
113
-
114
- # Checks equality by comparing each attribute.
115
- # @param [Object] Object to be compared
116
- def ==(o)
117
- return true if self.equal?(o)
118
- self.class == o.class &&
119
- failed_auth == o.failed_auth &&
120
- authenticated == o.authenticated &&
121
- sandbox_create == o.sandbox_create &&
122
- sandbox_lifecycle == o.sandbox_lifecycle
123
- end
124
-
125
- # @see the `==` method
126
- # @param [Object] Object to be compared
127
- def eql?(o)
128
- self == o
129
- end
130
-
131
- # Calculates hash code according to all attributes.
132
- # @return [Integer] Hash code
133
- def hash
134
- [failed_auth, authenticated, sandbox_create, sandbox_lifecycle].hash
135
- end
136
-
137
- # Builds the object from hash
138
- # @param [Hash] attributes Model attributes in the form of hash
139
- # @return [Object] Returns the model itself
140
- def self.build_from_hash(attributes)
141
- return nil unless attributes.is_a?(Hash)
142
- attributes = attributes.transform_keys(&:to_sym)
143
- transformed_hash = {}
144
- openapi_types.each_pair do |key, type|
145
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
146
- transformed_hash["#{key}"] = nil
147
- elsif type =~ /\AArray<(.*)>/i
148
- # check to ensure the input is an array given that the attribute
149
- # is documented as an array but the input is not
150
- if attributes[attribute_map[key]].is_a?(Array)
151
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
- end
153
- elsif !attributes[attribute_map[key]].nil?
154
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
155
- end
156
- end
157
- new(transformed_hash)
158
- end
159
-
160
- # Deserializes the data based on type
161
- # @param string type Data type
162
- # @param string value Value to be deserialized
163
- # @return [Object] Deserialized data
164
- def self._deserialize(type, value)
165
- case type.to_sym
166
- when :Time
167
- Time.parse(value)
168
- when :Date
169
- Date.parse(value)
170
- when :String
171
- value.to_s
172
- when :Integer
173
- value.to_i
174
- when :Float
175
- value.to_f
176
- when :Boolean
177
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
- true
179
- else
180
- false
181
- end
182
- when :Object
183
- # generic object (usually a Hash), return directly
184
- value
185
- when /\AArray<(?<inner_type>.+)>\z/
186
- inner_type = Regexp.last_match[:inner_type]
187
- value.map { |v| _deserialize(inner_type, v) }
188
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
- k_type = Regexp.last_match[:k_type]
190
- v_type = Regexp.last_match[:v_type]
191
- {}.tap do |hash|
192
- value.each do |k, v|
193
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
- end
195
- end
196
- else # model
197
- # models (e.g. Pet) or oneOf
198
- klass = DaytonaApiClient.const_get(type)
199
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
- end
201
- end
202
-
203
- # Returns the string representation of the object
204
- # @return [String] String presentation of the object
205
- def to_s
206
- to_hash.to_s
207
- end
208
-
209
- # to_body is an alias to to_hash (backward compatibility)
210
- # @return [Hash] Returns the object in the form of hash
211
- def to_body
212
- to_hash
213
- end
214
-
215
- # Returns the object in the form of hash
216
- # @return [Hash] Returns the object in the form of hash
217
- def to_hash
218
- hash = {}
219
- self.class.attribute_map.each_pair do |attr, param|
220
- value = self.send(attr)
221
- if value.nil?
222
- is_nullable = self.class.openapi_nullable.include?(attr)
223
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
- end
225
-
226
- hash[param] = _to_hash(value)
227
- end
228
- hash
229
- end
230
-
231
- # Outputs non-array value in the form of hash
232
- # For object, use to_hash. Otherwise, just return the value
233
- # @param [Object] value Any valid value
234
- # @return [Hash] Returns the value in the form of hash
235
- def _to_hash(value)
236
- if value.is_a?(Array)
237
- value.compact.map { |v| _to_hash(v) }
238
- elsif value.is_a?(Hash)
239
- {}.tap do |hash|
240
- value.each { |k, v| hash[k] = _to_hash(v) }
241
- end
242
- elsif value.respond_to? :to_hash
243
- value.to_hash
244
- else
245
- value
246
- end
247
- end
248
- end
249
- end
@@ -1,229 +0,0 @@
1
- =begin
2
- #Daytona
3
-
4
- #Daytona AI platform API Docs
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@daytona.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.12.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module DaytonaApiClient
17
- class RateLimitEntry
18
- # Rate limit TTL in seconds
19
- attr_accessor :ttl
20
-
21
- # Rate limit max requests
22
- attr_accessor :limit
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'ttl' => :'ttl',
28
- :'limit' => :'limit'
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
- :'ttl' => :'Float',
46
- :'limit' => :'Float'
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::RateLimitEntry` 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::RateLimitEntry`. 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?(:'ttl')
73
- self.ttl = attributes[:'ttl']
74
- end
75
-
76
- if attributes.key?(:'limit')
77
- self.limit = attributes[:'limit']
78
- end
79
- end
80
-
81
- # Show invalid properties with the reasons. Usually used together with valid?
82
- # @return Array for valid properties with the reasons
83
- def list_invalid_properties
84
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
- invalid_properties = Array.new
86
- invalid_properties
87
- end
88
-
89
- # Check to see if the all the properties in the model are valid
90
- # @return true if the model is valid
91
- def valid?
92
- warn '[DEPRECATED] the `valid?` method is obsolete'
93
- true
94
- end
95
-
96
- # Checks equality by comparing each attribute.
97
- # @param [Object] Object to be compared
98
- def ==(o)
99
- return true if self.equal?(o)
100
- self.class == o.class &&
101
- ttl == o.ttl &&
102
- limit == o.limit
103
- end
104
-
105
- # @see the `==` method
106
- # @param [Object] Object to be compared
107
- def eql?(o)
108
- self == o
109
- end
110
-
111
- # Calculates hash code according to all attributes.
112
- # @return [Integer] Hash code
113
- def hash
114
- [ttl, limit].hash
115
- end
116
-
117
- # Builds the object from hash
118
- # @param [Hash] attributes Model attributes in the form of hash
119
- # @return [Object] Returns the model itself
120
- def self.build_from_hash(attributes)
121
- return nil unless attributes.is_a?(Hash)
122
- attributes = attributes.transform_keys(&:to_sym)
123
- transformed_hash = {}
124
- openapi_types.each_pair do |key, type|
125
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
- transformed_hash["#{key}"] = nil
127
- elsif type =~ /\AArray<(.*)>/i
128
- # check to ensure the input is an array given that the attribute
129
- # is documented as an array but the input is not
130
- if attributes[attribute_map[key]].is_a?(Array)
131
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
- end
133
- elsif !attributes[attribute_map[key]].nil?
134
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
- end
136
- end
137
- new(transformed_hash)
138
- end
139
-
140
- # Deserializes the data based on type
141
- # @param string type Data type
142
- # @param string value Value to be deserialized
143
- # @return [Object] Deserialized data
144
- def self._deserialize(type, value)
145
- case type.to_sym
146
- when :Time
147
- Time.parse(value)
148
- when :Date
149
- Date.parse(value)
150
- when :String
151
- value.to_s
152
- when :Integer
153
- value.to_i
154
- when :Float
155
- value.to_f
156
- when :Boolean
157
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
- true
159
- else
160
- false
161
- end
162
- when :Object
163
- # generic object (usually a Hash), return directly
164
- value
165
- when /\AArray<(?<inner_type>.+)>\z/
166
- inner_type = Regexp.last_match[:inner_type]
167
- value.map { |v| _deserialize(inner_type, v) }
168
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
- k_type = Regexp.last_match[:k_type]
170
- v_type = Regexp.last_match[:v_type]
171
- {}.tap do |hash|
172
- value.each do |k, v|
173
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
- end
175
- end
176
- else # model
177
- # models (e.g. Pet) or oneOf
178
- klass = DaytonaApiClient.const_get(type)
179
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
- end
181
- end
182
-
183
- # Returns the string representation of the object
184
- # @return [String] String presentation of the object
185
- def to_s
186
- to_hash.to_s
187
- end
188
-
189
- # to_body is an alias to to_hash (backward compatibility)
190
- # @return [Hash] Returns the object in the form of hash
191
- def to_body
192
- to_hash
193
- end
194
-
195
- # Returns the object in the form of hash
196
- # @return [Hash] Returns the object in the form of hash
197
- def to_hash
198
- hash = {}
199
- self.class.attribute_map.each_pair do |attr, param|
200
- value = self.send(attr)
201
- if value.nil?
202
- is_nullable = self.class.openapi_nullable.include?(attr)
203
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
- end
205
-
206
- hash[param] = _to_hash(value)
207
- end
208
- hash
209
- end
210
-
211
- # Outputs non-array value in the form of hash
212
- # For object, use to_hash. Otherwise, just return the value
213
- # @param [Object] value Any valid value
214
- # @return [Hash] Returns the value in the form of hash
215
- def _to_hash(value)
216
- if value.is_a?(Array)
217
- value.compact.map { |v| _to_hash(v) }
218
- elsif value.is_a?(Hash)
219
- {}.tap do |hash|
220
- value.each { |k, v| hash[k] = _to_hash(v) }
221
- end
222
- elsif value.respond_to? :to_hash
223
- value.to_hash
224
- else
225
- value
226
- end
227
- end
228
- end
229
- end