pulpcore_client 3.0.0rc2
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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +151 -0
- data/Rakefile +10 -0
- data/docs/Artifact.md +37 -0
- data/docs/ArtifactsApi.md +253 -0
- data/docs/AsyncOperationResponse.md +17 -0
- data/docs/InlineResponse200.md +23 -0
- data/docs/InlineResponse2001.md +23 -0
- data/docs/InlineResponse2002.md +23 -0
- data/docs/InlineResponse2003.md +23 -0
- data/docs/InlineResponse2004.md +23 -0
- data/docs/InlineResponse2005.md +23 -0
- data/docs/OrphansApi.md +58 -0
- data/docs/ProgressReport.md +27 -0
- data/docs/RepositoriesApi.md +584 -0
- data/docs/Repository.md +27 -0
- data/docs/RepositoryVersion.md +25 -0
- data/docs/RepositoryVersionCreate.md +21 -0
- data/docs/StatusApi.md +57 -0
- data/docs/Task.md +41 -0
- data/docs/TasksApi.md +263 -0
- data/docs/Upload.md +25 -0
- data/docs/UploadsApi.md +395 -0
- data/docs/Worker.md +27 -0
- data/docs/WorkersApi.md +136 -0
- data/git_push.sh +55 -0
- data/lib/pulpcore_client/api/artifacts_api.rb +306 -0
- data/lib/pulpcore_client/api/orphans_api.rb +78 -0
- data/lib/pulpcore_client/api/repositories_api.rb +710 -0
- data/lib/pulpcore_client/api/status_api.rb +76 -0
- data/lib/pulpcore_client/api/tasks_api.rb +330 -0
- data/lib/pulpcore_client/api/uploads_api.rb +493 -0
- data/lib/pulpcore_client/api/workers_api.rb +172 -0
- data/lib/pulpcore_client/api_client.rb +387 -0
- data/lib/pulpcore_client/api_error.rb +57 -0
- data/lib/pulpcore_client/configuration.rb +251 -0
- data/lib/pulpcore_client/models/artifact.rb +296 -0
- data/lib/pulpcore_client/models/async_operation_response.rb +202 -0
- data/lib/pulpcore_client/models/inline_response200.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2001.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2002.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2003.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2004.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2005.rb +235 -0
- data/lib/pulpcore_client/models/progress_report.rb +277 -0
- data/lib/pulpcore_client/models/repository.rb +268 -0
- data/lib/pulpcore_client/models/repository_version.rb +235 -0
- data/lib/pulpcore_client/models/repository_version_create.rb +231 -0
- data/lib/pulpcore_client/models/task.rb +360 -0
- data/lib/pulpcore_client/models/upload.rb +257 -0
- data/lib/pulpcore_client/models/worker.rb +261 -0
- data/lib/pulpcore_client/version.rb +15 -0
- data/lib/pulpcore_client.rb +61 -0
- data/pulpcore_client.gemspec +45 -0
- data/spec/api/artifacts_api_spec.rb +96 -0
- data/spec/api/orphans_api_spec.rb +46 -0
- data/spec/api/repositories_api_spec.rb +171 -0
- data/spec/api/status_api_spec.rb +46 -0
- data/spec/api/tasks_api_spec.rb +102 -0
- data/spec/api/uploads_api_spec.rb +123 -0
- data/spec/api/workers_api_spec.rb +68 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/artifact_spec.rb +101 -0
- data/spec/models/async_operation_response_spec.rb +41 -0
- data/spec/models/inline_response2001_spec.rb +59 -0
- data/spec/models/inline_response2002_spec.rb +59 -0
- data/spec/models/inline_response2003_spec.rb +59 -0
- data/spec/models/inline_response2004_spec.rb +59 -0
- data/spec/models/inline_response2005_spec.rb +59 -0
- data/spec/models/inline_response200_spec.rb +59 -0
- data/spec/models/progress_report_spec.rb +71 -0
- data/spec/models/repository_spec.rb +71 -0
- data/spec/models/repository_version_create_spec.rb +53 -0
- data/spec/models/repository_version_spec.rb +65 -0
- data/spec/models/task_spec.rb +113 -0
- data/spec/models/upload_spec.rb +65 -0
- data/spec/models/worker_spec.rb +71 -0
- data/spec/spec_helper.rb +111 -0
- metadata +329 -0
@@ -0,0 +1,360 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
class Task
|
17
|
+
attr_accessor :_href
|
18
|
+
|
19
|
+
# Timestamp of creation.
|
20
|
+
attr_accessor :_created
|
21
|
+
|
22
|
+
# The current state of the task. The possible values include: 'waiting', 'skipped', 'running', 'completed', 'failed' and 'canceled'.
|
23
|
+
attr_accessor :state
|
24
|
+
|
25
|
+
# The name of task.
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# Timestamp of the when this task started execution.
|
29
|
+
attr_accessor :started_at
|
30
|
+
|
31
|
+
# Timestamp of the when this task stopped execution.
|
32
|
+
attr_accessor :finished_at
|
33
|
+
|
34
|
+
# A JSON Object of non-fatal errors encountered during the execution of this task.
|
35
|
+
attr_accessor :non_fatal_errors
|
36
|
+
|
37
|
+
# A JSON Object of a fatal error encountered during the execution of this task.
|
38
|
+
attr_accessor :error
|
39
|
+
|
40
|
+
# The worker associated with this task. This field is empty if a worker is not yet assigned.
|
41
|
+
attr_accessor :worker
|
42
|
+
|
43
|
+
# The parent task that spawned this task.
|
44
|
+
attr_accessor :parent
|
45
|
+
|
46
|
+
# Any tasks spawned by this task.
|
47
|
+
attr_accessor :spawned_tasks
|
48
|
+
|
49
|
+
attr_accessor :progress_reports
|
50
|
+
|
51
|
+
# Resources created by this task.
|
52
|
+
attr_accessor :created_resources
|
53
|
+
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
+
def self.attribute_map
|
56
|
+
{
|
57
|
+
:'_href' => :'_href',
|
58
|
+
:'_created' => :'_created',
|
59
|
+
:'state' => :'state',
|
60
|
+
:'name' => :'name',
|
61
|
+
:'started_at' => :'started_at',
|
62
|
+
:'finished_at' => :'finished_at',
|
63
|
+
:'non_fatal_errors' => :'non_fatal_errors',
|
64
|
+
:'error' => :'error',
|
65
|
+
:'worker' => :'worker',
|
66
|
+
:'parent' => :'parent',
|
67
|
+
:'spawned_tasks' => :'spawned_tasks',
|
68
|
+
:'progress_reports' => :'progress_reports',
|
69
|
+
:'created_resources' => :'created_resources'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute type mapping.
|
74
|
+
def self.openapi_types
|
75
|
+
{
|
76
|
+
:'_href' => :'String',
|
77
|
+
:'_created' => :'DateTime',
|
78
|
+
:'state' => :'String',
|
79
|
+
:'name' => :'String',
|
80
|
+
:'started_at' => :'DateTime',
|
81
|
+
:'finished_at' => :'DateTime',
|
82
|
+
:'non_fatal_errors' => :'String',
|
83
|
+
:'error' => :'String',
|
84
|
+
:'worker' => :'String',
|
85
|
+
:'parent' => :'String',
|
86
|
+
:'spawned_tasks' => :'Array<String>',
|
87
|
+
:'progress_reports' => :'Array<ProgressReport>',
|
88
|
+
:'created_resources' => :'Array<String>'
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Initializes the object
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
def initialize(attributes = {})
|
95
|
+
if (!attributes.is_a?(Hash))
|
96
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::Task` initialize method"
|
97
|
+
end
|
98
|
+
|
99
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
100
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
101
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
102
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::Task`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
103
|
+
end
|
104
|
+
h[k.to_sym] = v
|
105
|
+
}
|
106
|
+
|
107
|
+
if attributes.key?(:'_href')
|
108
|
+
self._href = attributes[:'_href']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'_created')
|
112
|
+
self._created = attributes[:'_created']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'state')
|
116
|
+
self.state = attributes[:'state']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'name')
|
120
|
+
self.name = attributes[:'name']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'started_at')
|
124
|
+
self.started_at = attributes[:'started_at']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'finished_at')
|
128
|
+
self.finished_at = attributes[:'finished_at']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'non_fatal_errors')
|
132
|
+
self.non_fatal_errors = attributes[:'non_fatal_errors']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'error')
|
136
|
+
self.error = attributes[:'error']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'worker')
|
140
|
+
self.worker = attributes[:'worker']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'parent')
|
144
|
+
self.parent = attributes[:'parent']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'spawned_tasks')
|
148
|
+
if (value = attributes[:'spawned_tasks']).is_a?(Array)
|
149
|
+
self.spawned_tasks = value
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'progress_reports')
|
154
|
+
if (value = attributes[:'progress_reports']).is_a?(Array)
|
155
|
+
self.progress_reports = value
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'created_resources')
|
160
|
+
if (value = attributes[:'created_resources']).is_a?(Array)
|
161
|
+
self.created_resources = value
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
167
|
+
# @return Array for valid properties with the reasons
|
168
|
+
def list_invalid_properties
|
169
|
+
invalid_properties = Array.new
|
170
|
+
if !@state.nil? && @state.to_s.length < 1
|
171
|
+
invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.')
|
172
|
+
end
|
173
|
+
|
174
|
+
if @name.nil?
|
175
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
176
|
+
end
|
177
|
+
|
178
|
+
if @name.to_s.length < 1
|
179
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
180
|
+
end
|
181
|
+
|
182
|
+
invalid_properties
|
183
|
+
end
|
184
|
+
|
185
|
+
# Check to see if the all the properties in the model are valid
|
186
|
+
# @return true if the model is valid
|
187
|
+
def valid?
|
188
|
+
return false if !@state.nil? && @state.to_s.length < 1
|
189
|
+
return false if @name.nil?
|
190
|
+
return false if @name.to_s.length < 1
|
191
|
+
true
|
192
|
+
end
|
193
|
+
|
194
|
+
# Custom attribute writer method with validation
|
195
|
+
# @param [Object] state Value to be assigned
|
196
|
+
def state=(state)
|
197
|
+
if !state.nil? && state.to_s.length < 1
|
198
|
+
fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.'
|
199
|
+
end
|
200
|
+
|
201
|
+
@state = state
|
202
|
+
end
|
203
|
+
|
204
|
+
# Custom attribute writer method with validation
|
205
|
+
# @param [Object] name Value to be assigned
|
206
|
+
def name=(name)
|
207
|
+
if name.nil?
|
208
|
+
fail ArgumentError, 'name cannot be nil'
|
209
|
+
end
|
210
|
+
|
211
|
+
if name.to_s.length < 1
|
212
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
213
|
+
end
|
214
|
+
|
215
|
+
@name = name
|
216
|
+
end
|
217
|
+
|
218
|
+
# Checks equality by comparing each attribute.
|
219
|
+
# @param [Object] Object to be compared
|
220
|
+
def ==(o)
|
221
|
+
return true if self.equal?(o)
|
222
|
+
self.class == o.class &&
|
223
|
+
_href == o._href &&
|
224
|
+
_created == o._created &&
|
225
|
+
state == o.state &&
|
226
|
+
name == o.name &&
|
227
|
+
started_at == o.started_at &&
|
228
|
+
finished_at == o.finished_at &&
|
229
|
+
non_fatal_errors == o.non_fatal_errors &&
|
230
|
+
error == o.error &&
|
231
|
+
worker == o.worker &&
|
232
|
+
parent == o.parent &&
|
233
|
+
spawned_tasks == o.spawned_tasks &&
|
234
|
+
progress_reports == o.progress_reports &&
|
235
|
+
created_resources == o.created_resources
|
236
|
+
end
|
237
|
+
|
238
|
+
# @see the `==` method
|
239
|
+
# @param [Object] Object to be compared
|
240
|
+
def eql?(o)
|
241
|
+
self == o
|
242
|
+
end
|
243
|
+
|
244
|
+
# Calculates hash code according to all attributes.
|
245
|
+
# @return [Integer] Hash code
|
246
|
+
def hash
|
247
|
+
[_href, _created, state, name, started_at, finished_at, non_fatal_errors, error, worker, parent, spawned_tasks, progress_reports, created_resources].hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Builds the object from hash
|
251
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
252
|
+
# @return [Object] Returns the model itself
|
253
|
+
def self.build_from_hash(attributes)
|
254
|
+
new.build_from_hash(attributes)
|
255
|
+
end
|
256
|
+
|
257
|
+
# Builds the object from hash
|
258
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
259
|
+
# @return [Object] Returns the model itself
|
260
|
+
def build_from_hash(attributes)
|
261
|
+
return nil unless attributes.is_a?(Hash)
|
262
|
+
self.class.openapi_types.each_pair do |key, type|
|
263
|
+
if type =~ /\AArray<(.*)>/i
|
264
|
+
# check to ensure the input is an array given that the attribute
|
265
|
+
# is documented as an array but the input is not
|
266
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
267
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
268
|
+
end
|
269
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
270
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
271
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
272
|
+
end
|
273
|
+
|
274
|
+
self
|
275
|
+
end
|
276
|
+
|
277
|
+
# Deserializes the data based on type
|
278
|
+
# @param string type Data type
|
279
|
+
# @param string value Value to be deserialized
|
280
|
+
# @return [Object] Deserialized data
|
281
|
+
def _deserialize(type, value)
|
282
|
+
case type.to_sym
|
283
|
+
when :DateTime
|
284
|
+
DateTime.parse(value)
|
285
|
+
when :Date
|
286
|
+
Date.parse(value)
|
287
|
+
when :String
|
288
|
+
value.to_s
|
289
|
+
when :Integer
|
290
|
+
value.to_i
|
291
|
+
when :Float
|
292
|
+
value.to_f
|
293
|
+
when :Boolean
|
294
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
295
|
+
true
|
296
|
+
else
|
297
|
+
false
|
298
|
+
end
|
299
|
+
when :Object
|
300
|
+
# generic object (usually a Hash), return directly
|
301
|
+
value
|
302
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
303
|
+
inner_type = Regexp.last_match[:inner_type]
|
304
|
+
value.map { |v| _deserialize(inner_type, v) }
|
305
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
306
|
+
k_type = Regexp.last_match[:k_type]
|
307
|
+
v_type = Regexp.last_match[:v_type]
|
308
|
+
{}.tap do |hash|
|
309
|
+
value.each do |k, v|
|
310
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
else # model
|
314
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# Returns the string representation of the object
|
319
|
+
# @return [String] String presentation of the object
|
320
|
+
def to_s
|
321
|
+
to_hash.to_s
|
322
|
+
end
|
323
|
+
|
324
|
+
# to_body is an alias to to_hash (backward compatibility)
|
325
|
+
# @return [Hash] Returns the object in the form of hash
|
326
|
+
def to_body
|
327
|
+
to_hash
|
328
|
+
end
|
329
|
+
|
330
|
+
# Returns the object in the form of hash
|
331
|
+
# @return [Hash] Returns the object in the form of hash
|
332
|
+
def to_hash
|
333
|
+
hash = {}
|
334
|
+
self.class.attribute_map.each_pair do |attr, param|
|
335
|
+
value = self.send(attr)
|
336
|
+
next if value.nil?
|
337
|
+
hash[param] = _to_hash(value)
|
338
|
+
end
|
339
|
+
hash
|
340
|
+
end
|
341
|
+
|
342
|
+
# Outputs non-array value in the form of hash
|
343
|
+
# For object, use to_hash. Otherwise, just return the value
|
344
|
+
# @param [Object] value Any valid value
|
345
|
+
# @return [Hash] Returns the value in the form of hash
|
346
|
+
def _to_hash(value)
|
347
|
+
if value.is_a?(Array)
|
348
|
+
value.compact.map { |v| _to_hash(v) }
|
349
|
+
elsif value.is_a?(Hash)
|
350
|
+
{}.tap do |hash|
|
351
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
352
|
+
end
|
353
|
+
elsif value.respond_to? :to_hash
|
354
|
+
value.to_hash
|
355
|
+
else
|
356
|
+
value
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
class Upload
|
17
|
+
attr_accessor :_href
|
18
|
+
|
19
|
+
attr_accessor :offset
|
20
|
+
|
21
|
+
attr_accessor :expires_at
|
22
|
+
|
23
|
+
# Uploaded file.
|
24
|
+
attr_accessor :file
|
25
|
+
|
26
|
+
attr_accessor :md5
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'_href' => :'_href',
|
32
|
+
:'offset' => :'offset',
|
33
|
+
:'expires_at' => :'expires_at',
|
34
|
+
:'file' => :'file',
|
35
|
+
:'md5' => :'md5'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'_href' => :'String',
|
43
|
+
:'offset' => :'Integer',
|
44
|
+
:'expires_at' => :'String',
|
45
|
+
:'file' => :'String',
|
46
|
+
:'md5' => :'String'
|
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 `PulpcoreClient::Upload` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::Upload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'_href')
|
66
|
+
self._href = attributes[:'_href']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'offset')
|
70
|
+
self.offset = attributes[:'offset']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'expires_at')
|
74
|
+
self.expires_at = attributes[:'expires_at']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'file')
|
78
|
+
self.file = attributes[:'file']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'md5')
|
82
|
+
self.md5 = attributes[:'md5']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
if !@offset.nil? && @offset > 9223372036854775807
|
91
|
+
invalid_properties.push('invalid value for "offset", must be smaller than or equal to 9223372036854775807.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if !@offset.nil? && @offset < -9223372036854775808
|
95
|
+
invalid_properties.push('invalid value for "offset", must be greater than or equal to -9223372036854775808.')
|
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
|
+
return false if !@offset.nil? && @offset > 9223372036854775807
|
105
|
+
return false if !@offset.nil? && @offset < -9223372036854775808
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Custom attribute writer method with validation
|
110
|
+
# @param [Object] offset Value to be assigned
|
111
|
+
def offset=(offset)
|
112
|
+
if !offset.nil? && offset > 9223372036854775807
|
113
|
+
fail ArgumentError, 'invalid value for "offset", must be smaller than or equal to 9223372036854775807.'
|
114
|
+
end
|
115
|
+
|
116
|
+
if !offset.nil? && offset < -9223372036854775808
|
117
|
+
fail ArgumentError, 'invalid value for "offset", must be greater than or equal to -9223372036854775808.'
|
118
|
+
end
|
119
|
+
|
120
|
+
@offset = offset
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def ==(o)
|
126
|
+
return true if self.equal?(o)
|
127
|
+
self.class == o.class &&
|
128
|
+
_href == o._href &&
|
129
|
+
offset == o.offset &&
|
130
|
+
expires_at == o.expires_at &&
|
131
|
+
file == o.file &&
|
132
|
+
md5 == o.md5
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Integer] Hash code
|
143
|
+
def hash
|
144
|
+
[_href, offset, expires_at, file, md5].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def self.build_from_hash(attributes)
|
151
|
+
new.build_from_hash(attributes)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
self.class.openapi_types.each_pair do |key, type|
|
160
|
+
if type =~ /\AArray<(.*)>/i
|
161
|
+
# check to ensure the input is an array given that the attribute
|
162
|
+
# is documented as an array but the input is not
|
163
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
164
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
165
|
+
end
|
166
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
167
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
168
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
169
|
+
end
|
170
|
+
|
171
|
+
self
|
172
|
+
end
|
173
|
+
|
174
|
+
# Deserializes the data based on type
|
175
|
+
# @param string type Data type
|
176
|
+
# @param string value Value to be deserialized
|
177
|
+
# @return [Object] Deserialized data
|
178
|
+
def _deserialize(type, value)
|
179
|
+
case type.to_sym
|
180
|
+
when :DateTime
|
181
|
+
DateTime.parse(value)
|
182
|
+
when :Date
|
183
|
+
Date.parse(value)
|
184
|
+
when :String
|
185
|
+
value.to_s
|
186
|
+
when :Integer
|
187
|
+
value.to_i
|
188
|
+
when :Float
|
189
|
+
value.to_f
|
190
|
+
when :Boolean
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
192
|
+
true
|
193
|
+
else
|
194
|
+
false
|
195
|
+
end
|
196
|
+
when :Object
|
197
|
+
# generic object (usually a Hash), return directly
|
198
|
+
value
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each do |k, v|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
else # model
|
211
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the string representation of the object
|
216
|
+
# @return [String] String presentation of the object
|
217
|
+
def to_s
|
218
|
+
to_hash.to_s
|
219
|
+
end
|
220
|
+
|
221
|
+
# to_body is an alias to to_hash (backward compatibility)
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_body
|
224
|
+
to_hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the object in the form of hash
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_hash
|
230
|
+
hash = {}
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
232
|
+
value = self.send(attr)
|
233
|
+
next if value.nil?
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|