pulp_npm_client 0.1.0a4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -10
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentPackagesApi.md +126 -64
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsNpmApi.md +362 -93
  7. data/docs/NpmNpmDistribution.md +18 -15
  8. data/docs/NpmNpmDistributionResponse.md +30 -21
  9. data/docs/NpmNpmRemote.md +48 -47
  10. data/docs/NpmNpmRemoteResponse.md +48 -43
  11. data/docs/NpmNpmRemoteResponseHiddenFieldsInner.md +20 -0
  12. data/docs/NpmNpmRepository.md +16 -15
  13. data/docs/NpmNpmRepositoryResponse.md +28 -23
  14. data/docs/NpmPackageResponse.md +22 -17
  15. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  16. data/docs/PaginatednpmNpmDistributionResponseList.md +14 -13
  17. data/docs/PaginatednpmNpmRemoteResponseList.md +14 -13
  18. data/docs/PaginatednpmNpmRepositoryResponseList.md +14 -13
  19. data/docs/PaginatednpmPackageResponseList.md +14 -13
  20. data/docs/PatchednpmNpmDistribution.md +18 -15
  21. data/docs/PatchednpmNpmRemote.md +48 -47
  22. data/docs/PatchednpmNpmRepository.md +16 -15
  23. data/docs/PolicyEnum.md +4 -5
  24. data/docs/RemotesNpmApi.md +364 -99
  25. data/docs/Repair.md +8 -7
  26. data/docs/RepositoriesNpmApi.md +429 -110
  27. data/docs/RepositoriesNpmVersionsApi.md +156 -80
  28. data/docs/RepositoryAddRemoveContent.md +12 -11
  29. data/docs/RepositorySyncURL.md +10 -9
  30. data/docs/RepositoryVersionResponse.md +22 -17
  31. data/docs/SetLabel.md +20 -0
  32. data/docs/SetLabelResponse.md +20 -0
  33. data/docs/UnsetLabel.md +18 -0
  34. data/docs/UnsetLabelResponse.md +20 -0
  35. data/lib/pulp_npm_client/api/content_packages_api.rb +72 -44
  36. data/lib/pulp_npm_client/api/distributions_npm_api.rb +243 -47
  37. data/lib/pulp_npm_client/api/remotes_npm_api.rb +247 -57
  38. data/lib/pulp_npm_client/api/repositories_npm_api.rb +283 -55
  39. data/lib/pulp_npm_client/api/repositories_npm_versions_api.rb +71 -52
  40. data/lib/pulp_npm_client/api_client.rb +137 -102
  41. data/lib/pulp_npm_client/api_error.rb +2 -1
  42. data/lib/pulp_npm_client/configuration.rb +163 -22
  43. data/lib/pulp_npm_client/models/async_operation_response.rb +32 -22
  44. data/lib/pulp_npm_client/models/content_summary_response.rb +36 -22
  45. data/lib/pulp_npm_client/models/npm_npm_distribution.rb +51 -25
  46. data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +83 -27
  47. data/lib/pulp_npm_client/models/npm_npm_remote.rb +61 -25
  48. data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +99 -41
  49. data/lib/pulp_npm_client/models/npm_npm_remote_response_hidden_fields_inner.rb +237 -0
  50. data/lib/pulp_npm_client/models/npm_npm_repository.rb +37 -25
  51. data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +59 -27
  52. data/lib/pulp_npm_client/models/npm_package_response.rb +58 -24
  53. data/lib/pulp_npm_client/models/paginated_repository_version_response_list.rb +44 -22
  54. data/lib/pulp_npm_client/models/paginatednpm_npm_distribution_response_list.rb +44 -22
  55. data/lib/pulp_npm_client/models/paginatednpm_npm_remote_response_list.rb +44 -22
  56. data/lib/pulp_npm_client/models/paginatednpm_npm_repository_response_list.rb +44 -22
  57. data/lib/pulp_npm_client/models/paginatednpm_package_response_list.rb +44 -22
  58. data/lib/pulp_npm_client/models/patchednpm_npm_distribution.rb +57 -27
  59. data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +67 -27
  60. data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +40 -26
  61. data/lib/pulp_npm_client/models/policy_enum.rb +8 -4
  62. data/lib/pulp_npm_client/models/repair.rb +30 -22
  63. data/lib/pulp_npm_client/models/repository_add_remove_content.rb +33 -25
  64. data/lib/pulp_npm_client/models/repository_sync_url.rb +30 -22
  65. data/lib/pulp_npm_client/models/repository_version_response.rb +53 -25
  66. data/lib/pulp_npm_client/models/set_label.rb +264 -0
  67. data/lib/pulp_npm_client/models/set_label_response.rb +255 -0
  68. data/lib/pulp_npm_client/models/unset_label.rb +252 -0
  69. data/lib/pulp_npm_client/models/unset_label_response.rb +252 -0
  70. data/lib/pulp_npm_client/version.rb +2 -2
  71. data/lib/pulp_npm_client.rb +6 -3
  72. data/pulp_npm_client.gemspec +10 -7
  73. data/spec/api/content_packages_api_spec.rb +22 -16
  74. data/spec/api/distributions_npm_api_spec.rb +51 -14
  75. data/spec/api/remotes_npm_api_spec.rb +54 -19
  76. data/spec/api/repositories_npm_api_spec.rb +60 -15
  77. data/spec/api/repositories_npm_versions_api_spec.rb +23 -19
  78. data/spec/models/async_operation_response_spec.rb +7 -12
  79. data/spec/models/content_summary_response_spec.rb +9 -14
  80. data/spec/models/npm_npm_distribution_response_spec.rb +38 -19
  81. data/spec/models/npm_npm_distribution_spec.rb +17 -16
  82. data/spec/models/npm_npm_remote_response_hidden_fields_inner_spec.rb +42 -0
  83. data/spec/models/npm_npm_remote_response_spec.rb +42 -35
  84. data/spec/models/npm_npm_remote_spec.rb +27 -32
  85. data/spec/models/npm_npm_repository_response_spec.rb +27 -20
  86. data/spec/models/npm_npm_repository_spec.rb +11 -16
  87. data/spec/models/npm_package_response_spec.rb +24 -17
  88. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  89. data/spec/models/paginatednpm_npm_distribution_response_list_spec.rb +10 -15
  90. data/spec/models/paginatednpm_npm_remote_response_list_spec.rb +10 -15
  91. data/spec/models/paginatednpm_npm_repository_response_list_spec.rb +10 -15
  92. data/spec/models/paginatednpm_package_response_list_spec.rb +10 -15
  93. data/spec/models/patchednpm_npm_distribution_spec.rb +17 -16
  94. data/spec/models/patchednpm_npm_remote_spec.rb +27 -32
  95. data/spec/models/patchednpm_npm_repository_spec.rb +11 -16
  96. data/spec/models/policy_enum_spec.rb +6 -11
  97. data/spec/models/repair_spec.rb +7 -12
  98. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  99. data/spec/models/repository_sync_url_spec.rb +8 -13
  100. data/spec/models/repository_version_response_spec.rb +24 -17
  101. data/spec/models/set_label_response_spec.rb +42 -0
  102. data/spec/models/set_label_spec.rb +42 -0
  103. data/spec/models/unset_label_response_spec.rb +42 -0
  104. data/spec/models/unset_label_spec.rb +36 -0
  105. data/spec/spec_helper.rb +1 -1
  106. metadata +94 -59
  107. data/docs/NpmPackage.md +0 -29
  108. data/docs/PulpNpmPackagesApi.md +0 -60
  109. data/git_push.sh +0 -58
  110. data/lib/pulp_npm_client/api/pulp_npm_packages_api.rb +0 -86
  111. data/lib/pulp_npm_client/models/npm_package.rb +0 -337
  112. data/spec/api/pulp_npm_packages_api_spec.rb +0 -48
  113. data/spec/api_client_spec.rb +0 -188
  114. data/spec/configuration_spec.rb +0 -42
  115. data/spec/models/npm_package_spec.rb +0 -77
@@ -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 PulpNpmClient
16
17
  # Serializer for NPM Distributions.
@@ -21,6 +22,9 @@ module PulpNpmClient
21
22
  # An optional content-guard.
22
23
  attr_accessor :content_guard
23
24
 
25
+ # Whether this distribution should be shown in the content app.
26
+ attr_accessor :hidden
27
+
24
28
  attr_accessor :pulp_labels
25
29
 
26
30
  # A unique name. Ex, `rawhide` and `stable`.
@@ -34,18 +38,25 @@ module PulpNpmClient
34
38
  {
35
39
  :'base_path' => :'base_path',
36
40
  :'content_guard' => :'content_guard',
41
+ :'hidden' => :'hidden',
37
42
  :'pulp_labels' => :'pulp_labels',
38
43
  :'name' => :'name',
39
44
  :'repository' => :'repository'
40
45
  }
41
46
  end
42
47
 
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
43
53
  # Attribute type mapping.
44
54
  def self.openapi_types
45
55
  {
46
56
  :'base_path' => :'String',
47
57
  :'content_guard' => :'String',
48
- :'pulp_labels' => :'Object',
58
+ :'hidden' => :'Boolean',
59
+ :'pulp_labels' => :'Hash<String, String>',
49
60
  :'name' => :'String',
50
61
  :'repository' => :'String'
51
62
  }
@@ -76,18 +87,30 @@ module PulpNpmClient
76
87
 
77
88
  if attributes.key?(:'base_path')
78
89
  self.base_path = attributes[:'base_path']
90
+ else
91
+ self.base_path = nil
79
92
  end
80
93
 
81
94
  if attributes.key?(:'content_guard')
82
95
  self.content_guard = attributes[:'content_guard']
83
96
  end
84
97
 
98
+ if attributes.key?(:'hidden')
99
+ self.hidden = attributes[:'hidden']
100
+ else
101
+ self.hidden = false
102
+ end
103
+
85
104
  if attributes.key?(:'pulp_labels')
86
- self.pulp_labels = attributes[:'pulp_labels']
105
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
106
+ self.pulp_labels = value
107
+ end
87
108
  end
88
109
 
89
110
  if attributes.key?(:'name')
90
111
  self.name = attributes[:'name']
112
+ else
113
+ self.name = nil
91
114
  end
92
115
 
93
116
  if attributes.key?(:'repository')
@@ -98,6 +121,7 @@ module PulpNpmClient
98
121
  # Show invalid properties with the reasons. Usually used together with valid?
99
122
  # @return Array for valid properties with the reasons
100
123
  def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
125
  invalid_properties = Array.new
102
126
  if @base_path.nil?
103
127
  invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
@@ -121,6 +145,7 @@ module PulpNpmClient
121
145
  # Check to see if the all the properties in the model are valid
122
146
  # @return true if the model is valid
123
147
  def valid?
148
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
149
  return false if @base_path.nil?
125
150
  return false if @base_path.to_s.length < 1
126
151
  return false if @name.nil?
@@ -163,6 +188,7 @@ module PulpNpmClient
163
188
  self.class == o.class &&
164
189
  base_path == o.base_path &&
165
190
  content_guard == o.content_guard &&
191
+ hidden == o.hidden &&
166
192
  pulp_labels == o.pulp_labels &&
167
193
  name == o.name &&
168
194
  repository == o.repository
@@ -177,44 +203,40 @@ module PulpNpmClient
177
203
  # Calculates hash code according to all attributes.
178
204
  # @return [Integer] Hash code
179
205
  def hash
180
- [base_path, content_guard, pulp_labels, name, repository].hash
206
+ [base_path, content_guard, hidden, pulp_labels, name, repository].hash
181
207
  end
182
208
 
183
209
  # Builds the object from hash
184
210
  # @param [Hash] attributes Model attributes in the form of hash
185
211
  # @return [Object] Returns the model itself
186
212
  def self.build_from_hash(attributes)
187
- new.build_from_hash(attributes)
188
- end
189
-
190
- # Builds the object from hash
191
- # @param [Hash] attributes Model attributes in the form of hash
192
- # @return [Object] Returns the model itself
193
- def build_from_hash(attributes)
194
213
  return nil unless attributes.is_a?(Hash)
195
- self.class.openapi_types.each_pair do |key, type|
196
- if type =~ /\AArray<(.*)>/i
214
+ attributes = attributes.transform_keys(&:to_sym)
215
+ transformed_hash = {}
216
+ openapi_types.each_pair do |key, type|
217
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = nil
219
+ elsif type =~ /\AArray<(.*)>/i
197
220
  # check to ensure the input is an array given that the attribute
198
221
  # is documented as an array but the input is not
199
- if attributes[self.class.attribute_map[key]].is_a?(Array)
200
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
222
+ if attributes[attribute_map[key]].is_a?(Array)
223
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
201
224
  end
202
- elsif !attributes[self.class.attribute_map[key]].nil?
203
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
204
- end # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ elsif !attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
227
+ end
205
228
  end
206
-
207
- self
229
+ new(transformed_hash)
208
230
  end
209
231
 
210
232
  # Deserializes the data based on type
211
233
  # @param string type Data type
212
234
  # @param string value Value to be deserialized
213
235
  # @return [Object] Deserialized data
214
- def _deserialize(type, value)
236
+ def self._deserialize(type, value)
215
237
  case type.to_sym
216
- when :DateTime
217
- DateTime.parse(value)
238
+ when :Time
239
+ Time.parse(value)
218
240
  when :Date
219
241
  Date.parse(value)
220
242
  when :String
@@ -244,7 +266,9 @@ module PulpNpmClient
244
266
  end
245
267
  end
246
268
  else # model
247
- PulpNpmClient.const_get(type).build_from_hash(value)
269
+ # models (e.g. Pet) or oneOf
270
+ klass = PulpNpmClient.const_get(type)
271
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
272
  end
249
273
  end
250
274
 
@@ -270,7 +294,7 @@ module PulpNpmClient
270
294
  is_nullable = self.class.openapi_nullable.include?(attr)
271
295
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
296
  end
273
-
297
+
274
298
  hash[param] = _to_hash(value)
275
299
  end
276
300
  hash
@@ -293,5 +317,7 @@ module PulpNpmClient
293
317
  value
294
318
  end
295
319
  end
320
+
296
321
  end
322
+
297
323
  end
@@ -6,29 +6,42 @@
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 PulpNpmClient
16
17
  # Serializer for NPM Distributions.
17
18
  class NpmNpmDistributionResponse
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
 
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
+
23
30
  # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
24
31
  attr_accessor :base_path
25
32
 
26
- # The URL for accessing the universe API as defined by this distribution.
33
+ # The URL for accessing the publication as defined by this distribution.
27
34
  attr_accessor :base_url
28
35
 
29
36
  # An optional content-guard.
30
37
  attr_accessor :content_guard
31
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
+
42
+ # Whether this distribution should be shown in the content app.
43
+ attr_accessor :hidden
44
+
32
45
  attr_accessor :pulp_labels
33
46
 
34
47
  # A unique name. Ex, `rawhide` and `stable`.
@@ -41,25 +54,38 @@ module PulpNpmClient
41
54
  def self.attribute_map
42
55
  {
43
56
  :'pulp_href' => :'pulp_href',
57
+ :'prn' => :'prn',
44
58
  :'pulp_created' => :'pulp_created',
59
+ :'pulp_last_updated' => :'pulp_last_updated',
45
60
  :'base_path' => :'base_path',
46
61
  :'base_url' => :'base_url',
47
62
  :'content_guard' => :'content_guard',
63
+ :'no_content_change_since' => :'no_content_change_since',
64
+ :'hidden' => :'hidden',
48
65
  :'pulp_labels' => :'pulp_labels',
49
66
  :'name' => :'name',
50
67
  :'repository' => :'repository'
51
68
  }
52
69
  end
53
70
 
71
+ # Returns all the JSON keys this model knows about
72
+ def self.acceptable_attributes
73
+ attribute_map.values
74
+ end
75
+
54
76
  # Attribute type mapping.
55
77
  def self.openapi_types
56
78
  {
57
79
  :'pulp_href' => :'String',
58
- :'pulp_created' => :'DateTime',
80
+ :'prn' => :'String',
81
+ :'pulp_created' => :'Time',
82
+ :'pulp_last_updated' => :'Time',
59
83
  :'base_path' => :'String',
60
84
  :'base_url' => :'String',
61
85
  :'content_guard' => :'String',
62
- :'pulp_labels' => :'Object',
86
+ :'no_content_change_since' => :'String',
87
+ :'hidden' => :'Boolean',
88
+ :'pulp_labels' => :'Hash<String, String>',
63
89
  :'name' => :'String',
64
90
  :'repository' => :'String'
65
91
  }
@@ -92,12 +118,22 @@ module PulpNpmClient
92
118
  self.pulp_href = attributes[:'pulp_href']
93
119
  end
94
120
 
121
+ if attributes.key?(:'prn')
122
+ self.prn = attributes[:'prn']
123
+ end
124
+
95
125
  if attributes.key?(:'pulp_created')
96
126
  self.pulp_created = attributes[:'pulp_created']
97
127
  end
98
128
 
129
+ if attributes.key?(:'pulp_last_updated')
130
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
131
+ end
132
+
99
133
  if attributes.key?(:'base_path')
100
134
  self.base_path = attributes[:'base_path']
135
+ else
136
+ self.base_path = nil
101
137
  end
102
138
 
103
139
  if attributes.key?(:'base_url')
@@ -108,12 +144,26 @@ module PulpNpmClient
108
144
  self.content_guard = attributes[:'content_guard']
109
145
  end
110
146
 
147
+ if attributes.key?(:'no_content_change_since')
148
+ self.no_content_change_since = attributes[:'no_content_change_since']
149
+ end
150
+
151
+ if attributes.key?(:'hidden')
152
+ self.hidden = attributes[:'hidden']
153
+ else
154
+ self.hidden = false
155
+ end
156
+
111
157
  if attributes.key?(:'pulp_labels')
112
- self.pulp_labels = attributes[:'pulp_labels']
158
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
159
+ self.pulp_labels = value
160
+ end
113
161
  end
114
162
 
115
163
  if attributes.key?(:'name')
116
164
  self.name = attributes[:'name']
165
+ else
166
+ self.name = nil
117
167
  end
118
168
 
119
169
  if attributes.key?(:'repository')
@@ -124,6 +174,7 @@ module PulpNpmClient
124
174
  # Show invalid properties with the reasons. Usually used together with valid?
125
175
  # @return Array for valid properties with the reasons
126
176
  def list_invalid_properties
177
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
178
  invalid_properties = Array.new
128
179
  if @base_path.nil?
129
180
  invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
@@ -139,6 +190,7 @@ module PulpNpmClient
139
190
  # Check to see if the all the properties in the model are valid
140
191
  # @return true if the model is valid
141
192
  def valid?
193
+ warn '[DEPRECATED] the `valid?` method is obsolete'
142
194
  return false if @base_path.nil?
143
195
  return false if @name.nil?
144
196
  true
@@ -150,10 +202,14 @@ module PulpNpmClient
150
202
  return true if self.equal?(o)
151
203
  self.class == o.class &&
152
204
  pulp_href == o.pulp_href &&
205
+ prn == o.prn &&
153
206
  pulp_created == o.pulp_created &&
207
+ pulp_last_updated == o.pulp_last_updated &&
154
208
  base_path == o.base_path &&
155
209
  base_url == o.base_url &&
156
210
  content_guard == o.content_guard &&
211
+ no_content_change_since == o.no_content_change_since &&
212
+ hidden == o.hidden &&
157
213
  pulp_labels == o.pulp_labels &&
158
214
  name == o.name &&
159
215
  repository == o.repository
@@ -168,44 +224,40 @@ module PulpNpmClient
168
224
  # Calculates hash code according to all attributes.
169
225
  # @return [Integer] Hash code
170
226
  def hash
171
- [pulp_href, pulp_created, base_path, base_url, content_guard, pulp_labels, name, repository].hash
227
+ [pulp_href, prn, pulp_created, pulp_last_updated, base_path, base_url, content_guard, no_content_change_since, hidden, pulp_labels, name, repository].hash
172
228
  end
173
229
 
174
230
  # Builds the object from hash
175
231
  # @param [Hash] attributes Model attributes in the form of hash
176
232
  # @return [Object] Returns the model itself
177
233
  def self.build_from_hash(attributes)
178
- new.build_from_hash(attributes)
179
- end
180
-
181
- # Builds the object from hash
182
- # @param [Hash] attributes Model attributes in the form of hash
183
- # @return [Object] Returns the model itself
184
- def build_from_hash(attributes)
185
234
  return nil unless attributes.is_a?(Hash)
186
- self.class.openapi_types.each_pair do |key, type|
187
- if type =~ /\AArray<(.*)>/i
235
+ attributes = attributes.transform_keys(&:to_sym)
236
+ transformed_hash = {}
237
+ openapi_types.each_pair do |key, type|
238
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
239
+ transformed_hash["#{key}"] = nil
240
+ elsif type =~ /\AArray<(.*)>/i
188
241
  # check to ensure the input is an array given that the attribute
189
242
  # is documented as an array but the input is not
190
- if attributes[self.class.attribute_map[key]].is_a?(Array)
191
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
243
+ if attributes[attribute_map[key]].is_a?(Array)
244
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
192
245
  end
193
- elsif !attributes[self.class.attribute_map[key]].nil?
194
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
- end # or else data not found in attributes(hash), not an issue as the data can be optional
246
+ elsif !attributes[attribute_map[key]].nil?
247
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
248
+ end
196
249
  end
197
-
198
- self
250
+ new(transformed_hash)
199
251
  end
200
252
 
201
253
  # Deserializes the data based on type
202
254
  # @param string type Data type
203
255
  # @param string value Value to be deserialized
204
256
  # @return [Object] Deserialized data
205
- def _deserialize(type, value)
257
+ def self._deserialize(type, value)
206
258
  case type.to_sym
207
- when :DateTime
208
- DateTime.parse(value)
259
+ when :Time
260
+ Time.parse(value)
209
261
  when :Date
210
262
  Date.parse(value)
211
263
  when :String
@@ -235,7 +287,9 @@ module PulpNpmClient
235
287
  end
236
288
  end
237
289
  else # model
238
- PulpNpmClient.const_get(type).build_from_hash(value)
290
+ # models (e.g. Pet) or oneOf
291
+ klass = PulpNpmClient.const_get(type)
292
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
293
  end
240
294
  end
241
295
 
@@ -261,7 +315,7 @@ module PulpNpmClient
261
315
  is_nullable = self.class.openapi_nullable.include?(attr)
262
316
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
317
  end
264
-
318
+
265
319
  hash[param] = _to_hash(value)
266
320
  end
267
321
  hash
@@ -284,5 +338,7 @@ module PulpNpmClient
284
338
  value
285
339
  end
286
340
  end
341
+
287
342
  end
343
+
288
344
  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 PulpNpmClient
16
17
  # A Serializer for NpmRemote. Add any new fields if defined on NpmRemote. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = platform.RemoteSerializer.Meta.validators + [myValidator1, myValidator2] By default the 'policy' field in platform.RemoteSerializer only validates the choice 'immediate'. To add on-demand support for more 'policy' options, e.g. 'streamed' or 'on_demand', re-define the 'policy' option as follows::
@@ -56,7 +57,7 @@ module PulpNpmClient
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. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default.
60
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default. * `immediate` - When syncing, download all metadata and content now. * `on_demand` - When syncing, download metadata, but do not download content now. Instead, download content as clients request it, and save it in Pulp to be served for future client requests. * `streamed` - When syncing, download metadata, but do not download content now. Instead,download content as clients request it, but never save it in Pulp. This causes future requests for that same content to have to be downloaded again.
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 PulpNpmClient
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 PulpNpmClient
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
  {
@@ -118,7 +146,7 @@ module PulpNpmClient
118
146
  :'proxy_password' => :'String',
119
147
  :'username' => :'String',
120
148
  :'password' => :'String',
121
- :'pulp_labels' => :'Object',
149
+ :'pulp_labels' => :'Hash<String, String>',
122
150
  :'download_concurrency' => :'Integer',
123
151
  :'max_retries' => :'Integer',
124
152
  :'policy' => :'PolicyEnum',
@@ -169,10 +197,14 @@ module PulpNpmClient
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')
@@ -212,7 +244,9 @@ module PulpNpmClient
212
244
  end
213
245
 
214
246
  if attributes.key?(:'pulp_labels')
215
- self.pulp_labels = attributes[:'pulp_labels']
247
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
248
+ self.pulp_labels = value
249
+ end
216
250
  end
217
251
 
218
252
  if attributes.key?(:'download_concurrency')
@@ -257,6 +291,7 @@ module PulpNpmClient
257
291
  # Show invalid properties with the reasons. Usually used together with valid?
258
292
  # @return Array for valid properties with the reasons
259
293
  def list_invalid_properties
294
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
260
295
  invalid_properties = Array.new
261
296
  if @name.nil?
262
297
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -332,6 +367,7 @@ module PulpNpmClient
332
367
  # Check to see if the all the properties in the model are valid
333
368
  # @return true if the model is valid
334
369
  def valid?
370
+ warn '[DEPRECATED] the `valid?` method is obsolete'
335
371
  return false if @name.nil?
336
372
  return false if @name.to_s.length < 1
337
373
  return false if @url.nil?
@@ -554,37 +590,33 @@ module PulpNpmClient
554
590
  # @param [Hash] attributes Model attributes in the form of hash
555
591
  # @return [Object] Returns the model itself
556
592
  def self.build_from_hash(attributes)
557
- new.build_from_hash(attributes)
558
- end
559
-
560
- # Builds the object from hash
561
- # @param [Hash] attributes Model attributes in the form of hash
562
- # @return [Object] Returns the model itself
563
- def build_from_hash(attributes)
564
593
  return nil unless attributes.is_a?(Hash)
565
- self.class.openapi_types.each_pair do |key, type|
566
- if type =~ /\AArray<(.*)>/i
594
+ attributes = attributes.transform_keys(&:to_sym)
595
+ transformed_hash = {}
596
+ openapi_types.each_pair do |key, type|
597
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
598
+ transformed_hash["#{key}"] = nil
599
+ elsif type =~ /\AArray<(.*)>/i
567
600
  # check to ensure the input is an array given that the attribute
568
601
  # is documented as an array but the input is not
569
- if attributes[self.class.attribute_map[key]].is_a?(Array)
570
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
602
+ if attributes[attribute_map[key]].is_a?(Array)
603
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
571
604
  end
572
- elsif !attributes[self.class.attribute_map[key]].nil?
573
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
574
- end # or else data not found in attributes(hash), not an issue as the data can be optional
605
+ elsif !attributes[attribute_map[key]].nil?
606
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
607
+ end
575
608
  end
576
-
577
- self
609
+ new(transformed_hash)
578
610
  end
579
611
 
580
612
  # Deserializes the data based on type
581
613
  # @param string type Data type
582
614
  # @param string value Value to be deserialized
583
615
  # @return [Object] Deserialized data
584
- def _deserialize(type, value)
616
+ def self._deserialize(type, value)
585
617
  case type.to_sym
586
- when :DateTime
587
- DateTime.parse(value)
618
+ when :Time
619
+ Time.parse(value)
588
620
  when :Date
589
621
  Date.parse(value)
590
622
  when :String
@@ -614,7 +646,9 @@ module PulpNpmClient
614
646
  end
615
647
  end
616
648
  else # model
617
- PulpNpmClient.const_get(type).build_from_hash(value)
649
+ # models (e.g. Pet) or oneOf
650
+ klass = PulpNpmClient.const_get(type)
651
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
618
652
  end
619
653
  end
620
654
 
@@ -640,7 +674,7 @@ module PulpNpmClient
640
674
  is_nullable = self.class.openapi_nullable.include?(attr)
641
675
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
642
676
  end
643
-
677
+
644
678
  hash[param] = _to_hash(value)
645
679
  end
646
680
  hash
@@ -663,5 +697,7 @@ module PulpNpmClient
663
697
  value
664
698
  end
665
699
  end
700
+
666
701
  end
702
+
667
703
  end