pulp_maven_client 0.8.1 → 0.8.3

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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -7
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentArtifactApi.md +116 -64
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsMavenApi.md +267 -130
  7. data/docs/MavenMavenArtifact.md +12 -11
  8. data/docs/MavenMavenArtifactResponse.md +24 -21
  9. data/docs/MavenMavenDistribution.md +20 -19
  10. data/docs/MavenMavenDistributionResponse.md +32 -27
  11. data/docs/MavenMavenRemote.md +48 -47
  12. data/docs/MavenMavenRemoteResponse.md +48 -45
  13. data/docs/MavenMavenRemoteResponseHiddenFieldsInner.md +20 -0
  14. data/docs/MavenMavenRepository.md +16 -15
  15. data/docs/MavenMavenRepositoryResponse.md +28 -25
  16. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  17. data/docs/PaginatedmavenMavenArtifactResponseList.md +14 -13
  18. data/docs/PaginatedmavenMavenDistributionResponseList.md +14 -13
  19. data/docs/PaginatedmavenMavenRemoteResponseList.md +14 -13
  20. data/docs/PaginatedmavenMavenRepositoryResponseList.md +14 -13
  21. data/docs/PatchedmavenMavenDistribution.md +20 -19
  22. data/docs/PatchedmavenMavenRemote.md +48 -47
  23. data/docs/PatchedmavenMavenRepository.md +16 -15
  24. data/docs/PolicyEnum.md +4 -5
  25. data/docs/PulpMavenApi.md +61 -26
  26. data/docs/RemotesMavenApi.md +271 -132
  27. data/docs/Repair.md +8 -7
  28. data/docs/RepositoriesMavenApi.md +300 -146
  29. data/docs/RepositoriesMavenVersionsApi.md +155 -83
  30. data/docs/RepositoryAddCachedContent.md +8 -7
  31. data/docs/RepositoryVersionResponse.md +22 -19
  32. data/docs/SetLabel.md +10 -9
  33. data/docs/SetLabelResponse.md +10 -9
  34. data/docs/UnsetLabel.md +8 -7
  35. data/docs/UnsetLabelResponse.md +10 -9
  36. data/lib/pulp_maven_client/api/content_artifact_api.rb +31 -22
  37. data/lib/pulp_maven_client/api/distributions_maven_api.rb +66 -40
  38. data/lib/pulp_maven_client/api/pulp_maven_api.rb +9 -7
  39. data/lib/pulp_maven_client/api/remotes_maven_api.rb +81 -52
  40. data/lib/pulp_maven_client/api/repositories_maven_api.rb +79 -49
  41. data/lib/pulp_maven_client/api/repositories_maven_versions_api.rb +50 -37
  42. data/lib/pulp_maven_client/api_client.rb +137 -102
  43. data/lib/pulp_maven_client/api_error.rb +2 -1
  44. data/lib/pulp_maven_client/configuration.rb +162 -21
  45. data/lib/pulp_maven_client/models/async_operation_response.rb +32 -22
  46. data/lib/pulp_maven_client/models/content_summary_response.rb +36 -22
  47. data/lib/pulp_maven_client/models/maven_maven_artifact.rb +34 -22
  48. data/lib/pulp_maven_client/models/maven_maven_artifact_response.rb +45 -25
  49. data/lib/pulp_maven_client/models/maven_maven_distribution.rb +34 -22
  50. data/lib/pulp_maven_client/models/maven_maven_distribution_response.rb +57 -25
  51. data/lib/pulp_maven_client/models/maven_maven_remote.rb +57 -38
  52. data/lib/pulp_maven_client/models/maven_maven_remote_response.rb +71 -42
  53. data/lib/pulp_maven_client/models/{maven_maven_remote_response_hidden_fields.rb → maven_maven_remote_response_hidden_fields_inner.rb} +37 -25
  54. data/lib/pulp_maven_client/models/maven_maven_repository.rb +32 -37
  55. data/lib/pulp_maven_client/models/maven_maven_repository_response.rb +45 -40
  56. data/lib/pulp_maven_client/models/paginated_repository_version_response_list.rb +34 -24
  57. data/lib/pulp_maven_client/models/paginatedmaven_maven_artifact_response_list.rb +34 -24
  58. data/lib/pulp_maven_client/models/paginatedmaven_maven_distribution_response_list.rb +34 -24
  59. data/lib/pulp_maven_client/models/paginatedmaven_maven_remote_response_list.rb +34 -24
  60. data/lib/pulp_maven_client/models/paginatedmaven_maven_repository_response_list.rb +34 -24
  61. data/lib/pulp_maven_client/models/patchedmaven_maven_distribution.rb +40 -24
  62. data/lib/pulp_maven_client/models/patchedmaven_maven_remote.rb +63 -40
  63. data/lib/pulp_maven_client/models/patchedmaven_maven_repository.rb +35 -38
  64. data/lib/pulp_maven_client/models/policy_enum.rb +8 -5
  65. data/lib/pulp_maven_client/models/repair.rb +30 -22
  66. data/lib/pulp_maven_client/models/repository_add_cached_content.rb +30 -22
  67. data/lib/pulp_maven_client/models/repository_version_response.rb +44 -26
  68. data/lib/pulp_maven_client/models/set_label.rb +34 -22
  69. data/lib/pulp_maven_client/models/set_label_response.rb +34 -22
  70. data/lib/pulp_maven_client/models/unset_label.rb +32 -22
  71. data/lib/pulp_maven_client/models/unset_label_response.rb +32 -22
  72. data/lib/pulp_maven_client/version.rb +2 -2
  73. data/lib/pulp_maven_client.rb +2 -2
  74. data/pulp_maven_client.gemspec +9 -6
  75. data/spec/api/content_artifact_api_spec.rb +9 -8
  76. data/spec/api/distributions_maven_api_spec.rb +11 -10
  77. data/spec/api/pulp_maven_api_spec.rb +3 -3
  78. data/spec/api/remotes_maven_api_spec.rb +18 -16
  79. data/spec/api/repositories_maven_api_spec.rb +14 -13
  80. data/spec/api/repositories_maven_versions_api_spec.rb +16 -14
  81. data/spec/models/async_operation_response_spec.rb +7 -12
  82. data/spec/models/content_summary_response_spec.rb +9 -14
  83. data/spec/models/maven_maven_artifact_response_spec.rb +20 -19
  84. data/spec/models/maven_maven_artifact_spec.rb +9 -14
  85. data/spec/models/maven_maven_distribution_response_spec.rb +29 -22
  86. data/spec/models/maven_maven_distribution_spec.rb +13 -18
  87. data/spec/models/{maven_maven_remote_response_hidden_fields_spec.rb → maven_maven_remote_response_hidden_fields_inner_spec.rb} +11 -16
  88. data/spec/models/maven_maven_remote_response_spec.rb +32 -31
  89. data/spec/models/maven_maven_remote_spec.rb +27 -32
  90. data/spec/models/maven_maven_repository_response_spec.rb +22 -21
  91. data/spec/models/maven_maven_repository_spec.rb +11 -16
  92. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  93. data/spec/models/paginatedmaven_maven_artifact_response_list_spec.rb +10 -15
  94. data/spec/models/paginatedmaven_maven_distribution_response_list_spec.rb +10 -15
  95. data/spec/models/paginatedmaven_maven_remote_response_list_spec.rb +10 -15
  96. data/spec/models/paginatedmaven_maven_repository_response_list_spec.rb +10 -15
  97. data/spec/models/patchedmaven_maven_distribution_spec.rb +13 -18
  98. data/spec/models/patchedmaven_maven_remote_spec.rb +27 -32
  99. data/spec/models/patchedmaven_maven_repository_spec.rb +11 -16
  100. data/spec/models/policy_enum_spec.rb +6 -11
  101. data/spec/models/repair_spec.rb +7 -12
  102. data/spec/models/repository_add_cached_content_spec.rb +7 -12
  103. data/spec/models/repository_version_response_spec.rb +19 -18
  104. data/spec/models/set_label_response_spec.rb +8 -13
  105. data/spec/models/set_label_spec.rb +8 -13
  106. data/spec/models/unset_label_response_spec.rb +8 -13
  107. data/spec/models/unset_label_spec.rb +7 -12
  108. data/spec/spec_helper.rb +1 -1
  109. metadata +78 -54
  110. data/docs/MavenMavenRemoteResponseHiddenFields.md +0 -19
  111. data/spec/api_client_spec.rb +0 -188
  112. data/spec/configuration_spec.rb +0 -42
@@ -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 PulpMavenClient
16
17
  # Serializer for Maven Distributions.
@@ -48,6 +49,11 @@ module PulpMavenClient
48
49
  }
49
50
  end
50
51
 
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
51
57
  # Attribute type mapping.
52
58
  def self.openapi_types
53
59
  {
@@ -87,6 +93,8 @@ module PulpMavenClient
87
93
 
88
94
  if attributes.key?(:'base_path')
89
95
  self.base_path = attributes[:'base_path']
96
+ else
97
+ self.base_path = nil
90
98
  end
91
99
 
92
100
  if attributes.key?(:'content_guard')
@@ -107,6 +115,8 @@ module PulpMavenClient
107
115
 
108
116
  if attributes.key?(:'name')
109
117
  self.name = attributes[:'name']
118
+ else
119
+ self.name = nil
110
120
  end
111
121
 
112
122
  if attributes.key?(:'repository')
@@ -121,6 +131,7 @@ module PulpMavenClient
121
131
  # Show invalid properties with the reasons. Usually used together with valid?
122
132
  # @return Array for valid properties with the reasons
123
133
  def list_invalid_properties
134
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
135
  invalid_properties = Array.new
125
136
  if @base_path.nil?
126
137
  invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
@@ -144,6 +155,7 @@ module PulpMavenClient
144
155
  # Check to see if the all the properties in the model are valid
145
156
  # @return true if the model is valid
146
157
  def valid?
158
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
159
  return false if @base_path.nil?
148
160
  return false if @base_path.to_s.length < 1
149
161
  return false if @name.nil?
@@ -209,37 +221,33 @@ module PulpMavenClient
209
221
  # @param [Hash] attributes Model attributes in the form of hash
210
222
  # @return [Object] Returns the model itself
211
223
  def self.build_from_hash(attributes)
212
- new.build_from_hash(attributes)
213
- end
214
-
215
- # Builds the object from hash
216
- # @param [Hash] attributes Model attributes in the form of hash
217
- # @return [Object] Returns the model itself
218
- def build_from_hash(attributes)
219
224
  return nil unless attributes.is_a?(Hash)
220
- self.class.openapi_types.each_pair do |key, type|
221
- if type =~ /\AArray<(.*)>/i
225
+ attributes = attributes.transform_keys(&:to_sym)
226
+ transformed_hash = {}
227
+ openapi_types.each_pair do |key, type|
228
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
229
+ transformed_hash["#{key}"] = nil
230
+ elsif type =~ /\AArray<(.*)>/i
222
231
  # check to ensure the input is an array given that the attribute
223
232
  # is documented as an array but the input is not
224
- if attributes[self.class.attribute_map[key]].is_a?(Array)
225
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
233
+ if attributes[attribute_map[key]].is_a?(Array)
234
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
226
235
  end
227
- elsif !attributes[self.class.attribute_map[key]].nil?
228
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
229
- end # or else data not found in attributes(hash), not an issue as the data can be optional
236
+ elsif !attributes[attribute_map[key]].nil?
237
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
238
+ end
230
239
  end
231
-
232
- self
240
+ new(transformed_hash)
233
241
  end
234
242
 
235
243
  # Deserializes the data based on type
236
244
  # @param string type Data type
237
245
  # @param string value Value to be deserialized
238
246
  # @return [Object] Deserialized data
239
- def _deserialize(type, value)
247
+ def self._deserialize(type, value)
240
248
  case type.to_sym
241
- when :DateTime
242
- DateTime.parse(value)
249
+ when :Time
250
+ Time.parse(value)
243
251
  when :Date
244
252
  Date.parse(value)
245
253
  when :String
@@ -269,7 +277,9 @@ module PulpMavenClient
269
277
  end
270
278
  end
271
279
  else # model
272
- PulpMavenClient.const_get(type).build_from_hash(value)
280
+ # models (e.g. Pet) or oneOf
281
+ klass = PulpMavenClient.const_get(type)
282
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
273
283
  end
274
284
  end
275
285
 
@@ -295,7 +305,7 @@ module PulpMavenClient
295
305
  is_nullable = self.class.openapi_nullable.include?(attr)
296
306
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
297
307
  end
298
-
308
+
299
309
  hash[param] = _to_hash(value)
300
310
  end
301
311
  hash
@@ -318,5 +328,7 @@ module PulpMavenClient
318
328
  value
319
329
  end
320
330
  end
331
+
321
332
  end
333
+
322
334
  end
@@ -6,17 +6,21 @@
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 PulpMavenClient
16
17
  # Serializer for Maven Distributions.
17
18
  class MavenMavenDistributionResponse
18
19
  attr_accessor :pulp_href
19
20
 
21
+ # The Pulp Resource Name (PRN).
22
+ attr_accessor :prn
23
+
20
24
  # Timestamp of creation.
21
25
  attr_accessor :pulp_created
22
26
 
@@ -32,6 +36,9 @@ module PulpMavenClient
32
36
  # An optional content-guard.
33
37
  attr_accessor :content_guard
34
38
 
39
+ # Timestamp since when the distributed content served by this distribution has not changed. If equals to `null`, no guarantee is provided about content changes.
40
+ attr_accessor :no_content_change_since
41
+
35
42
  # Whether this distribution should be shown in the content app.
36
43
  attr_accessor :hidden
37
44
 
@@ -50,11 +57,13 @@ module PulpMavenClient
50
57
  def self.attribute_map
51
58
  {
52
59
  :'pulp_href' => :'pulp_href',
60
+ :'prn' => :'prn',
53
61
  :'pulp_created' => :'pulp_created',
54
62
  :'pulp_last_updated' => :'pulp_last_updated',
55
63
  :'base_path' => :'base_path',
56
64
  :'base_url' => :'base_url',
57
65
  :'content_guard' => :'content_guard',
66
+ :'no_content_change_since' => :'no_content_change_since',
58
67
  :'hidden' => :'hidden',
59
68
  :'pulp_labels' => :'pulp_labels',
60
69
  :'name' => :'name',
@@ -63,15 +72,22 @@ module PulpMavenClient
63
72
  }
64
73
  end
65
74
 
75
+ # Returns all the JSON keys this model knows about
76
+ def self.acceptable_attributes
77
+ attribute_map.values
78
+ end
79
+
66
80
  # Attribute type mapping.
67
81
  def self.openapi_types
68
82
  {
69
83
  :'pulp_href' => :'String',
70
- :'pulp_created' => :'DateTime',
71
- :'pulp_last_updated' => :'DateTime',
84
+ :'prn' => :'String',
85
+ :'pulp_created' => :'Time',
86
+ :'pulp_last_updated' => :'Time',
72
87
  :'base_path' => :'String',
73
88
  :'base_url' => :'String',
74
89
  :'content_guard' => :'String',
90
+ :'no_content_change_since' => :'String',
75
91
  :'hidden' => :'Boolean',
76
92
  :'pulp_labels' => :'Hash<String, String>',
77
93
  :'name' => :'String',
@@ -108,6 +124,10 @@ module PulpMavenClient
108
124
  self.pulp_href = attributes[:'pulp_href']
109
125
  end
110
126
 
127
+ if attributes.key?(:'prn')
128
+ self.prn = attributes[:'prn']
129
+ end
130
+
111
131
  if attributes.key?(:'pulp_created')
112
132
  self.pulp_created = attributes[:'pulp_created']
113
133
  end
@@ -118,6 +138,8 @@ module PulpMavenClient
118
138
 
119
139
  if attributes.key?(:'base_path')
120
140
  self.base_path = attributes[:'base_path']
141
+ else
142
+ self.base_path = nil
121
143
  end
122
144
 
123
145
  if attributes.key?(:'base_url')
@@ -128,6 +150,10 @@ module PulpMavenClient
128
150
  self.content_guard = attributes[:'content_guard']
129
151
  end
130
152
 
153
+ if attributes.key?(:'no_content_change_since')
154
+ self.no_content_change_since = attributes[:'no_content_change_since']
155
+ end
156
+
131
157
  if attributes.key?(:'hidden')
132
158
  self.hidden = attributes[:'hidden']
133
159
  else
@@ -142,6 +168,8 @@ module PulpMavenClient
142
168
 
143
169
  if attributes.key?(:'name')
144
170
  self.name = attributes[:'name']
171
+ else
172
+ self.name = nil
145
173
  end
146
174
 
147
175
  if attributes.key?(:'repository')
@@ -156,6 +184,7 @@ module PulpMavenClient
156
184
  # Show invalid properties with the reasons. Usually used together with valid?
157
185
  # @return Array for valid properties with the reasons
158
186
  def list_invalid_properties
187
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
159
188
  invalid_properties = Array.new
160
189
  if @base_path.nil?
161
190
  invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
@@ -171,6 +200,7 @@ module PulpMavenClient
171
200
  # Check to see if the all the properties in the model are valid
172
201
  # @return true if the model is valid
173
202
  def valid?
203
+ warn '[DEPRECATED] the `valid?` method is obsolete'
174
204
  return false if @base_path.nil?
175
205
  return false if @name.nil?
176
206
  true
@@ -182,11 +212,13 @@ module PulpMavenClient
182
212
  return true if self.equal?(o)
183
213
  self.class == o.class &&
184
214
  pulp_href == o.pulp_href &&
215
+ prn == o.prn &&
185
216
  pulp_created == o.pulp_created &&
186
217
  pulp_last_updated == o.pulp_last_updated &&
187
218
  base_path == o.base_path &&
188
219
  base_url == o.base_url &&
189
220
  content_guard == o.content_guard &&
221
+ no_content_change_since == o.no_content_change_since &&
190
222
  hidden == o.hidden &&
191
223
  pulp_labels == o.pulp_labels &&
192
224
  name == o.name &&
@@ -203,44 +235,40 @@ module PulpMavenClient
203
235
  # Calculates hash code according to all attributes.
204
236
  # @return [Integer] Hash code
205
237
  def hash
206
- [pulp_href, pulp_created, pulp_last_updated, base_path, base_url, content_guard, hidden, pulp_labels, name, repository, remote].hash
238
+ [pulp_href, prn, pulp_created, pulp_last_updated, base_path, base_url, content_guard, no_content_change_since, hidden, pulp_labels, name, repository, remote].hash
207
239
  end
208
240
 
209
241
  # Builds the object from hash
210
242
  # @param [Hash] attributes Model attributes in the form of hash
211
243
  # @return [Object] Returns the model itself
212
244
  def self.build_from_hash(attributes)
213
- new.build_from_hash(attributes)
214
- end
215
-
216
- # Builds the object from hash
217
- # @param [Hash] attributes Model attributes in the form of hash
218
- # @return [Object] Returns the model itself
219
- def build_from_hash(attributes)
220
245
  return nil unless attributes.is_a?(Hash)
221
- self.class.openapi_types.each_pair do |key, type|
222
- if type =~ /\AArray<(.*)>/i
246
+ attributes = attributes.transform_keys(&:to_sym)
247
+ transformed_hash = {}
248
+ openapi_types.each_pair do |key, type|
249
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
250
+ transformed_hash["#{key}"] = nil
251
+ elsif type =~ /\AArray<(.*)>/i
223
252
  # check to ensure the input is an array given that the attribute
224
253
  # is documented as an array but the input is not
225
- if attributes[self.class.attribute_map[key]].is_a?(Array)
226
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
254
+ if attributes[attribute_map[key]].is_a?(Array)
255
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
227
256
  end
228
- elsif !attributes[self.class.attribute_map[key]].nil?
229
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
- end # or else data not found in attributes(hash), not an issue as the data can be optional
257
+ elsif !attributes[attribute_map[key]].nil?
258
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
259
+ end
231
260
  end
232
-
233
- self
261
+ new(transformed_hash)
234
262
  end
235
263
 
236
264
  # Deserializes the data based on type
237
265
  # @param string type Data type
238
266
  # @param string value Value to be deserialized
239
267
  # @return [Object] Deserialized data
240
- def _deserialize(type, value)
268
+ def self._deserialize(type, value)
241
269
  case type.to_sym
242
- when :DateTime
243
- DateTime.parse(value)
270
+ when :Time
271
+ Time.parse(value)
244
272
  when :Date
245
273
  Date.parse(value)
246
274
  when :String
@@ -270,7 +298,9 @@ module PulpMavenClient
270
298
  end
271
299
  end
272
300
  else # model
273
- PulpMavenClient.const_get(type).build_from_hash(value)
301
+ # models (e.g. Pet) or oneOf
302
+ klass = PulpMavenClient.const_get(type)
303
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
274
304
  end
275
305
  end
276
306
 
@@ -296,7 +326,7 @@ module PulpMavenClient
296
326
  is_nullable = self.class.openapi_nullable.include?(attr)
297
327
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
328
  end
299
-
329
+
300
330
  hash[param] = _to_hash(value)
301
331
  end
302
332
  hash
@@ -319,5 +349,7 @@ module PulpMavenClient
319
349
  value
320
350
  end
321
351
  end
352
+
322
353
  end
354
+
323
355
  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 PulpMavenClient
16
17
  # A Serializer for MavenRemote. Add any new fields if defined on MavenRemote. Similar to the example above, in MavenArtifactSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = platform.RemoteSerializer.Meta.validators + [myValidator1, myValidator2]
@@ -56,7 +57,7 @@ module PulpMavenClient
56
57
  # Maximum number of retry attempts after a download failure. If not set then the default value (3) will be used.
57
58
  attr_accessor :max_retries
58
59
 
59
- # The policy to use when downloading content. * `immediate` - immediate * `When syncing, download all metadata and content now.` - When syncing, download all metadata and content now.
60
+ # The policy to use when downloading content. * `immediate` - When syncing, download all metadata and content now.
60
61
  attr_accessor :policy
61
62
 
62
63
  # aiohttp.ClientTimeout.total (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
@@ -77,6 +78,28 @@ module PulpMavenClient
77
78
  # Limits requests per second for each concurrent downloader
78
79
  attr_accessor :rate_limit
79
80
 
81
+ class EnumAttributeValidator
82
+ attr_reader :datatype
83
+ attr_reader :allowable_values
84
+
85
+ def initialize(datatype, allowable_values)
86
+ @allowable_values = allowable_values.map do |value|
87
+ case datatype.to_s
88
+ when /Integer/i
89
+ value.to_i
90
+ when /Float/i
91
+ value.to_f
92
+ else
93
+ value
94
+ end
95
+ end
96
+ end
97
+
98
+ def valid?(value)
99
+ !value || allowable_values.include?(value)
100
+ end
101
+ end
102
+
80
103
  # Attribute mapping from ruby-style variable name to JSON key.
81
104
  def self.attribute_map
82
105
  {
@@ -104,6 +127,11 @@ module PulpMavenClient
104
127
  }
105
128
  end
106
129
 
130
+ # Returns all the JSON keys this model knows about
131
+ def self.acceptable_attributes
132
+ attribute_map.values
133
+ end
134
+
107
135
  # Attribute type mapping.
108
136
  def self.openapi_types
109
137
  {
@@ -169,10 +197,14 @@ module PulpMavenClient
169
197
 
170
198
  if attributes.key?(:'name')
171
199
  self.name = attributes[:'name']
200
+ else
201
+ self.name = nil
172
202
  end
173
203
 
174
204
  if attributes.key?(:'url')
175
205
  self.url = attributes[:'url']
206
+ else
207
+ self.url = nil
176
208
  end
177
209
 
178
210
  if attributes.key?(:'ca_cert')
@@ -259,6 +291,7 @@ module PulpMavenClient
259
291
  # Show invalid properties with the reasons. Usually used together with valid?
260
292
  # @return Array for valid properties with the reasons
261
293
  def list_invalid_properties
294
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
262
295
  invalid_properties = Array.new
263
296
  if @name.nil?
264
297
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -308,10 +341,6 @@ module PulpMavenClient
308
341
  invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
309
342
  end
310
343
 
311
- if !@download_concurrency.nil? && @download_concurrency < 1
312
- invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
313
- end
314
-
315
344
  if !@total_timeout.nil? && @total_timeout < 0.0
316
345
  invalid_properties.push('invalid value for "total_timeout", must be greater than or equal to 0.0.')
317
346
  end
@@ -334,6 +363,7 @@ module PulpMavenClient
334
363
  # Check to see if the all the properties in the model are valid
335
364
  # @return true if the model is valid
336
365
  def valid?
366
+ warn '[DEPRECATED] the `valid?` method is obsolete'
337
367
  return false if @name.nil?
338
368
  return false if @name.to_s.length < 1
339
369
  return false if @url.nil?
@@ -346,7 +376,6 @@ module PulpMavenClient
346
376
  return false if !@proxy_password.nil? && @proxy_password.to_s.length < 1
347
377
  return false if !@username.nil? && @username.to_s.length < 1
348
378
  return false if !@password.nil? && @password.to_s.length < 1
349
- return false if !@download_concurrency.nil? && @download_concurrency < 1
350
379
  return false if !@total_timeout.nil? && @total_timeout < 0.0
351
380
  return false if !@connect_timeout.nil? && @connect_timeout < 0.0
352
381
  return false if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
@@ -462,16 +491,6 @@ module PulpMavenClient
462
491
  @password = password
463
492
  end
464
493
 
465
- # Custom attribute writer method with validation
466
- # @param [Object] download_concurrency Value to be assigned
467
- def download_concurrency=(download_concurrency)
468
- if !download_concurrency.nil? && download_concurrency < 1
469
- fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
470
- end
471
-
472
- @download_concurrency = download_concurrency
473
- end
474
-
475
494
  # Custom attribute writer method with validation
476
495
  # @param [Object] total_timeout Value to be assigned
477
496
  def total_timeout=(total_timeout)
@@ -556,37 +575,33 @@ module PulpMavenClient
556
575
  # @param [Hash] attributes Model attributes in the form of hash
557
576
  # @return [Object] Returns the model itself
558
577
  def self.build_from_hash(attributes)
559
- new.build_from_hash(attributes)
560
- end
561
-
562
- # Builds the object from hash
563
- # @param [Hash] attributes Model attributes in the form of hash
564
- # @return [Object] Returns the model itself
565
- def build_from_hash(attributes)
566
578
  return nil unless attributes.is_a?(Hash)
567
- self.class.openapi_types.each_pair do |key, type|
568
- if type =~ /\AArray<(.*)>/i
579
+ attributes = attributes.transform_keys(&:to_sym)
580
+ transformed_hash = {}
581
+ openapi_types.each_pair do |key, type|
582
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
583
+ transformed_hash["#{key}"] = nil
584
+ elsif type =~ /\AArray<(.*)>/i
569
585
  # check to ensure the input is an array given that the attribute
570
586
  # is documented as an array but the input is not
571
- if attributes[self.class.attribute_map[key]].is_a?(Array)
572
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
587
+ if attributes[attribute_map[key]].is_a?(Array)
588
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
573
589
  end
574
- elsif !attributes[self.class.attribute_map[key]].nil?
575
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
576
- end # or else data not found in attributes(hash), not an issue as the data can be optional
590
+ elsif !attributes[attribute_map[key]].nil?
591
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
592
+ end
577
593
  end
578
-
579
- self
594
+ new(transformed_hash)
580
595
  end
581
596
 
582
597
  # Deserializes the data based on type
583
598
  # @param string type Data type
584
599
  # @param string value Value to be deserialized
585
600
  # @return [Object] Deserialized data
586
- def _deserialize(type, value)
601
+ def self._deserialize(type, value)
587
602
  case type.to_sym
588
- when :DateTime
589
- DateTime.parse(value)
603
+ when :Time
604
+ Time.parse(value)
590
605
  when :Date
591
606
  Date.parse(value)
592
607
  when :String
@@ -616,7 +631,9 @@ module PulpMavenClient
616
631
  end
617
632
  end
618
633
  else # model
619
- PulpMavenClient.const_get(type).build_from_hash(value)
634
+ # models (e.g. Pet) or oneOf
635
+ klass = PulpMavenClient.const_get(type)
636
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
620
637
  end
621
638
  end
622
639
 
@@ -642,7 +659,7 @@ module PulpMavenClient
642
659
  is_nullable = self.class.openapi_nullable.include?(attr)
643
660
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
644
661
  end
645
-
662
+
646
663
  hash[param] = _to_hash(value)
647
664
  end
648
665
  hash
@@ -665,5 +682,7 @@ module PulpMavenClient
665
682
  value
666
683
  end
667
684
  end
685
+
668
686
  end
687
+
669
688
  end