pulpcore_client 3.3.1 → 3.4.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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -14
  3. data/docs/{Artifact.md → ArtifactRead.md} +2 -2
  4. data/docs/ArtifactsApi.md +5 -5
  5. data/docs/ExportersCoreExportsApi.md +13 -13
  6. data/docs/ExportersPulpApi.md +9 -9
  7. data/docs/{Import.md → ImportRead.md} +2 -2
  8. data/docs/ImportersCoreImportsApi.md +13 -13
  9. data/docs/ImportersPulpApi.md +9 -9
  10. data/docs/InlineResponse200.md +1 -1
  11. data/docs/InlineResponse2001.md +1 -1
  12. data/docs/InlineResponse2002.md +1 -1
  13. data/docs/InlineResponse2003.md +1 -1
  14. data/docs/InlineResponse2004.md +1 -1
  15. data/docs/InlineResponse2005.md +1 -1
  16. data/docs/InlineResponse2006.md +1 -1
  17. data/docs/InlineResponse2007.md +1 -1
  18. data/docs/InlineResponse2008.md +1 -1
  19. data/docs/InlineResponse2009.md +1 -1
  20. data/docs/OrphansApi.md +1 -1
  21. data/docs/PulpExport.md +12 -6
  22. data/docs/PulpExportRead.md +27 -0
  23. data/docs/PulpExporterRead.md +27 -0
  24. data/docs/PulpImporterRead.md +23 -0
  25. data/docs/{SigningService.md → SigningServiceRead.md} +2 -2
  26. data/docs/SigningServicesApi.md +3 -3
  27. data/docs/StatusApi.md +1 -1
  28. data/docs/{TaskGroup.md → TaskGroupRead.md} +4 -2
  29. data/docs/TaskGroupsApi.md +3 -3
  30. data/docs/TaskRead.md +43 -0
  31. data/docs/TasksApi.md +3 -3
  32. data/docs/{UploadDetail.md → UploadDetailRead.md} +2 -2
  33. data/docs/UploadRead.md +23 -0
  34. data/docs/UploadsApi.md +5 -5
  35. data/docs/Worker.md +3 -3
  36. data/docs/WorkerRead.md +23 -0
  37. data/docs/WorkersApi.md +3 -3
  38. data/lib/pulpcore_client/api/artifacts_api.rb +6 -6
  39. data/lib/pulpcore_client/api/exporters_core_exports_api.rb +21 -21
  40. data/lib/pulpcore_client/api/exporters_pulp_api.rb +12 -12
  41. data/lib/pulpcore_client/api/importers_core_imports_api.rb +21 -21
  42. data/lib/pulpcore_client/api/importers_pulp_api.rb +12 -12
  43. data/lib/pulpcore_client/api/signing_services_api.rb +3 -3
  44. data/lib/pulpcore_client/api/task_groups_api.rb +3 -3
  45. data/lib/pulpcore_client/api/tasks_api.rb +3 -3
  46. data/lib/pulpcore_client/api/uploads_api.rb +6 -6
  47. data/lib/pulpcore_client/api/workers_api.rb +3 -3
  48. data/lib/pulpcore_client/configuration.rb +2 -2
  49. data/lib/pulpcore_client/models/{artifact.rb → artifact_read.rb} +3 -3
  50. data/lib/pulpcore_client/models/{import.rb → import_read.rb} +3 -3
  51. data/lib/pulpcore_client/models/inline_response200.rb +1 -1
  52. data/lib/pulpcore_client/models/inline_response2001.rb +1 -1
  53. data/lib/pulpcore_client/models/inline_response2002.rb +1 -1
  54. data/lib/pulpcore_client/models/inline_response2003.rb +1 -1
  55. data/lib/pulpcore_client/models/inline_response2004.rb +1 -1
  56. data/lib/pulpcore_client/models/inline_response2005.rb +1 -1
  57. data/lib/pulpcore_client/models/inline_response2006.rb +1 -1
  58. data/lib/pulpcore_client/models/inline_response2007.rb +1 -1
  59. data/lib/pulpcore_client/models/inline_response2008.rb +1 -1
  60. data/lib/pulpcore_client/models/inline_response2009.rb +1 -1
  61. data/lib/pulpcore_client/models/pulp_export.rb +59 -49
  62. data/lib/pulpcore_client/models/pulp_export_read.rb +259 -0
  63. data/lib/pulpcore_client/models/pulp_exporter.rb +1 -0
  64. data/lib/pulpcore_client/models/pulp_exporter_read.rb +311 -0
  65. data/lib/pulpcore_client/models/pulp_importer_read.rb +262 -0
  66. data/lib/pulpcore_client/models/{signing_service.rb → signing_service_read.rb} +3 -3
  67. data/lib/pulpcore_client/models/{task_group.rb → task_group_read.rb} +19 -4
  68. data/lib/pulpcore_client/models/task_read.rb +383 -0
  69. data/lib/pulpcore_client/models/{upload_detail.rb → upload_detail_read.rb} +3 -3
  70. data/lib/pulpcore_client/models/upload_read.rb +241 -0
  71. data/lib/pulpcore_client/models/worker.rb +10 -10
  72. data/lib/pulpcore_client/models/worker_read.rb +251 -0
  73. data/lib/pulpcore_client/version.rb +1 -1
  74. data/lib/pulpcore_client.rb +11 -5
  75. data/spec/api/artifacts_api_spec.rb +2 -2
  76. data/spec/api/exporters_core_exports_api_spec.rb +3 -3
  77. data/spec/api/exporters_pulp_api_spec.rb +4 -4
  78. data/spec/api/importers_core_imports_api_spec.rb +3 -3
  79. data/spec/api/importers_pulp_api_spec.rb +4 -4
  80. data/spec/api/signing_services_api_spec.rb +1 -1
  81. data/spec/api/task_groups_api_spec.rb +1 -1
  82. data/spec/api/tasks_api_spec.rb +1 -1
  83. data/spec/api/uploads_api_spec.rb +2 -2
  84. data/spec/api/workers_api_spec.rb +1 -1
  85. data/spec/configuration_spec.rb +3 -3
  86. data/spec/models/{artifact_spec.rb → artifact_read_spec.rb} +6 -6
  87. data/spec/models/{import_spec.rb → import_read_spec.rb} +6 -6
  88. data/spec/models/pulp_export_read_spec.rb +71 -0
  89. data/spec/models/pulp_export_spec.rb +20 -2
  90. data/spec/models/pulp_exporter_read_spec.rb +71 -0
  91. data/spec/models/pulp_importer_read_spec.rb +59 -0
  92. data/spec/models/{signing_service_spec.rb → signing_service_read_spec.rb} +6 -6
  93. data/spec/models/{task_group_spec.rb → task_group_read_spec.rb} +12 -6
  94. data/spec/models/task_read_spec.rb +119 -0
  95. data/spec/models/{upload_detail_spec.rb → upload_detail_read_spec.rb} +6 -6
  96. data/spec/models/upload_read_spec.rb +59 -0
  97. data/spec/models/worker_read_spec.rb +59 -0
  98. data/spec/models/worker_spec.rb +2 -2
  99. metadata +46 -22
@@ -0,0 +1,383 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpcoreClient
16
+ class TaskRead
17
+ attr_accessor :pulp_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :pulp_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 a fatal error encountered during the execution of this task.
35
+ attr_accessor :error
36
+
37
+ # The worker associated with this task. This field is empty if a worker is not yet assigned.
38
+ attr_accessor :worker
39
+
40
+ # The parent task that spawned this task.
41
+ attr_accessor :parent_task
42
+
43
+ # Any tasks spawned by this task.
44
+ attr_accessor :child_tasks
45
+
46
+ # The task group that this task is a member of.
47
+ attr_accessor :task_group
48
+
49
+ attr_accessor :progress_reports
50
+
51
+ # Resources created by this task.
52
+ attr_accessor :created_resources
53
+
54
+ attr_accessor :reserved_resources_record
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'pulp_href' => :'pulp_href',
60
+ :'pulp_created' => :'pulp_created',
61
+ :'state' => :'state',
62
+ :'name' => :'name',
63
+ :'started_at' => :'started_at',
64
+ :'finished_at' => :'finished_at',
65
+ :'error' => :'error',
66
+ :'worker' => :'worker',
67
+ :'parent_task' => :'parent_task',
68
+ :'child_tasks' => :'child_tasks',
69
+ :'task_group' => :'task_group',
70
+ :'progress_reports' => :'progress_reports',
71
+ :'created_resources' => :'created_resources',
72
+ :'reserved_resources_record' => :'reserved_resources_record'
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'pulp_href' => :'String',
80
+ :'pulp_created' => :'DateTime',
81
+ :'state' => :'String',
82
+ :'name' => :'String',
83
+ :'started_at' => :'DateTime',
84
+ :'finished_at' => :'DateTime',
85
+ :'error' => :'Hash<String, Object>',
86
+ :'worker' => :'String',
87
+ :'parent_task' => :'String',
88
+ :'child_tasks' => :'Array<String>',
89
+ :'task_group' => :'String',
90
+ :'progress_reports' => :'Array<ProgressReport>',
91
+ :'created_resources' => :'Array<String>',
92
+ :'reserved_resources_record' => :'Array<Object>'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ ])
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::TaskRead` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!self.class.attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::TaskRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'pulp_href')
118
+ self.pulp_href = attributes[:'pulp_href']
119
+ end
120
+
121
+ if attributes.key?(:'pulp_created')
122
+ self.pulp_created = attributes[:'pulp_created']
123
+ end
124
+
125
+ if attributes.key?(:'state')
126
+ self.state = attributes[:'state']
127
+ end
128
+
129
+ if attributes.key?(:'name')
130
+ self.name = attributes[:'name']
131
+ end
132
+
133
+ if attributes.key?(:'started_at')
134
+ self.started_at = attributes[:'started_at']
135
+ end
136
+
137
+ if attributes.key?(:'finished_at')
138
+ self.finished_at = attributes[:'finished_at']
139
+ end
140
+
141
+ if attributes.key?(:'error')
142
+ if (value = attributes[:'error']).is_a?(Hash)
143
+ self.error = value
144
+ end
145
+ end
146
+
147
+ if attributes.key?(:'worker')
148
+ self.worker = attributes[:'worker']
149
+ end
150
+
151
+ if attributes.key?(:'parent_task')
152
+ self.parent_task = attributes[:'parent_task']
153
+ end
154
+
155
+ if attributes.key?(:'child_tasks')
156
+ if (value = attributes[:'child_tasks']).is_a?(Array)
157
+ self.child_tasks = value
158
+ end
159
+ end
160
+
161
+ if attributes.key?(:'task_group')
162
+ self.task_group = attributes[:'task_group']
163
+ end
164
+
165
+ if attributes.key?(:'progress_reports')
166
+ if (value = attributes[:'progress_reports']).is_a?(Array)
167
+ self.progress_reports = value
168
+ end
169
+ end
170
+
171
+ if attributes.key?(:'created_resources')
172
+ if (value = attributes[:'created_resources']).is_a?(Array)
173
+ self.created_resources = value
174
+ end
175
+ end
176
+
177
+ if attributes.key?(:'reserved_resources_record')
178
+ if (value = attributes[:'reserved_resources_record']).is_a?(Array)
179
+ self.reserved_resources_record = value
180
+ end
181
+ end
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ invalid_properties = Array.new
188
+ if !@state.nil? && @state.to_s.length < 1
189
+ invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.')
190
+ end
191
+
192
+ if @name.nil?
193
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
194
+ end
195
+
196
+ if @name.to_s.length < 1
197
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
198
+ end
199
+
200
+ invalid_properties
201
+ end
202
+
203
+ # Check to see if the all the properties in the model are valid
204
+ # @return true if the model is valid
205
+ def valid?
206
+ return false if !@state.nil? && @state.to_s.length < 1
207
+ return false if @name.nil?
208
+ return false if @name.to_s.length < 1
209
+ true
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] state Value to be assigned
214
+ def state=(state)
215
+ if !state.nil? && state.to_s.length < 1
216
+ fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.'
217
+ end
218
+
219
+ @state = state
220
+ end
221
+
222
+ # Custom attribute writer method with validation
223
+ # @param [Object] name Value to be assigned
224
+ def name=(name)
225
+ if name.nil?
226
+ fail ArgumentError, 'name cannot be nil'
227
+ end
228
+
229
+ if name.to_s.length < 1
230
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
231
+ end
232
+
233
+ @name = name
234
+ end
235
+
236
+ # Checks equality by comparing each attribute.
237
+ # @param [Object] Object to be compared
238
+ def ==(o)
239
+ return true if self.equal?(o)
240
+ self.class == o.class &&
241
+ pulp_href == o.pulp_href &&
242
+ pulp_created == o.pulp_created &&
243
+ state == o.state &&
244
+ name == o.name &&
245
+ started_at == o.started_at &&
246
+ finished_at == o.finished_at &&
247
+ error == o.error &&
248
+ worker == o.worker &&
249
+ parent_task == o.parent_task &&
250
+ child_tasks == o.child_tasks &&
251
+ task_group == o.task_group &&
252
+ progress_reports == o.progress_reports &&
253
+ created_resources == o.created_resources &&
254
+ reserved_resources_record == o.reserved_resources_record
255
+ end
256
+
257
+ # @see the `==` method
258
+ # @param [Object] Object to be compared
259
+ def eql?(o)
260
+ self == o
261
+ end
262
+
263
+ # Calculates hash code according to all attributes.
264
+ # @return [Integer] Hash code
265
+ def hash
266
+ [pulp_href, pulp_created, state, name, started_at, finished_at, error, worker, parent_task, child_tasks, task_group, progress_reports, created_resources, reserved_resources_record].hash
267
+ end
268
+
269
+ # Builds the object from hash
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ # @return [Object] Returns the model itself
272
+ def self.build_from_hash(attributes)
273
+ new.build_from_hash(attributes)
274
+ end
275
+
276
+ # Builds the object from hash
277
+ # @param [Hash] attributes Model attributes in the form of hash
278
+ # @return [Object] Returns the model itself
279
+ def build_from_hash(attributes)
280
+ return nil unless attributes.is_a?(Hash)
281
+ self.class.openapi_types.each_pair do |key, type|
282
+ if type =~ /\AArray<(.*)>/i
283
+ # check to ensure the input is an array given that the attribute
284
+ # is documented as an array but the input is not
285
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
286
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
287
+ end
288
+ elsif !attributes[self.class.attribute_map[key]].nil?
289
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
290
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
291
+ end
292
+
293
+ self
294
+ end
295
+
296
+ # Deserializes the data based on type
297
+ # @param string type Data type
298
+ # @param string value Value to be deserialized
299
+ # @return [Object] Deserialized data
300
+ def _deserialize(type, value)
301
+ case type.to_sym
302
+ when :DateTime
303
+ DateTime.parse(value)
304
+ when :Date
305
+ Date.parse(value)
306
+ when :String
307
+ value.to_s
308
+ when :Integer
309
+ value.to_i
310
+ when :Float
311
+ value.to_f
312
+ when :Boolean
313
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
314
+ true
315
+ else
316
+ false
317
+ end
318
+ when :Object
319
+ # generic object (usually a Hash), return directly
320
+ value
321
+ when /\AArray<(?<inner_type>.+)>\z/
322
+ inner_type = Regexp.last_match[:inner_type]
323
+ value.map { |v| _deserialize(inner_type, v) }
324
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
325
+ k_type = Regexp.last_match[:k_type]
326
+ v_type = Regexp.last_match[:v_type]
327
+ {}.tap do |hash|
328
+ value.each do |k, v|
329
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
330
+ end
331
+ end
332
+ else # model
333
+ PulpcoreClient.const_get(type).build_from_hash(value)
334
+ end
335
+ end
336
+
337
+ # Returns the string representation of the object
338
+ # @return [String] String presentation of the object
339
+ def to_s
340
+ to_hash.to_s
341
+ end
342
+
343
+ # to_body is an alias to to_hash (backward compatibility)
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_body
346
+ to_hash
347
+ end
348
+
349
+ # Returns the object in the form of hash
350
+ # @return [Hash] Returns the object in the form of hash
351
+ def to_hash
352
+ hash = {}
353
+ self.class.attribute_map.each_pair do |attr, param|
354
+ value = self.send(attr)
355
+ if value.nil?
356
+ is_nullable = self.class.openapi_nullable.include?(attr)
357
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
358
+ end
359
+
360
+ hash[param] = _to_hash(value)
361
+ end
362
+ hash
363
+ end
364
+
365
+ # Outputs non-array value in the form of hash
366
+ # For object, use to_hash. Otherwise, just return the value
367
+ # @param [Object] value Any valid value
368
+ # @return [Hash] Returns the value in the form of hash
369
+ def _to_hash(value)
370
+ if value.is_a?(Array)
371
+ value.compact.map { |v| _to_hash(v) }
372
+ elsif value.is_a?(Hash)
373
+ {}.tap do |hash|
374
+ value.each { |k, v| hash[k] = _to_hash(v) }
375
+ end
376
+ elsif value.respond_to? :to_hash
377
+ value.to_hash
378
+ else
379
+ value
380
+ end
381
+ end
382
+ end
383
+ end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module PulpcoreClient
16
- class UploadDetail
16
+ class UploadDetailRead
17
17
  attr_accessor :pulp_href
18
18
 
19
19
  # Timestamp of creation.
@@ -59,13 +59,13 @@ module PulpcoreClient
59
59
  # @param [Hash] attributes Model attributes in the form of hash
60
60
  def initialize(attributes = {})
61
61
  if (!attributes.is_a?(Hash))
62
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::UploadDetail` initialize method"
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::UploadDetailRead` initialize method"
63
63
  end
64
64
 
65
65
  # check to see if the attribute exists and convert string to symbol for hash key
66
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
67
67
  if (!self.class.attribute_map.key?(k.to_sym))
68
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::UploadDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::UploadDetailRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
69
  end
70
70
  h[k.to_sym] = v
71
71
  }
@@ -0,0 +1,241 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpcoreClient
16
+ class UploadRead
17
+ attr_accessor :pulp_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :pulp_created
21
+
22
+ # The size of the upload in bytes.
23
+ attr_accessor :size
24
+
25
+ # Timestamp when upload is committed.
26
+ attr_accessor :completed
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'pulp_href' => :'pulp_href',
32
+ :'pulp_created' => :'pulp_created',
33
+ :'size' => :'size',
34
+ :'completed' => :'completed'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'pulp_href' => :'String',
42
+ :'pulp_created' => :'DateTime',
43
+ :'size' => :'Integer',
44
+ :'completed' => :'DateTime'
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 `PulpcoreClient::UploadRead` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::UploadRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'pulp_href')
70
+ self.pulp_href = attributes[:'pulp_href']
71
+ end
72
+
73
+ if attributes.key?(:'pulp_created')
74
+ self.pulp_created = attributes[:'pulp_created']
75
+ end
76
+
77
+ if attributes.key?(:'size')
78
+ self.size = attributes[:'size']
79
+ end
80
+
81
+ if attributes.key?(:'completed')
82
+ self.completed = attributes[:'completed']
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 @size.nil?
91
+ invalid_properties.push('invalid value for "size", size cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if @size.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ pulp_href == o.pulp_href &&
110
+ pulp_created == o.pulp_created &&
111
+ size == o.size &&
112
+ completed == o.completed
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [pulp_href, pulp_created, size, completed].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ new.build_from_hash(attributes)
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ self.class.openapi_types.each_pair do |key, type|
140
+ if type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :DateTime
161
+ DateTime.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ PulpcoreClient.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+ end
241
+ end