pulp_python_client 3.12.5 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -16
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentPackagesApi.md +170 -120
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsPypiApi.md +385 -182
  7. data/docs/ExcludePlatformsEnum.md +4 -5
  8. data/docs/MyPermissionsResponse.md +8 -7
  9. data/docs/NestedRole.md +12 -11
  10. data/docs/NestedRoleResponse.md +12 -11
  11. data/docs/ObjectRolesResponse.md +8 -7
  12. data/docs/PackageMetadataResponse.md +14 -13
  13. data/docs/PackageTypesEnum.md +4 -5
  14. data/docs/PackageUploadTaskResponse.md +12 -11
  15. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  16. data/docs/PaginatedpythonPythonDistributionResponseList.md +14 -13
  17. data/docs/PaginatedpythonPythonPackageContentResponseList.md +14 -13
  18. data/docs/PaginatedpythonPythonPublicationResponseList.md +14 -13
  19. data/docs/PaginatedpythonPythonRemoteResponseList.md +14 -13
  20. data/docs/PaginatedpythonPythonRepositoryResponseList.md +14 -13
  21. data/docs/PatchedpythonPythonDistribution.md +24 -23
  22. data/docs/PatchedpythonPythonRemote.md +60 -59
  23. data/docs/PatchedpythonPythonRepository.md +18 -17
  24. data/docs/PolicyEnum.md +4 -5
  25. data/docs/PublicationsPypiApi.md +267 -130
  26. data/docs/PypiApi.md +33 -17
  27. data/docs/PypiLegacyApi.md +34 -18
  28. data/docs/PypiMetadataApi.md +34 -18
  29. data/docs/PypiSimpleApi.md +95 -45
  30. data/docs/PythonPythonDistribution.md +24 -23
  31. data/docs/PythonPythonDistributionResponse.md +36 -35
  32. data/docs/PythonPythonPackageContentResponse.md +70 -69
  33. data/docs/PythonPythonPublication.md +10 -9
  34. data/docs/PythonPythonPublicationResponse.md +20 -19
  35. data/docs/PythonPythonRemote.md +60 -59
  36. data/docs/PythonPythonRemoteResponse.md +60 -59
  37. data/docs/PythonPythonRemoteResponseHiddenFieldsInner.md +20 -0
  38. data/docs/PythonPythonRepository.md +18 -17
  39. data/docs/PythonPythonRepositoryResponse.md +30 -29
  40. data/docs/RemotesPythonApi.md +420 -198
  41. data/docs/Repair.md +8 -7
  42. data/docs/RepositoriesPythonApi.md +444 -207
  43. data/docs/RepositoriesPythonVersionsApi.md +152 -82
  44. data/docs/RepositoryAddRemoveContent.md +12 -11
  45. data/docs/RepositorySyncURL.md +10 -9
  46. data/docs/RepositoryVersionResponse.md +22 -21
  47. data/docs/SetLabel.md +10 -9
  48. data/docs/SetLabelResponse.md +10 -9
  49. data/docs/SummaryResponse.md +12 -11
  50. data/docs/UnsetLabel.md +8 -7
  51. data/docs/UnsetLabelResponse.md +10 -9
  52. data/lib/pulp_python_client/api/content_packages_api.rb +21 -15
  53. data/lib/pulp_python_client/api/distributions_pypi_api.rb +89 -56
  54. data/lib/pulp_python_client/api/publications_pypi_api.rb +67 -47
  55. data/lib/pulp_python_client/api/pypi_api.rb +6 -5
  56. data/lib/pulp_python_client/api/pypi_legacy_api.rb +11 -7
  57. data/lib/pulp_python_client/api/pypi_metadata_api.rb +6 -5
  58. data/lib/pulp_python_client/api/pypi_simple_api.rb +19 -13
  59. data/lib/pulp_python_client/api/remotes_python_api.rb +113 -73
  60. data/lib/pulp_python_client/api/repositories_python_api.rb +107 -66
  61. data/lib/pulp_python_client/api/repositories_python_versions_api.rb +40 -30
  62. data/lib/pulp_python_client/api_client.rb +137 -102
  63. data/lib/pulp_python_client/api_error.rb +2 -1
  64. data/lib/pulp_python_client/configuration.rb +162 -21
  65. data/lib/pulp_python_client/models/async_operation_response.rb +32 -22
  66. data/lib/pulp_python_client/models/content_summary_response.rb +36 -22
  67. data/lib/pulp_python_client/models/exclude_platforms_enum.rb +8 -4
  68. data/lib/pulp_python_client/models/my_permissions_response.rb +32 -22
  69. data/lib/pulp_python_client/models/nested_role.rb +32 -22
  70. data/lib/pulp_python_client/models/nested_role_response.rb +32 -22
  71. data/lib/pulp_python_client/models/object_roles_response.rb +32 -22
  72. data/lib/pulp_python_client/models/package_metadata_response.rb +41 -37
  73. data/lib/pulp_python_client/models/package_types_enum.rb +8 -4
  74. data/lib/pulp_python_client/models/package_upload_task_response.rb +37 -23
  75. data/lib/pulp_python_client/models/paginated_repository_version_response_list.rb +34 -22
  76. data/lib/pulp_python_client/models/paginatedpython_python_distribution_response_list.rb +34 -22
  77. data/lib/pulp_python_client/models/paginatedpython_python_package_content_response_list.rb +34 -22
  78. data/lib/pulp_python_client/models/paginatedpython_python_publication_response_list.rb +34 -22
  79. data/lib/pulp_python_client/models/paginatedpython_python_remote_response_list.rb +34 -22
  80. data/lib/pulp_python_client/models/paginatedpython_python_repository_response_list.rb +34 -22
  81. data/lib/pulp_python_client/models/patchedpython_python_distribution.rb +40 -24
  82. data/lib/pulp_python_client/models/patchedpython_python_remote.rb +82 -44
  83. data/lib/pulp_python_client/models/patchedpython_python_repository.rb +35 -23
  84. data/lib/pulp_python_client/models/policy_enum.rb +8 -4
  85. data/lib/pulp_python_client/models/python_python_distribution.rb +34 -22
  86. data/lib/pulp_python_client/models/python_python_distribution_response.rb +36 -24
  87. data/lib/pulp_python_client/models/python_python_package_content_response.rb +38 -24
  88. data/lib/pulp_python_client/models/python_python_publication.rb +30 -22
  89. data/lib/pulp_python_client/models/python_python_publication_response.rb +32 -24
  90. data/lib/pulp_python_client/models/python_python_remote.rb +76 -42
  91. data/lib/pulp_python_client/models/python_python_remote_response.rb +79 -45
  92. data/lib/pulp_python_client/models/{python_python_remote_response_hidden_fields.rb → python_python_remote_response_hidden_fields_inner.rb} +37 -25
  93. data/lib/pulp_python_client/models/python_python_repository.rb +32 -22
  94. data/lib/pulp_python_client/models/python_python_repository_response.rb +34 -24
  95. data/lib/pulp_python_client/models/repair.rb +30 -22
  96. data/lib/pulp_python_client/models/repository_add_remove_content.rb +30 -22
  97. data/lib/pulp_python_client/models/repository_sync_url.rb +30 -22
  98. data/lib/pulp_python_client/models/repository_version_response.rb +32 -24
  99. data/lib/pulp_python_client/models/set_label.rb +34 -22
  100. data/lib/pulp_python_client/models/set_label_response.rb +34 -22
  101. data/lib/pulp_python_client/models/summary_response.rb +36 -22
  102. data/lib/pulp_python_client/models/unset_label.rb +32 -22
  103. data/lib/pulp_python_client/models/unset_label_response.rb +32 -22
  104. data/lib/pulp_python_client/version.rb +2 -2
  105. data/lib/pulp_python_client.rb +2 -5
  106. data/pulp_python_client.gemspec +9 -6
  107. data/spec/api/content_packages_api_spec.rb +4 -4
  108. data/spec/api/distributions_pypi_api_spec.rb +13 -13
  109. data/spec/api/publications_pypi_api_spec.rb +16 -15
  110. data/spec/api/pypi_api_spec.rb +2 -2
  111. data/spec/api/pypi_legacy_api_spec.rb +2 -2
  112. data/spec/api/pypi_metadata_api_spec.rb +2 -2
  113. data/spec/api/pypi_simple_api_spec.rb +4 -4
  114. data/spec/api/remotes_python_api_spec.rb +21 -20
  115. data/spec/api/repositories_python_api_spec.rb +15 -15
  116. data/spec/api/repositories_python_versions_api_spec.rb +12 -11
  117. data/spec/models/async_operation_response_spec.rb +7 -12
  118. data/spec/models/content_summary_response_spec.rb +9 -14
  119. data/spec/models/exclude_platforms_enum_spec.rb +6 -11
  120. data/spec/models/my_permissions_response_spec.rb +7 -12
  121. data/spec/models/nested_role_response_spec.rb +9 -14
  122. data/spec/models/nested_role_spec.rb +9 -14
  123. data/spec/models/object_roles_response_spec.rb +7 -12
  124. data/spec/models/package_metadata_response_spec.rb +10 -15
  125. data/spec/models/package_types_enum_spec.rb +6 -11
  126. data/spec/models/package_upload_task_response_spec.rb +9 -14
  127. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  128. data/spec/models/paginatedpython_python_distribution_response_list_spec.rb +10 -15
  129. data/spec/models/paginatedpython_python_package_content_response_list_spec.rb +10 -15
  130. data/spec/models/paginatedpython_python_publication_response_list_spec.rb +10 -15
  131. data/spec/models/paginatedpython_python_remote_response_list_spec.rb +10 -15
  132. data/spec/models/paginatedpython_python_repository_response_list_spec.rb +10 -15
  133. data/spec/models/patchedpython_python_distribution_spec.rb +15 -20
  134. data/spec/models/patchedpython_python_remote_spec.rb +33 -38
  135. data/spec/models/patchedpython_python_repository_spec.rb +12 -17
  136. data/spec/models/policy_enum_spec.rb +6 -11
  137. data/spec/models/python_python_distribution_response_spec.rb +21 -26
  138. data/spec/models/python_python_distribution_spec.rb +15 -20
  139. data/spec/models/python_python_package_content_response_spec.rb +38 -43
  140. data/spec/models/python_python_publication_response_spec.rb +13 -18
  141. data/spec/models/python_python_publication_spec.rb +8 -13
  142. data/spec/models/{python_python_remote_response_hidden_fields_spec.rb → python_python_remote_response_hidden_fields_inner_spec.rb} +11 -16
  143. data/spec/models/python_python_remote_response_spec.rb +33 -38
  144. data/spec/models/python_python_remote_spec.rb +33 -38
  145. data/spec/models/python_python_repository_response_spec.rb +18 -23
  146. data/spec/models/python_python_repository_spec.rb +12 -17
  147. data/spec/models/repair_spec.rb +7 -12
  148. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  149. data/spec/models/repository_sync_url_spec.rb +8 -13
  150. data/spec/models/repository_version_response_spec.rb +14 -19
  151. data/spec/models/set_label_response_spec.rb +8 -13
  152. data/spec/models/set_label_spec.rb +8 -13
  153. data/spec/models/summary_response_spec.rb +9 -14
  154. data/spec/models/unset_label_response_spec.rb +8 -13
  155. data/spec/models/unset_label_spec.rb +7 -12
  156. data/spec/spec_helper.rb +1 -1
  157. metadata +81 -69
  158. data/docs/PackageUpload.md +0 -21
  159. data/docs/PythonBanderRemote.md +0 -21
  160. data/docs/PythonPythonPackageContent.md +0 -71
  161. data/docs/PythonPythonRemoteResponseHiddenFields.md +0 -19
  162. data/lib/pulp_python_client/models/package_upload.rb +0 -283
  163. data/lib/pulp_python_client/models/python_bander_remote.rb +0 -257
  164. data/lib/pulp_python_client/models/python_python_package_content.rb +0 -534
  165. data/spec/api_client_spec.rb +0 -188
  166. data/spec/configuration_spec.rb +0 -42
  167. data/spec/models/package_upload_spec.rb +0 -53
  168. data/spec/models/python_bander_remote_spec.rb +0 -53
  169. data/spec/models/python_python_package_content_spec.rb +0 -203
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpPythonClient
16
17
  class PaginatedpythonPythonRepositoryResponseList
@@ -32,6 +33,11 @@ module PulpPythonClient
32
33
  }
33
34
  end
34
35
 
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
35
41
  # Attribute type mapping.
36
42
  def self.openapi_types
37
43
  {
@@ -67,6 +73,8 @@ module PulpPythonClient
67
73
 
68
74
  if attributes.key?(:'count')
69
75
  self.count = attributes[:'count']
76
+ else
77
+ self.count = nil
70
78
  end
71
79
 
72
80
  if attributes.key?(:'_next')
@@ -81,12 +89,15 @@ module PulpPythonClient
81
89
  if (value = attributes[:'results']).is_a?(Array)
82
90
  self.results = value
83
91
  end
92
+ else
93
+ self.results = nil
84
94
  end
85
95
  end
86
96
 
87
97
  # Show invalid properties with the reasons. Usually used together with valid?
88
98
  # @return Array for valid properties with the reasons
89
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
101
  invalid_properties = Array.new
91
102
  if @count.nil?
92
103
  invalid_properties.push('invalid value for "count", count cannot be nil.')
@@ -102,6 +113,7 @@ module PulpPythonClient
102
113
  # Check to see if the all the properties in the model are valid
103
114
  # @return true if the model is valid
104
115
  def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
117
  return false if @count.nil?
106
118
  return false if @results.nil?
107
119
  true
@@ -134,37 +146,33 @@ module PulpPythonClient
134
146
  # @param [Hash] attributes Model attributes in the form of hash
135
147
  # @return [Object] Returns the model itself
136
148
  def self.build_from_hash(attributes)
137
- new.build_from_hash(attributes)
138
- end
139
-
140
- # Builds the object from hash
141
- # @param [Hash] attributes Model attributes in the form of hash
142
- # @return [Object] Returns the model itself
143
- def build_from_hash(attributes)
144
149
  return nil unless attributes.is_a?(Hash)
145
- self.class.openapi_types.each_pair do |key, type|
146
- if type =~ /\AArray<(.*)>/i
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
147
156
  # check to ensure the input is an array given that the attribute
148
157
  # is documented as an array but the input is not
149
- if attributes[self.class.attribute_map[key]].is_a?(Array)
150
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
160
  end
152
- elsif !attributes[self.class.attribute_map[key]].nil?
153
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
- end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
155
164
  end
156
-
157
- self
165
+ new(transformed_hash)
158
166
  end
159
167
 
160
168
  # Deserializes the data based on type
161
169
  # @param string type Data type
162
170
  # @param string value Value to be deserialized
163
171
  # @return [Object] Deserialized data
164
- def _deserialize(type, value)
172
+ def self._deserialize(type, value)
165
173
  case type.to_sym
166
- when :DateTime
167
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
168
176
  when :Date
169
177
  Date.parse(value)
170
178
  when :String
@@ -194,7 +202,9 @@ module PulpPythonClient
194
202
  end
195
203
  end
196
204
  else # model
197
- PulpPythonClient.const_get(type).build_from_hash(value)
205
+ # models (e.g. Pet) or oneOf
206
+ klass = PulpPythonClient.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
208
  end
199
209
  end
200
210
 
@@ -220,7 +230,7 @@ module PulpPythonClient
220
230
  is_nullable = self.class.openapi_nullable.include?(attr)
221
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
232
  end
223
-
233
+
224
234
  hash[param] = _to_hash(value)
225
235
  end
226
236
  hash
@@ -243,5 +253,7 @@ module PulpPythonClient
243
253
  value
244
254
  end
245
255
  end
256
+
246
257
  end
258
+
247
259
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpPythonClient
16
17
  # Serializer for Pulp distributions for the Python type.
@@ -56,6 +57,11 @@ module PulpPythonClient
56
57
  }
57
58
  end
58
59
 
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
59
65
  # Attribute type mapping.
60
66
  def self.openapi_types
61
67
  {
@@ -142,6 +148,7 @@ module PulpPythonClient
142
148
  # Show invalid properties with the reasons. Usually used together with valid?
143
149
  # @return Array for valid properties with the reasons
144
150
  def list_invalid_properties
151
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
145
152
  invalid_properties = Array.new
146
153
  if !@base_path.nil? && @base_path.to_s.length < 1
147
154
  invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
@@ -157,6 +164,7 @@ module PulpPythonClient
157
164
  # Check to see if the all the properties in the model are valid
158
165
  # @return true if the model is valid
159
166
  def valid?
167
+ warn '[DEPRECATED] the `valid?` method is obsolete'
160
168
  return false if !@base_path.nil? && @base_path.to_s.length < 1
161
169
  return false if !@name.nil? && @name.to_s.length < 1
162
170
  true
@@ -165,7 +173,11 @@ module PulpPythonClient
165
173
  # Custom attribute writer method with validation
166
174
  # @param [Object] base_path Value to be assigned
167
175
  def base_path=(base_path)
168
- if !base_path.nil? && base_path.to_s.length < 1
176
+ if base_path.nil?
177
+ fail ArgumentError, 'base_path cannot be nil'
178
+ end
179
+
180
+ if base_path.to_s.length < 1
169
181
  fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
170
182
  end
171
183
 
@@ -175,7 +187,11 @@ module PulpPythonClient
175
187
  # Custom attribute writer method with validation
176
188
  # @param [Object] name Value to be assigned
177
189
  def name=(name)
178
- if !name.nil? && name.to_s.length < 1
190
+ if name.nil?
191
+ fail ArgumentError, 'name cannot be nil'
192
+ end
193
+
194
+ if name.to_s.length < 1
179
195
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
180
196
  end
181
197
 
@@ -214,37 +230,33 @@ module PulpPythonClient
214
230
  # @param [Hash] attributes Model attributes in the form of hash
215
231
  # @return [Object] Returns the model itself
216
232
  def self.build_from_hash(attributes)
217
- new.build_from_hash(attributes)
218
- end
219
-
220
- # Builds the object from hash
221
- # @param [Hash] attributes Model attributes in the form of hash
222
- # @return [Object] Returns the model itself
223
- def build_from_hash(attributes)
224
233
  return nil unless attributes.is_a?(Hash)
225
- self.class.openapi_types.each_pair do |key, type|
226
- if type =~ /\AArray<(.*)>/i
234
+ attributes = attributes.transform_keys(&:to_sym)
235
+ transformed_hash = {}
236
+ openapi_types.each_pair do |key, type|
237
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = nil
239
+ elsif type =~ /\AArray<(.*)>/i
227
240
  # check to ensure the input is an array given that the attribute
228
241
  # is documented as an array but the input is not
229
- if attributes[self.class.attribute_map[key]].is_a?(Array)
230
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
242
+ if attributes[attribute_map[key]].is_a?(Array)
243
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
231
244
  end
232
- elsif !attributes[self.class.attribute_map[key]].nil?
233
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
- end # or else data not found in attributes(hash), not an issue as the data can be optional
245
+ elsif !attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
247
+ end
235
248
  end
236
-
237
- self
249
+ new(transformed_hash)
238
250
  end
239
251
 
240
252
  # Deserializes the data based on type
241
253
  # @param string type Data type
242
254
  # @param string value Value to be deserialized
243
255
  # @return [Object] Deserialized data
244
- def _deserialize(type, value)
256
+ def self._deserialize(type, value)
245
257
  case type.to_sym
246
- when :DateTime
247
- DateTime.parse(value)
258
+ when :Time
259
+ Time.parse(value)
248
260
  when :Date
249
261
  Date.parse(value)
250
262
  when :String
@@ -274,7 +286,9 @@ module PulpPythonClient
274
286
  end
275
287
  end
276
288
  else # model
277
- PulpPythonClient.const_get(type).build_from_hash(value)
289
+ # models (e.g. Pet) or oneOf
290
+ klass = PulpPythonClient.const_get(type)
291
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
292
  end
279
293
  end
280
294
 
@@ -300,7 +314,7 @@ module PulpPythonClient
300
314
  is_nullable = self.class.openapi_nullable.include?(attr)
301
315
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
316
  end
303
-
317
+
304
318
  hash[param] = _to_hash(value)
305
319
  end
306
320
  hash
@@ -323,5 +337,7 @@ module PulpPythonClient
323
337
  value
324
338
  end
325
339
  end
340
+
326
341
  end
342
+
327
343
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpPythonClient
16
17
  # A Serializer for PythonRemote.
@@ -95,6 +96,28 @@ module PulpPythonClient
95
96
  # List of platforms to exclude syncing Python packages for. Possible valuesinclude: windows, macos, freebsd, and linux.
96
97
  attr_accessor :exclude_platforms
97
98
 
99
+ class EnumAttributeValidator
100
+ attr_reader :datatype
101
+ attr_reader :allowable_values
102
+
103
+ def initialize(datatype, allowable_values)
104
+ @allowable_values = allowable_values.map do |value|
105
+ case datatype.to_s
106
+ when /Integer/i
107
+ value.to_i
108
+ when /Float/i
109
+ value.to_f
110
+ else
111
+ value
112
+ end
113
+ end
114
+ end
115
+
116
+ def valid?(value)
117
+ !value || allowable_values.include?(value)
118
+ end
119
+ end
120
+
98
121
  # Attribute mapping from ruby-style variable name to JSON key.
99
122
  def self.attribute_map
100
123
  {
@@ -128,6 +151,11 @@ module PulpPythonClient
128
151
  }
129
152
  end
130
153
 
154
+ # Returns all the JSON keys this model knows about
155
+ def self.acceptable_attributes
156
+ attribute_map.values
157
+ end
158
+
131
159
  # Attribute type mapping.
132
160
  def self.openapi_types
133
161
  {
@@ -323,6 +351,7 @@ module PulpPythonClient
323
351
  # Show invalid properties with the reasons. Usually used together with valid?
324
352
  # @return Array for valid properties with the reasons
325
353
  def list_invalid_properties
354
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
326
355
  invalid_properties = Array.new
327
356
  if !@name.nil? && @name.to_s.length < 1
328
357
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -368,20 +397,20 @@ module PulpPythonClient
368
397
  invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
369
398
  end
370
399
 
371
- if !@total_timeout.nil? && @total_timeout < 0
372
- invalid_properties.push('invalid value for "total_timeout", must be greater than or equal to 0.')
400
+ if !@total_timeout.nil? && @total_timeout < 0.0
401
+ invalid_properties.push('invalid value for "total_timeout", must be greater than or equal to 0.0.')
373
402
  end
374
403
 
375
- if !@connect_timeout.nil? && @connect_timeout < 0
376
- invalid_properties.push('invalid value for "connect_timeout", must be greater than or equal to 0.')
404
+ if !@connect_timeout.nil? && @connect_timeout < 0.0
405
+ invalid_properties.push('invalid value for "connect_timeout", must be greater than or equal to 0.0.')
377
406
  end
378
407
 
379
- if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0
380
- invalid_properties.push('invalid value for "sock_connect_timeout", must be greater than or equal to 0.')
408
+ if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
409
+ invalid_properties.push('invalid value for "sock_connect_timeout", must be greater than or equal to 0.0.')
381
410
  end
382
411
 
383
- if !@sock_read_timeout.nil? && @sock_read_timeout < 0
384
- invalid_properties.push('invalid value for "sock_read_timeout", must be greater than or equal to 0.')
412
+ if !@sock_read_timeout.nil? && @sock_read_timeout < 0.0
413
+ invalid_properties.push('invalid value for "sock_read_timeout", must be greater than or equal to 0.0.')
385
414
  end
386
415
 
387
416
  invalid_properties
@@ -390,6 +419,7 @@ module PulpPythonClient
390
419
  # Check to see if the all the properties in the model are valid
391
420
  # @return true if the model is valid
392
421
  def valid?
422
+ warn '[DEPRECATED] the `valid?` method is obsolete'
393
423
  return false if !@name.nil? && @name.to_s.length < 1
394
424
  return false if !@url.nil? && @url.to_s.length < 1
395
425
  return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
@@ -401,17 +431,21 @@ module PulpPythonClient
401
431
  return false if !@username.nil? && @username.to_s.length < 1
402
432
  return false if !@password.nil? && @password.to_s.length < 1
403
433
  return false if !@download_concurrency.nil? && @download_concurrency < 1
404
- return false if !@total_timeout.nil? && @total_timeout < 0
405
- return false if !@connect_timeout.nil? && @connect_timeout < 0
406
- return false if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0
407
- return false if !@sock_read_timeout.nil? && @sock_read_timeout < 0
434
+ return false if !@total_timeout.nil? && @total_timeout < 0.0
435
+ return false if !@connect_timeout.nil? && @connect_timeout < 0.0
436
+ return false if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
437
+ return false if !@sock_read_timeout.nil? && @sock_read_timeout < 0.0
408
438
  true
409
439
  end
410
440
 
411
441
  # Custom attribute writer method with validation
412
442
  # @param [Object] name Value to be assigned
413
443
  def name=(name)
414
- if !name.nil? && name.to_s.length < 1
444
+ if name.nil?
445
+ fail ArgumentError, 'name cannot be nil'
446
+ end
447
+
448
+ if name.to_s.length < 1
415
449
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
416
450
  end
417
451
 
@@ -421,7 +455,11 @@ module PulpPythonClient
421
455
  # Custom attribute writer method with validation
422
456
  # @param [Object] url Value to be assigned
423
457
  def url=(url)
424
- if !url.nil? && url.to_s.length < 1
458
+ if url.nil?
459
+ fail ArgumentError, 'url cannot be nil'
460
+ end
461
+
462
+ if url.to_s.length < 1
425
463
  fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
426
464
  end
427
465
 
@@ -521,8 +559,8 @@ module PulpPythonClient
521
559
  # Custom attribute writer method with validation
522
560
  # @param [Object] total_timeout Value to be assigned
523
561
  def total_timeout=(total_timeout)
524
- if !total_timeout.nil? && total_timeout < 0
525
- fail ArgumentError, 'invalid value for "total_timeout", must be greater than or equal to 0.'
562
+ if !total_timeout.nil? && total_timeout < 0.0
563
+ fail ArgumentError, 'invalid value for "total_timeout", must be greater than or equal to 0.0.'
526
564
  end
527
565
 
528
566
  @total_timeout = total_timeout
@@ -531,8 +569,8 @@ module PulpPythonClient
531
569
  # Custom attribute writer method with validation
532
570
  # @param [Object] connect_timeout Value to be assigned
533
571
  def connect_timeout=(connect_timeout)
534
- if !connect_timeout.nil? && connect_timeout < 0
535
- fail ArgumentError, 'invalid value for "connect_timeout", must be greater than or equal to 0.'
572
+ if !connect_timeout.nil? && connect_timeout < 0.0
573
+ fail ArgumentError, 'invalid value for "connect_timeout", must be greater than or equal to 0.0.'
536
574
  end
537
575
 
538
576
  @connect_timeout = connect_timeout
@@ -541,8 +579,8 @@ module PulpPythonClient
541
579
  # Custom attribute writer method with validation
542
580
  # @param [Object] sock_connect_timeout Value to be assigned
543
581
  def sock_connect_timeout=(sock_connect_timeout)
544
- if !sock_connect_timeout.nil? && sock_connect_timeout < 0
545
- fail ArgumentError, 'invalid value for "sock_connect_timeout", must be greater than or equal to 0.'
582
+ if !sock_connect_timeout.nil? && sock_connect_timeout < 0.0
583
+ fail ArgumentError, 'invalid value for "sock_connect_timeout", must be greater than or equal to 0.0.'
546
584
  end
547
585
 
548
586
  @sock_connect_timeout = sock_connect_timeout
@@ -551,8 +589,8 @@ module PulpPythonClient
551
589
  # Custom attribute writer method with validation
552
590
  # @param [Object] sock_read_timeout Value to be assigned
553
591
  def sock_read_timeout=(sock_read_timeout)
554
- if !sock_read_timeout.nil? && sock_read_timeout < 0
555
- fail ArgumentError, 'invalid value for "sock_read_timeout", must be greater than or equal to 0.'
592
+ if !sock_read_timeout.nil? && sock_read_timeout < 0.0
593
+ fail ArgumentError, 'invalid value for "sock_read_timeout", must be greater than or equal to 0.0.'
556
594
  end
557
595
 
558
596
  @sock_read_timeout = sock_read_timeout
@@ -608,37 +646,33 @@ module PulpPythonClient
608
646
  # @param [Hash] attributes Model attributes in the form of hash
609
647
  # @return [Object] Returns the model itself
610
648
  def self.build_from_hash(attributes)
611
- new.build_from_hash(attributes)
612
- end
613
-
614
- # Builds the object from hash
615
- # @param [Hash] attributes Model attributes in the form of hash
616
- # @return [Object] Returns the model itself
617
- def build_from_hash(attributes)
618
649
  return nil unless attributes.is_a?(Hash)
619
- self.class.openapi_types.each_pair do |key, type|
620
- if type =~ /\AArray<(.*)>/i
650
+ attributes = attributes.transform_keys(&:to_sym)
651
+ transformed_hash = {}
652
+ openapi_types.each_pair do |key, type|
653
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
654
+ transformed_hash["#{key}"] = nil
655
+ elsif type =~ /\AArray<(.*)>/i
621
656
  # check to ensure the input is an array given that the attribute
622
657
  # is documented as an array but the input is not
623
- if attributes[self.class.attribute_map[key]].is_a?(Array)
624
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
658
+ if attributes[attribute_map[key]].is_a?(Array)
659
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
625
660
  end
626
- elsif !attributes[self.class.attribute_map[key]].nil?
627
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
628
- end # or else data not found in attributes(hash), not an issue as the data can be optional
661
+ elsif !attributes[attribute_map[key]].nil?
662
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
663
+ end
629
664
  end
630
-
631
- self
665
+ new(transformed_hash)
632
666
  end
633
667
 
634
668
  # Deserializes the data based on type
635
669
  # @param string type Data type
636
670
  # @param string value Value to be deserialized
637
671
  # @return [Object] Deserialized data
638
- def _deserialize(type, value)
672
+ def self._deserialize(type, value)
639
673
  case type.to_sym
640
- when :DateTime
641
- DateTime.parse(value)
674
+ when :Time
675
+ Time.parse(value)
642
676
  when :Date
643
677
  Date.parse(value)
644
678
  when :String
@@ -668,7 +702,9 @@ module PulpPythonClient
668
702
  end
669
703
  end
670
704
  else # model
671
- PulpPythonClient.const_get(type).build_from_hash(value)
705
+ # models (e.g. Pet) or oneOf
706
+ klass = PulpPythonClient.const_get(type)
707
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
672
708
  end
673
709
  end
674
710
 
@@ -694,7 +730,7 @@ module PulpPythonClient
694
730
  is_nullable = self.class.openapi_nullable.include?(attr)
695
731
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
696
732
  end
697
-
733
+
698
734
  hash[param] = _to_hash(value)
699
735
  end
700
736
  hash
@@ -717,5 +753,7 @@ module PulpPythonClient
717
753
  value
718
754
  end
719
755
  end
756
+
720
757
  end
758
+
721
759
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpPythonClient
16
17
  # Serializer for Python Repositories.
@@ -44,6 +45,11 @@ module PulpPythonClient
44
45
  }
45
46
  end
46
47
 
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
47
53
  # Attribute type mapping.
48
54
  def self.openapi_types
49
55
  {
@@ -112,6 +118,7 @@ module PulpPythonClient
112
118
  # Show invalid properties with the reasons. Usually used together with valid?
113
119
  # @return Array for valid properties with the reasons
114
120
  def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
122
  invalid_properties = Array.new
116
123
  if !@name.nil? && @name.to_s.length < 1
117
124
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -131,6 +138,7 @@ module PulpPythonClient
131
138
  # Check to see if the all the properties in the model are valid
132
139
  # @return true if the model is valid
133
140
  def valid?
141
+ warn '[DEPRECATED] the `valid?` method is obsolete'
134
142
  return false if !@name.nil? && @name.to_s.length < 1
135
143
  return false if !@description.nil? && @description.to_s.length < 1
136
144
  return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
@@ -140,7 +148,11 @@ module PulpPythonClient
140
148
  # Custom attribute writer method with validation
141
149
  # @param [Object] name Value to be assigned
142
150
  def name=(name)
143
- if !name.nil? && name.to_s.length < 1
151
+ if name.nil?
152
+ fail ArgumentError, 'name cannot be nil'
153
+ end
154
+
155
+ if name.to_s.length < 1
144
156
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
145
157
  end
146
158
 
@@ -196,37 +208,33 @@ module PulpPythonClient
196
208
  # @param [Hash] attributes Model attributes in the form of hash
197
209
  # @return [Object] Returns the model itself
198
210
  def self.build_from_hash(attributes)
199
- new.build_from_hash(attributes)
200
- end
201
-
202
- # Builds the object from hash
203
- # @param [Hash] attributes Model attributes in the form of hash
204
- # @return [Object] Returns the model itself
205
- def build_from_hash(attributes)
206
211
  return nil unless attributes.is_a?(Hash)
207
- self.class.openapi_types.each_pair do |key, type|
208
- if type =~ /\AArray<(.*)>/i
212
+ attributes = attributes.transform_keys(&:to_sym)
213
+ transformed_hash = {}
214
+ openapi_types.each_pair do |key, type|
215
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
216
+ transformed_hash["#{key}"] = nil
217
+ elsif type =~ /\AArray<(.*)>/i
209
218
  # check to ensure the input is an array given that the attribute
210
219
  # is documented as an array but the input is not
211
- if attributes[self.class.attribute_map[key]].is_a?(Array)
212
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
220
+ if attributes[attribute_map[key]].is_a?(Array)
221
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
213
222
  end
214
- elsif !attributes[self.class.attribute_map[key]].nil?
215
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
- end # or else data not found in attributes(hash), not an issue as the data can be optional
223
+ elsif !attributes[attribute_map[key]].nil?
224
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
225
+ end
217
226
  end
218
-
219
- self
227
+ new(transformed_hash)
220
228
  end
221
229
 
222
230
  # Deserializes the data based on type
223
231
  # @param string type Data type
224
232
  # @param string value Value to be deserialized
225
233
  # @return [Object] Deserialized data
226
- def _deserialize(type, value)
234
+ def self._deserialize(type, value)
227
235
  case type.to_sym
228
- when :DateTime
229
- DateTime.parse(value)
236
+ when :Time
237
+ Time.parse(value)
230
238
  when :Date
231
239
  Date.parse(value)
232
240
  when :String
@@ -256,7 +264,9 @@ module PulpPythonClient
256
264
  end
257
265
  end
258
266
  else # model
259
- PulpPythonClient.const_get(type).build_from_hash(value)
267
+ # models (e.g. Pet) or oneOf
268
+ klass = PulpPythonClient.const_get(type)
269
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
260
270
  end
261
271
  end
262
272
 
@@ -282,7 +292,7 @@ module PulpPythonClient
282
292
  is_nullable = self.class.openapi_nullable.include?(attr)
283
293
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
294
  end
285
-
295
+
286
296
  hash[param] = _to_hash(value)
287
297
  end
288
298
  hash
@@ -305,5 +315,7 @@ module PulpPythonClient
305
315
  value
306
316
  end
307
317
  end
318
+
308
319
  end
320
+
309
321
  end