volcano-sdk 0.32.7 → 0.33.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/lib/volcano/client.rb +3 -2
  4. data/lib/volcano/generated/lib/volcano-generated/api/sandboxes_api.rb +1433 -0
  5. data/lib/volcano/generated/lib/volcano-generated/models/create_sandbox_session_request.rb +294 -0
  6. data/lib/volcano/generated/lib/volcano-generated/models/create_sandbox_template_request.rb +247 -0
  7. data/lib/volcano/generated/lib/volcano-generated/models/publish_sandbox_preset_request.rb +268 -0
  8. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_access.rb +216 -0
  9. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_access_request.rb +221 -0
  10. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_capacity.rb +199 -0
  11. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_capacity_list.rb +166 -0
  12. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_command_request.rb +251 -0
  13. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_command_result.rb +294 -0
  14. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_deployment.rb +242 -0
  15. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_deployment_page.rb +192 -0
  16. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_execution_request.rb +329 -0
  17. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_execution_result.rb +381 -0
  18. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_file_read_request.rb +182 -0
  19. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_file_result.rb +164 -0
  20. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_file_write_request.rb +217 -0
  21. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_pagination.rb +199 -0
  22. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_preset.rb +294 -0
  23. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_preset_list.rb +166 -0
  24. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_session.rb +407 -0
  25. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_session_page.rb +192 -0
  26. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_subject_grant_request.rb +164 -0
  27. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_template.rb +321 -0
  28. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_template_page.rb +192 -0
  29. data/lib/volcano/generated/lib/volcano-generated/models/update_sandbox_template_request.rb +175 -0
  30. data/lib/volcano/generated/lib/volcano-generated.rb +26 -0
  31. data/lib/volcano/generated_transport.rb +1 -0
  32. data/lib/volcano/generated_transport_sandbox.rb +69 -0
  33. data/lib/volcano/sandbox_files.rb +37 -0
  34. data/lib/volcano/sandbox_models.rb +24 -0
  35. data/lib/volcano/sandbox_request.rb +92 -0
  36. data/lib/volcano/sandbox_response.rb +74 -0
  37. data/lib/volcano/sandbox_session.rb +78 -0
  38. data/lib/volcano/sandboxes.rb +67 -0
  39. data/lib/volcano/version.rb +1 -1
  40. data/lib/volcano.rb +7 -0
  41. data/sig/client.rbs +1 -0
  42. data/sig/sandboxes.rbs +83 -0
  43. metadata +50 -2
@@ -0,0 +1,164 @@
1
+ =begin
2
+ #Volcano Hosting API
3
+
4
+ #Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: support@volcano.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Volcano::Generated
17
+ class SandboxSubjectGrantRequest < ApiModelBase
18
+ attr_accessor :expires_at
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'expires_at' => :'expires_at'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'expires_at' => :'Time'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::SandboxSubjectGrantRequest` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::SandboxSubjectGrantRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'expires_at')
67
+ self.expires_at = attributes[:'expires_at']
68
+ else
69
+ self.expires_at = nil
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ if @expires_at.nil?
79
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
89
+ return false if @expires_at.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] expires_at Value to be assigned
95
+ def expires_at=(expires_at)
96
+ if expires_at.nil?
97
+ fail ArgumentError, 'expires_at cannot be nil'
98
+ end
99
+
100
+ @expires_at = expires_at
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ expires_at == o.expires_at
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [expires_at].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Returns the object in the form of hash
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_hash
149
+ hash = {}
150
+ self.class.attribute_map.each_pair do |attr, param|
151
+ value = self.send(attr)
152
+ if value.nil?
153
+ is_nullable = self.class.openapi_nullable.include?(attr)
154
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
155
+ end
156
+
157
+ hash[param] = _to_hash(value)
158
+ end
159
+ hash
160
+ end
161
+
162
+ end
163
+
164
+ end
@@ -0,0 +1,321 @@
1
+ =begin
2
+ #Volcano Hosting API
3
+
4
+ #Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: support@volcano.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Volcano::Generated
17
+ class SandboxTemplate < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :project_id
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :preset
25
+
26
+ attr_accessor :memory_mb
27
+
28
+ attr_accessor :status
29
+
30
+ attr_accessor :created_at
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'id' => :'id',
58
+ :'project_id' => :'project_id',
59
+ :'name' => :'name',
60
+ :'preset' => :'preset',
61
+ :'memory_mb' => :'memory_mb',
62
+ :'status' => :'status',
63
+ :'created_at' => :'created_at'
64
+ }
65
+ end
66
+
67
+ # Returns attribute mapping this model knows about
68
+ def self.acceptable_attribute_map
69
+ attribute_map
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ acceptable_attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'id' => :'String',
81
+ :'project_id' => :'String',
82
+ :'name' => :'String',
83
+ :'preset' => :'String',
84
+ :'memory_mb' => :'Integer',
85
+ :'status' => :'String',
86
+ :'created_at' => :'Time'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::SandboxTemplate` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ acceptable_attribute_map = self.class.acceptable_attribute_map
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!acceptable_attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::SandboxTemplate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'id')
113
+ self.id = attributes[:'id']
114
+ else
115
+ self.id = nil
116
+ end
117
+
118
+ if attributes.key?(:'project_id')
119
+ self.project_id = attributes[:'project_id']
120
+ else
121
+ self.project_id = nil
122
+ end
123
+
124
+ if attributes.key?(:'name')
125
+ self.name = attributes[:'name']
126
+ else
127
+ self.name = nil
128
+ end
129
+
130
+ if attributes.key?(:'preset')
131
+ self.preset = attributes[:'preset']
132
+ end
133
+
134
+ if attributes.key?(:'memory_mb')
135
+ self.memory_mb = attributes[:'memory_mb']
136
+ end
137
+
138
+ if attributes.key?(:'status')
139
+ self.status = attributes[:'status']
140
+ else
141
+ self.status = nil
142
+ end
143
+
144
+ if attributes.key?(:'created_at')
145
+ self.created_at = attributes[:'created_at']
146
+ else
147
+ self.created_at = nil
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
155
+ invalid_properties = Array.new
156
+ if @id.nil?
157
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
158
+ end
159
+
160
+ if @project_id.nil?
161
+ invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
162
+ end
163
+
164
+ if @name.nil?
165
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
166
+ end
167
+
168
+ pattern = Regexp.new(/^[a-z][a-z0-9-]{0,62}$/)
169
+ if @name !~ pattern
170
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
171
+ end
172
+
173
+ if @status.nil?
174
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
175
+ end
176
+
177
+ if @created_at.nil?
178
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
179
+ end
180
+
181
+ invalid_properties
182
+ end
183
+
184
+ # Check to see if the all the properties in the model are valid
185
+ # @return true if the model is valid
186
+ def valid?
187
+ warn '[DEPRECATED] the `valid?` method is obsolete'
188
+ return false if @id.nil?
189
+ return false if @project_id.nil?
190
+ return false if @name.nil?
191
+ return false if @name !~ Regexp.new(/^[a-z][a-z0-9-]{0,62}$/)
192
+ return false if @status.nil?
193
+ status_validator = EnumAttributeValidator.new('String', ["ready", "unavailable", "deleting"])
194
+ return false unless status_validator.valid?(@status)
195
+ return false if @created_at.nil?
196
+ true
197
+ end
198
+
199
+ # Custom attribute writer method with validation
200
+ # @param [Object] id Value to be assigned
201
+ def id=(id)
202
+ if id.nil?
203
+ fail ArgumentError, 'id cannot be nil'
204
+ end
205
+
206
+ @id = id
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] project_id Value to be assigned
211
+ def project_id=(project_id)
212
+ if project_id.nil?
213
+ fail ArgumentError, 'project_id cannot be nil'
214
+ end
215
+
216
+ @project_id = project_id
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] name Value to be assigned
221
+ def name=(name)
222
+ if name.nil?
223
+ fail ArgumentError, 'name cannot be nil'
224
+ end
225
+
226
+ pattern = Regexp.new(/^[a-z][a-z0-9-]{0,62}$/)
227
+ if name !~ pattern
228
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
229
+ end
230
+
231
+ @name = name
232
+ end
233
+
234
+ # Custom attribute writer method checking allowed values (enum).
235
+ # @param [Object] status Object to be assigned
236
+ def status=(status)
237
+ validator = EnumAttributeValidator.new('String', ["ready", "unavailable", "deleting"])
238
+ unless validator.valid?(status)
239
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
240
+ end
241
+ @status = status
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] created_at Value to be assigned
246
+ def created_at=(created_at)
247
+ if created_at.nil?
248
+ fail ArgumentError, 'created_at cannot be nil'
249
+ end
250
+
251
+ @created_at = created_at
252
+ end
253
+
254
+ # Checks equality by comparing each attribute.
255
+ # @param [Object] Object to be compared
256
+ def ==(o)
257
+ return true if self.equal?(o)
258
+ self.class == o.class &&
259
+ id == o.id &&
260
+ project_id == o.project_id &&
261
+ name == o.name &&
262
+ preset == o.preset &&
263
+ memory_mb == o.memory_mb &&
264
+ status == o.status &&
265
+ created_at == o.created_at
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(o)
271
+ self == o
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Integer] Hash code
276
+ def hash
277
+ [id, project_id, name, preset, memory_mb, status, created_at].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def self.build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ transformed_hash = {}
287
+ openapi_types.each_pair do |key, type|
288
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
289
+ transformed_hash["#{key}"] = nil
290
+ elsif type =~ /\AArray<(.*)>/i
291
+ # check to ensure the input is an array given that the attribute
292
+ # is documented as an array but the input is not
293
+ if attributes[attribute_map[key]].is_a?(Array)
294
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
295
+ end
296
+ elsif !attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
298
+ end
299
+ end
300
+ new(transformed_hash)
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ end
320
+
321
+ end
@@ -0,0 +1,192 @@
1
+ =begin
2
+ #Volcano Hosting API
3
+
4
+ #Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: support@volcano.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Volcano::Generated
17
+ class SandboxTemplatePage < ApiModelBase
18
+ attr_accessor :data
19
+
20
+ attr_accessor :pagination
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'pagination' => :'pagination'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'data' => :'Array<SandboxTemplate>',
44
+ :'pagination' => :'SandboxPagination'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::SandboxTemplatePage` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::SandboxTemplatePage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'data')
71
+ if (value = attributes[:'data']).is_a?(Array)
72
+ self.data = value
73
+ end
74
+ else
75
+ self.data = nil
76
+ end
77
+
78
+ if attributes.key?(:'pagination')
79
+ self.pagination = attributes[:'pagination']
80
+ else
81
+ self.pagination = 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 @data.nil?
91
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
92
+ end
93
+
94
+ if @pagination.nil?
95
+ invalid_properties.push('invalid value for "pagination", pagination 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 @data.nil?
106
+ return false if @pagination.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] data Value to be assigned
112
+ def data=(data)
113
+ if data.nil?
114
+ fail ArgumentError, 'data cannot be nil'
115
+ end
116
+
117
+ @data = data
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] pagination Value to be assigned
122
+ def pagination=(pagination)
123
+ if pagination.nil?
124
+ fail ArgumentError, 'pagination cannot be nil'
125
+ end
126
+
127
+ @pagination = pagination
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
+ data == o.data &&
136
+ pagination == o.pagination
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
+ [data, pagination].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
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ end
191
+
192
+ end