pulp_python_client 3.32.1 → 3.34.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -4
  3. data/docs/ContentPackagesApi.md +2 -0
  4. data/docs/ContentYanksApi.md +341 -0
  5. data/docs/PaginatedpythonPackageYankResponseList.md +24 -0
  6. data/docs/PatchedpythonPythonRepository.md +3 -1
  7. data/docs/PypiLegacyApi.md +2 -2
  8. data/docs/PypiSimpleApi.md +2 -2
  9. data/docs/PypiUnyankApi.md +84 -0
  10. data/docs/PypiYankApi.md +84 -0
  11. data/docs/PythonPackageYankResponse.md +34 -0
  12. data/docs/PythonPythonRepository.md +3 -1
  13. data/docs/PythonPythonRepositoryResponse.md +2 -0
  14. data/docs/Yank.md +22 -0
  15. data/lib/pulp_python_client/api/content_packages_api.rb +3 -0
  16. data/lib/pulp_python_client/api/content_yanks_api.rb +354 -0
  17. data/lib/pulp_python_client/api/pypi_legacy_api.rb +2 -2
  18. data/lib/pulp_python_client/api/pypi_simple_api.rb +2 -2
  19. data/lib/pulp_python_client/api/pypi_unyank_api.rb +99 -0
  20. data/lib/pulp_python_client/api/pypi_yank_api.rb +99 -0
  21. data/lib/pulp_python_client/models/metadata_version_enum.rb +2 -1
  22. data/lib/pulp_python_client/models/paginatedpython_package_yank_response_list.rb +257 -0
  23. data/lib/pulp_python_client/models/patchedpython_python_repository.rb +16 -4
  24. data/lib/pulp_python_client/models/python_package_yank_response.rb +293 -0
  25. data/lib/pulp_python_client/models/python_python_repository.rb +16 -4
  26. data/lib/pulp_python_client/models/python_python_repository_response.rb +13 -1
  27. data/lib/pulp_python_client/models/yank.rb +290 -0
  28. data/lib/pulp_python_client/version.rb +1 -1
  29. data/lib/pulp_python_client.rb +6 -0
  30. data/spec/api/content_packages_api_spec.rb +1 -0
  31. data/spec/api/content_yanks_api_spec.rb +104 -0
  32. data/spec/api/pypi_legacy_api_spec.rb +1 -1
  33. data/spec/api/pypi_simple_api_spec.rb +1 -1
  34. data/spec/api/pypi_unyank_api_spec.rb +49 -0
  35. data/spec/api/pypi_yank_api_spec.rb +49 -0
  36. data/spec/models/paginatedpython_package_yank_response_list_spec.rb +54 -0
  37. data/spec/models/patchedpython_python_repository_spec.rb +6 -0
  38. data/spec/models/python_package_yank_response_spec.rb +84 -0
  39. data/spec/models/python_python_repository_response_spec.rb +6 -0
  40. data/spec/models/python_python_repository_spec.rb +6 -0
  41. data/spec/models/yank_spec.rb +48 -0
  42. metadata +71 -47
@@ -0,0 +1,293 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpPythonClient
17
+ # Read-only serializer for PackageYank content units (PEP 592). Used by PackageYankViewSet to expose yank markers via the Pulp REST API.
18
+ class PythonPackageYankResponse
19
+ attr_accessor :pulp_href
20
+
21
+ # The Pulp Resource Name (PRN).
22
+ attr_accessor :prn
23
+
24
+ # Timestamp of creation.
25
+ attr_accessor :pulp_created
26
+
27
+ # Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.
28
+ attr_accessor :pulp_last_updated
29
+
30
+ # A dictionary of arbitrary key/value pairs used to describe a specific Content instance.
31
+ attr_accessor :pulp_labels
32
+
33
+ attr_accessor :vuln_report
34
+
35
+ attr_accessor :name_normalized
36
+
37
+ attr_accessor :version
38
+
39
+ attr_accessor :yanked_reason
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'pulp_href' => :'pulp_href',
45
+ :'prn' => :'prn',
46
+ :'pulp_created' => :'pulp_created',
47
+ :'pulp_last_updated' => :'pulp_last_updated',
48
+ :'pulp_labels' => :'pulp_labels',
49
+ :'vuln_report' => :'vuln_report',
50
+ :'name_normalized' => :'name_normalized',
51
+ :'version' => :'version',
52
+ :'yanked_reason' => :'yanked_reason'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'pulp_href' => :'String',
65
+ :'prn' => :'String',
66
+ :'pulp_created' => :'Time',
67
+ :'pulp_last_updated' => :'Time',
68
+ :'pulp_labels' => :'Hash<String, String>',
69
+ :'vuln_report' => :'String',
70
+ :'name_normalized' => :'String',
71
+ :'version' => :'String',
72
+ :'yanked_reason' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PythonPackageYankResponse` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::PythonPackageYankResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'pulp_href')
98
+ self.pulp_href = attributes[:'pulp_href']
99
+ end
100
+
101
+ if attributes.key?(:'prn')
102
+ self.prn = attributes[:'prn']
103
+ end
104
+
105
+ if attributes.key?(:'pulp_created')
106
+ self.pulp_created = attributes[:'pulp_created']
107
+ end
108
+
109
+ if attributes.key?(:'pulp_last_updated')
110
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
111
+ end
112
+
113
+ if attributes.key?(:'pulp_labels')
114
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
115
+ self.pulp_labels = value
116
+ end
117
+ end
118
+
119
+ if attributes.key?(:'vuln_report')
120
+ self.vuln_report = attributes[:'vuln_report']
121
+ end
122
+
123
+ if attributes.key?(:'name_normalized')
124
+ self.name_normalized = attributes[:'name_normalized']
125
+ end
126
+
127
+ if attributes.key?(:'version')
128
+ self.version = attributes[:'version']
129
+ end
130
+
131
+ if attributes.key?(:'yanked_reason')
132
+ self.yanked_reason = attributes[:'yanked_reason']
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
140
+ invalid_properties = Array.new
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ warn '[DEPRECATED] the `valid?` method is obsolete'
148
+ true
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ pulp_href == o.pulp_href &&
157
+ prn == o.prn &&
158
+ pulp_created == o.pulp_created &&
159
+ pulp_last_updated == o.pulp_last_updated &&
160
+ pulp_labels == o.pulp_labels &&
161
+ vuln_report == o.vuln_report &&
162
+ name_normalized == o.name_normalized &&
163
+ version == o.version &&
164
+ yanked_reason == o.yanked_reason
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [pulp_href, prn, pulp_created, pulp_last_updated, pulp_labels, vuln_report, name_normalized, version, yanked_reason].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ transformed_hash = {}
186
+ openapi_types.each_pair do |key, type|
187
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[attribute_map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def self._deserialize(type, value)
207
+ case type.to_sym
208
+ when :Time
209
+ Time.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ # models (e.g. Pet) or oneOf
240
+ klass = PulpPythonClient.const_get(type)
241
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
242
+ end
243
+ end
244
+
245
+ # Returns the string representation of the object
246
+ # @return [String] String presentation of the object
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_hash (backward compatibility)
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_body
254
+ to_hash
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+
291
+ end
292
+
293
+ end
@@ -39,6 +39,9 @@ module PulpPythonClient
39
39
  # Whether to allow package substitution (replacing existing packages with packages that have the same filename but a different checksum). When False, any new repository version that would cause such a substitution will be rejected. This applies to all repository version creation paths including uploads, modify, and sync. When True (the default), package substitution is allowed.
40
40
  attr_accessor :allow_package_substitution
41
41
 
42
+ # Whether to fail the entire repository version when packages are rejected by the package substitution or blocklist policies. When True (the default), a ValidationError is raised and no packages from the request are added. When False, rejected packages are skipped and remaining packages are added; skipped packages are recorded in a task progress report.
43
+ attr_accessor :error_on_reject
44
+
42
45
  # Attribute mapping from ruby-style variable name to JSON key.
43
46
  def self.attribute_map
44
47
  {
@@ -49,7 +52,8 @@ module PulpPythonClient
49
52
  :'retain_checkpoints' => :'retain_checkpoints',
50
53
  :'remote' => :'remote',
51
54
  :'autopublish' => :'autopublish',
52
- :'allow_package_substitution' => :'allow_package_substitution'
55
+ :'allow_package_substitution' => :'allow_package_substitution',
56
+ :'error_on_reject' => :'error_on_reject'
53
57
  }
54
58
  end
55
59
 
@@ -68,7 +72,8 @@ module PulpPythonClient
68
72
  :'retain_checkpoints' => :'Integer',
69
73
  :'remote' => :'String',
70
74
  :'autopublish' => :'Boolean',
71
- :'allow_package_substitution' => :'Boolean'
75
+ :'allow_package_substitution' => :'Boolean',
76
+ :'error_on_reject' => :'Boolean'
72
77
  }
73
78
  end
74
79
 
@@ -136,6 +141,12 @@ module PulpPythonClient
136
141
  else
137
142
  self.allow_package_substitution = true
138
143
  end
144
+
145
+ if attributes.key?(:'error_on_reject')
146
+ self.error_on_reject = attributes[:'error_on_reject']
147
+ else
148
+ self.error_on_reject = true
149
+ end
139
150
  end
140
151
 
141
152
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -234,7 +245,8 @@ module PulpPythonClient
234
245
  retain_checkpoints == o.retain_checkpoints &&
235
246
  remote == o.remote &&
236
247
  autopublish == o.autopublish &&
237
- allow_package_substitution == o.allow_package_substitution
248
+ allow_package_substitution == o.allow_package_substitution &&
249
+ error_on_reject == o.error_on_reject
238
250
  end
239
251
 
240
252
  # @see the `==` method
@@ -246,7 +258,7 @@ module PulpPythonClient
246
258
  # Calculates hash code according to all attributes.
247
259
  # @return [Integer] Hash code
248
260
  def hash
249
- [pulp_labels, name, description, retain_repo_versions, retain_checkpoints, remote, autopublish, allow_package_substitution].hash
261
+ [pulp_labels, name, description, retain_repo_versions, retain_checkpoints, remote, autopublish, allow_package_substitution, error_on_reject].hash
250
262
  end
251
263
 
252
264
  # Builds the object from hash
@@ -54,6 +54,9 @@ module PulpPythonClient
54
54
  # Whether to allow package substitution (replacing existing packages with packages that have the same filename but a different checksum). When False, any new repository version that would cause such a substitution will be rejected. This applies to all repository version creation paths including uploads, modify, and sync. When True (the default), package substitution is allowed.
55
55
  attr_accessor :allow_package_substitution
56
56
 
57
+ # Whether to fail the entire repository version when packages are rejected by the package substitution or blocklist policies. When True (the default), a ValidationError is raised and no packages from the request are added. When False, rejected packages are skipped and remaining packages are added; skipped packages are recorded in a task progress report.
58
+ attr_accessor :error_on_reject
59
+
57
60
  # URL to the blocklist entries for this repository.
58
61
  attr_accessor :blocklist_entries_href
59
62
 
@@ -74,6 +77,7 @@ module PulpPythonClient
74
77
  :'remote' => :'remote',
75
78
  :'autopublish' => :'autopublish',
76
79
  :'allow_package_substitution' => :'allow_package_substitution',
80
+ :'error_on_reject' => :'error_on_reject',
77
81
  :'blocklist_entries_href' => :'blocklist_entries_href'
78
82
  }
79
83
  end
@@ -100,6 +104,7 @@ module PulpPythonClient
100
104
  :'remote' => :'String',
101
105
  :'autopublish' => :'Boolean',
102
106
  :'allow_package_substitution' => :'Boolean',
107
+ :'error_on_reject' => :'Boolean',
103
108
  :'blocklist_entries_href' => :'String'
104
109
  }
105
110
  end
@@ -193,6 +198,12 @@ module PulpPythonClient
193
198
  self.allow_package_substitution = true
194
199
  end
195
200
 
201
+ if attributes.key?(:'error_on_reject')
202
+ self.error_on_reject = attributes[:'error_on_reject']
203
+ else
204
+ self.error_on_reject = true
205
+ end
206
+
196
207
  if attributes.key?(:'blocklist_entries_href')
197
208
  self.blocklist_entries_href = attributes[:'blocklist_entries_href']
198
209
  end
@@ -267,6 +278,7 @@ module PulpPythonClient
267
278
  remote == o.remote &&
268
279
  autopublish == o.autopublish &&
269
280
  allow_package_substitution == o.allow_package_substitution &&
281
+ error_on_reject == o.error_on_reject &&
270
282
  blocklist_entries_href == o.blocklist_entries_href
271
283
  end
272
284
 
@@ -279,7 +291,7 @@ module PulpPythonClient
279
291
  # Calculates hash code according to all attributes.
280
292
  # @return [Integer] Hash code
281
293
  def hash
282
- [pulp_href, prn, pulp_created, pulp_last_updated, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, retain_checkpoints, remote, autopublish, allow_package_substitution, blocklist_entries_href].hash
294
+ [pulp_href, prn, pulp_created, pulp_last_updated, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, retain_checkpoints, remote, autopublish, allow_package_substitution, error_on_reject, blocklist_entries_href].hash
283
295
  end
284
296
 
285
297
  # Builds the object from hash
@@ -0,0 +1,290 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpPythonClient
17
+ # A Serializer for yank/unyank requests (PEP 592).
18
+ class Yank
19
+ # The name of the package to yank or unyank.
20
+ attr_accessor :name
21
+
22
+ # The version of the package to yank or unyank.
23
+ attr_accessor :version
24
+
25
+ # The reason for yanking the package version.
26
+ attr_accessor :yanked_reason
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'name' => :'name',
32
+ :'version' => :'version',
33
+ :'yanked_reason' => :'yanked_reason'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'name' => :'String',
46
+ :'version' => :'String',
47
+ :'yanked_reason' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::Yank` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::Yank`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'name')
73
+ self.name = attributes[:'name']
74
+ else
75
+ self.name = nil
76
+ end
77
+
78
+ if attributes.key?(:'version')
79
+ self.version = attributes[:'version']
80
+ else
81
+ self.version = nil
82
+ end
83
+
84
+ if attributes.key?(:'yanked_reason')
85
+ self.yanked_reason = attributes[:'yanked_reason']
86
+ else
87
+ self.yanked_reason = ''
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ if @name.nil?
97
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
98
+ end
99
+
100
+ if @name.to_s.length < 1
101
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
102
+ end
103
+
104
+ if @version.nil?
105
+ invalid_properties.push('invalid value for "version", version cannot be nil.')
106
+ end
107
+
108
+ if @version.to_s.length < 1
109
+ invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ warn '[DEPRECATED] the `valid?` method is obsolete'
119
+ return false if @name.nil?
120
+ return false if @name.to_s.length < 1
121
+ return false if @version.nil?
122
+ return false if @version.to_s.length < 1
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] name Value to be assigned
128
+ def name=(name)
129
+ if name.nil?
130
+ fail ArgumentError, 'name cannot be nil'
131
+ end
132
+
133
+ if name.to_s.length < 1
134
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
135
+ end
136
+
137
+ @name = name
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] version Value to be assigned
142
+ def version=(version)
143
+ if version.nil?
144
+ fail ArgumentError, 'version cannot be nil'
145
+ end
146
+
147
+ if version.to_s.length < 1
148
+ fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
149
+ end
150
+
151
+ @version = version
152
+ end
153
+
154
+ # Checks equality by comparing each attribute.
155
+ # @param [Object] Object to be compared
156
+ def ==(o)
157
+ return true if self.equal?(o)
158
+ self.class == o.class &&
159
+ name == o.name &&
160
+ version == o.version &&
161
+ yanked_reason == o.yanked_reason
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [name, version, yanked_reason].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ transformed_hash = {}
183
+ openapi_types.each_pair do |key, type|
184
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = nil
186
+ elsif type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[attribute_map[key]].is_a?(Array)
190
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
191
+ end
192
+ elsif !attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
194
+ end
195
+ end
196
+ new(transformed_hash)
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def self._deserialize(type, value)
204
+ case type.to_sym
205
+ when :Time
206
+ Time.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ # models (e.g. Pet) or oneOf
237
+ klass = PulpPythonClient.const_get(type)
238
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end
@@ -11,5 +11,5 @@ Generator version: 7.10.0
11
11
  =end
12
12
 
13
13
  module PulpPythonClient
14
- VERSION = '3.32.1'
14
+ VERSION = '3.34.0'
15
15
  end