pulp_npm_client 0.1.0a4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
  # A Serializer for NpmRepository. Add any new fields if defined on NpmRepository. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = platform.RepositorySerializer.Meta.validators + [myValidator1, myValidator2]
@@ -23,7 +24,7 @@ module PulpNpmClient
23
24
  # An optional description.
24
25
  attr_accessor :description
25
26
 
26
- # Retain X versions of the repository. Default is null which retains all versions. This is provided as a tech preview in Pulp 3 and may change in the future.
27
+ # Retain X versions of the repository. Default is null which retains all versions.
27
28
  attr_accessor :retain_repo_versions
28
29
 
29
30
  # An optional remote to use by default when syncing.
@@ -40,10 +41,15 @@ module PulpNpmClient
40
41
  }
41
42
  end
42
43
 
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
43
49
  # Attribute type mapping.
44
50
  def self.openapi_types
45
51
  {
46
- :'pulp_labels' => :'Object',
52
+ :'pulp_labels' => :'Hash<String, String>',
47
53
  :'name' => :'String',
48
54
  :'description' => :'String',
49
55
  :'retain_repo_versions' => :'Integer',
@@ -76,11 +82,15 @@ module PulpNpmClient
76
82
  }
77
83
 
78
84
  if attributes.key?(:'pulp_labels')
79
- self.pulp_labels = attributes[:'pulp_labels']
85
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
86
+ self.pulp_labels = value
87
+ end
80
88
  end
81
89
 
82
90
  if attributes.key?(:'name')
83
91
  self.name = attributes[:'name']
92
+ else
93
+ self.name = nil
84
94
  end
85
95
 
86
96
  if attributes.key?(:'description')
@@ -99,6 +109,7 @@ module PulpNpmClient
99
109
  # Show invalid properties with the reasons. Usually used together with valid?
100
110
  # @return Array for valid properties with the reasons
101
111
  def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
113
  invalid_properties = Array.new
103
114
  if @name.nil?
104
115
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -122,6 +133,7 @@ module PulpNpmClient
122
133
  # Check to see if the all the properties in the model are valid
123
134
  # @return true if the model is valid
124
135
  def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
137
  return false if @name.nil?
126
138
  return false if @name.to_s.length < 1
127
139
  return false if !@description.nil? && @description.to_s.length < 1
@@ -191,37 +203,33 @@ module PulpNpmClient
191
203
  # @param [Hash] attributes Model attributes in the form of hash
192
204
  # @return [Object] Returns the model itself
193
205
  def self.build_from_hash(attributes)
194
- new.build_from_hash(attributes)
195
- end
196
-
197
- # Builds the object from hash
198
- # @param [Hash] attributes Model attributes in the form of hash
199
- # @return [Object] Returns the model itself
200
- def build_from_hash(attributes)
201
206
  return nil unless attributes.is_a?(Hash)
202
- self.class.openapi_types.each_pair do |key, type|
203
- if type =~ /\AArray<(.*)>/i
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ transformed_hash = {}
209
+ openapi_types.each_pair do |key, type|
210
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = nil
212
+ elsif type =~ /\AArray<(.*)>/i
204
213
  # check to ensure the input is an array given that the attribute
205
214
  # is documented as an array but the input is not
206
- if attributes[self.class.attribute_map[key]].is_a?(Array)
207
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
215
+ if attributes[attribute_map[key]].is_a?(Array)
216
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
208
217
  end
209
- elsif !attributes[self.class.attribute_map[key]].nil?
210
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
211
- end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ elsif !attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
220
+ end
212
221
  end
213
-
214
- self
222
+ new(transformed_hash)
215
223
  end
216
224
 
217
225
  # Deserializes the data based on type
218
226
  # @param string type Data type
219
227
  # @param string value Value to be deserialized
220
228
  # @return [Object] Deserialized data
221
- def _deserialize(type, value)
229
+ def self._deserialize(type, value)
222
230
  case type.to_sym
223
- when :DateTime
224
- DateTime.parse(value)
231
+ when :Time
232
+ Time.parse(value)
225
233
  when :Date
226
234
  Date.parse(value)
227
235
  when :String
@@ -251,7 +259,9 @@ module PulpNpmClient
251
259
  end
252
260
  end
253
261
  else # model
254
- PulpNpmClient.const_get(type).build_from_hash(value)
262
+ # models (e.g. Pet) or oneOf
263
+ klass = PulpNpmClient.const_get(type)
264
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
255
265
  end
256
266
  end
257
267
 
@@ -277,7 +287,7 @@ module PulpNpmClient
277
287
  is_nullable = self.class.openapi_nullable.include?(attr)
278
288
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
289
  end
280
-
290
+
281
291
  hash[param] = _to_hash(value)
282
292
  end
283
293
  hash
@@ -300,5 +310,7 @@ module PulpNpmClient
300
310
  value
301
311
  end
302
312
  end
313
+
303
314
  end
315
+
304
316
  end
@@ -6,20 +6,27 @@
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 NpmRepository. Add any new fields if defined on NpmRepository. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = platform.RepositorySerializer.Meta.validators + [myValidator1, myValidator2]
17
18
  class NpmNpmRepositoryResponse
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
  attr_accessor :versions_href
24
31
 
25
32
  attr_accessor :pulp_labels
@@ -32,7 +39,7 @@ module PulpNpmClient
32
39
  # An optional description.
33
40
  attr_accessor :description
34
41
 
35
- # Retain X versions of the repository. Default is null which retains all versions. This is provided as a tech preview in Pulp 3 and may change in the future.
42
+ # Retain X versions of the repository. Default is null which retains all versions.
36
43
  attr_accessor :retain_repo_versions
37
44
 
38
45
  # An optional remote to use by default when syncing.
@@ -42,7 +49,9 @@ module PulpNpmClient
42
49
  def self.attribute_map
43
50
  {
44
51
  :'pulp_href' => :'pulp_href',
52
+ :'prn' => :'prn',
45
53
  :'pulp_created' => :'pulp_created',
54
+ :'pulp_last_updated' => :'pulp_last_updated',
46
55
  :'versions_href' => :'versions_href',
47
56
  :'pulp_labels' => :'pulp_labels',
48
57
  :'latest_version_href' => :'latest_version_href',
@@ -53,13 +62,20 @@ module PulpNpmClient
53
62
  }
54
63
  end
55
64
 
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
56
70
  # Attribute type mapping.
57
71
  def self.openapi_types
58
72
  {
59
73
  :'pulp_href' => :'String',
60
- :'pulp_created' => :'DateTime',
74
+ :'prn' => :'String',
75
+ :'pulp_created' => :'Time',
76
+ :'pulp_last_updated' => :'Time',
61
77
  :'versions_href' => :'String',
62
- :'pulp_labels' => :'Object',
78
+ :'pulp_labels' => :'Hash<String, String>',
63
79
  :'latest_version_href' => :'String',
64
80
  :'name' => :'String',
65
81
  :'description' => :'String',
@@ -96,16 +112,26 @@ module PulpNpmClient
96
112
  self.pulp_href = attributes[:'pulp_href']
97
113
  end
98
114
 
115
+ if attributes.key?(:'prn')
116
+ self.prn = attributes[:'prn']
117
+ end
118
+
99
119
  if attributes.key?(:'pulp_created')
100
120
  self.pulp_created = attributes[:'pulp_created']
101
121
  end
102
122
 
123
+ if attributes.key?(:'pulp_last_updated')
124
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
125
+ end
126
+
103
127
  if attributes.key?(:'versions_href')
104
128
  self.versions_href = attributes[:'versions_href']
105
129
  end
106
130
 
107
131
  if attributes.key?(:'pulp_labels')
108
- self.pulp_labels = attributes[:'pulp_labels']
132
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
133
+ self.pulp_labels = value
134
+ end
109
135
  end
110
136
 
111
137
  if attributes.key?(:'latest_version_href')
@@ -114,6 +140,8 @@ module PulpNpmClient
114
140
 
115
141
  if attributes.key?(:'name')
116
142
  self.name = attributes[:'name']
143
+ else
144
+ self.name = nil
117
145
  end
118
146
 
119
147
  if attributes.key?(:'description')
@@ -132,6 +160,7 @@ module PulpNpmClient
132
160
  # Show invalid properties with the reasons. Usually used together with valid?
133
161
  # @return Array for valid properties with the reasons
134
162
  def list_invalid_properties
163
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
135
164
  invalid_properties = Array.new
136
165
  if @name.nil?
137
166
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -147,6 +176,7 @@ module PulpNpmClient
147
176
  # Check to see if the all the properties in the model are valid
148
177
  # @return true if the model is valid
149
178
  def valid?
179
+ warn '[DEPRECATED] the `valid?` method is obsolete'
150
180
  return false if @name.nil?
151
181
  return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
152
182
  true
@@ -168,7 +198,9 @@ module PulpNpmClient
168
198
  return true if self.equal?(o)
169
199
  self.class == o.class &&
170
200
  pulp_href == o.pulp_href &&
201
+ prn == o.prn &&
171
202
  pulp_created == o.pulp_created &&
203
+ pulp_last_updated == o.pulp_last_updated &&
172
204
  versions_href == o.versions_href &&
173
205
  pulp_labels == o.pulp_labels &&
174
206
  latest_version_href == o.latest_version_href &&
@@ -187,44 +219,40 @@ module PulpNpmClient
187
219
  # Calculates hash code according to all attributes.
188
220
  # @return [Integer] Hash code
189
221
  def hash
190
- [pulp_href, pulp_created, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, remote].hash
222
+ [pulp_href, prn, pulp_created, pulp_last_updated, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, remote].hash
191
223
  end
192
224
 
193
225
  # Builds the object from hash
194
226
  # @param [Hash] attributes Model attributes in the form of hash
195
227
  # @return [Object] Returns the model itself
196
228
  def self.build_from_hash(attributes)
197
- new.build_from_hash(attributes)
198
- end
199
-
200
- # Builds the object from hash
201
- # @param [Hash] attributes Model attributes in the form of hash
202
- # @return [Object] Returns the model itself
203
- def build_from_hash(attributes)
204
229
  return nil unless attributes.is_a?(Hash)
205
- self.class.openapi_types.each_pair do |key, type|
206
- if type =~ /\AArray<(.*)>/i
230
+ attributes = attributes.transform_keys(&:to_sym)
231
+ transformed_hash = {}
232
+ openapi_types.each_pair do |key, type|
233
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = nil
235
+ elsif type =~ /\AArray<(.*)>/i
207
236
  # check to ensure the input is an array given that the attribute
208
237
  # is documented as an array but the input is not
209
- if attributes[self.class.attribute_map[key]].is_a?(Array)
210
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
238
+ if attributes[attribute_map[key]].is_a?(Array)
239
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
211
240
  end
212
- elsif !attributes[self.class.attribute_map[key]].nil?
213
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
214
- end # or else data not found in attributes(hash), not an issue as the data can be optional
241
+ elsif !attributes[attribute_map[key]].nil?
242
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
243
+ end
215
244
  end
216
-
217
- self
245
+ new(transformed_hash)
218
246
  end
219
247
 
220
248
  # Deserializes the data based on type
221
249
  # @param string type Data type
222
250
  # @param string value Value to be deserialized
223
251
  # @return [Object] Deserialized data
224
- def _deserialize(type, value)
252
+ def self._deserialize(type, value)
225
253
  case type.to_sym
226
- when :DateTime
227
- DateTime.parse(value)
254
+ when :Time
255
+ Time.parse(value)
228
256
  when :Date
229
257
  Date.parse(value)
230
258
  when :String
@@ -254,7 +282,9 @@ module PulpNpmClient
254
282
  end
255
283
  end
256
284
  else # model
257
- PulpNpmClient.const_get(type).build_from_hash(value)
285
+ # models (e.g. Pet) or oneOf
286
+ klass = PulpNpmClient.const_get(type)
287
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
288
  end
259
289
  end
260
290
 
@@ -280,7 +310,7 @@ module PulpNpmClient
280
310
  is_nullable = self.class.openapi_nullable.include?(attr)
281
311
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
312
  end
283
-
313
+
284
314
  hash[param] = _to_hash(value)
285
315
  end
286
316
  hash
@@ -303,5 +333,7 @@ module PulpNpmClient
303
333
  value
304
334
  end
305
335
  end
336
+
306
337
  end
338
+
307
339
  end
@@ -6,20 +6,27 @@
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 Package. Add serializers for the new fields defined in Package and add those fields to the Meta class keeping fields from the parent class as well. For example:: field1 = serializers.TextField() field2 = serializers.IntegerField() field3 = serializers.CharField() class Meta: fields = platform.SingleArtifactContentSerializer.Meta.fields + ( 'field1', 'field2', 'field3' ) model = models.Package
17
18
  class NpmPackageResponse
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
  # Artifact file representing the physical content
24
31
  attr_accessor :artifact
25
32
 
@@ -33,7 +40,9 @@ module PulpNpmClient
33
40
  def self.attribute_map
34
41
  {
35
42
  :'pulp_href' => :'pulp_href',
43
+ :'prn' => :'prn',
36
44
  :'pulp_created' => :'pulp_created',
45
+ :'pulp_last_updated' => :'pulp_last_updated',
37
46
  :'artifact' => :'artifact',
38
47
  :'relative_path' => :'relative_path',
39
48
  :'name' => :'name',
@@ -41,11 +50,18 @@ module PulpNpmClient
41
50
  }
42
51
  end
43
52
 
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
44
58
  # Attribute type mapping.
45
59
  def self.openapi_types
46
60
  {
47
61
  :'pulp_href' => :'String',
48
- :'pulp_created' => :'DateTime',
62
+ :'prn' => :'String',
63
+ :'pulp_created' => :'Time',
64
+ :'pulp_last_updated' => :'Time',
49
65
  :'artifact' => :'String',
50
66
  :'relative_path' => :'String',
51
67
  :'name' => :'String',
@@ -78,30 +94,45 @@ module PulpNpmClient
78
94
  self.pulp_href = attributes[:'pulp_href']
79
95
  end
80
96
 
97
+ if attributes.key?(:'prn')
98
+ self.prn = attributes[:'prn']
99
+ end
100
+
81
101
  if attributes.key?(:'pulp_created')
82
102
  self.pulp_created = attributes[:'pulp_created']
83
103
  end
84
104
 
105
+ if attributes.key?(:'pulp_last_updated')
106
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
107
+ end
108
+
85
109
  if attributes.key?(:'artifact')
86
110
  self.artifact = attributes[:'artifact']
87
111
  end
88
112
 
89
113
  if attributes.key?(:'relative_path')
90
114
  self.relative_path = attributes[:'relative_path']
115
+ else
116
+ self.relative_path = nil
91
117
  end
92
118
 
93
119
  if attributes.key?(:'name')
94
120
  self.name = attributes[:'name']
121
+ else
122
+ self.name = nil
95
123
  end
96
124
 
97
125
  if attributes.key?(:'version')
98
126
  self.version = attributes[:'version']
127
+ else
128
+ self.version = nil
99
129
  end
100
130
  end
101
131
 
102
132
  # Show invalid properties with the reasons. Usually used together with valid?
103
133
  # @return Array for valid properties with the reasons
104
134
  def list_invalid_properties
135
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
136
  invalid_properties = Array.new
106
137
  if @relative_path.nil?
107
138
  invalid_properties.push('invalid value for "relative_path", relative_path cannot be nil.')
@@ -121,6 +152,7 @@ module PulpNpmClient
121
152
  # Check to see if the all the properties in the model are valid
122
153
  # @return true if the model is valid
123
154
  def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
156
  return false if @relative_path.nil?
125
157
  return false if @name.nil?
126
158
  return false if @version.nil?
@@ -133,7 +165,9 @@ module PulpNpmClient
133
165
  return true if self.equal?(o)
134
166
  self.class == o.class &&
135
167
  pulp_href == o.pulp_href &&
168
+ prn == o.prn &&
136
169
  pulp_created == o.pulp_created &&
170
+ pulp_last_updated == o.pulp_last_updated &&
137
171
  artifact == o.artifact &&
138
172
  relative_path == o.relative_path &&
139
173
  name == o.name &&
@@ -149,44 +183,40 @@ module PulpNpmClient
149
183
  # Calculates hash code according to all attributes.
150
184
  # @return [Integer] Hash code
151
185
  def hash
152
- [pulp_href, pulp_created, artifact, relative_path, name, version].hash
186
+ [pulp_href, prn, pulp_created, pulp_last_updated, artifact, relative_path, name, version].hash
153
187
  end
154
188
 
155
189
  # Builds the object from hash
156
190
  # @param [Hash] attributes Model attributes in the form of hash
157
191
  # @return [Object] Returns the model itself
158
192
  def self.build_from_hash(attributes)
159
- new.build_from_hash(attributes)
160
- end
161
-
162
- # Builds the object from hash
163
- # @param [Hash] attributes Model attributes in the form of hash
164
- # @return [Object] Returns the model itself
165
- def build_from_hash(attributes)
166
193
  return nil unless attributes.is_a?(Hash)
167
- self.class.openapi_types.each_pair do |key, type|
168
- if type =~ /\AArray<(.*)>/i
194
+ attributes = attributes.transform_keys(&:to_sym)
195
+ transformed_hash = {}
196
+ openapi_types.each_pair do |key, type|
197
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = nil
199
+ elsif type =~ /\AArray<(.*)>/i
169
200
  # check to ensure the input is an array given that the attribute
170
201
  # is documented as an array but the input is not
171
- if attributes[self.class.attribute_map[key]].is_a?(Array)
172
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ if attributes[attribute_map[key]].is_a?(Array)
203
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
204
  end
174
- elsif !attributes[self.class.attribute_map[key]].nil?
175
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
- end # or else data not found in attributes(hash), not an issue as the data can be optional
205
+ elsif !attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
207
+ end
177
208
  end
178
-
179
- self
209
+ new(transformed_hash)
180
210
  end
181
211
 
182
212
  # Deserializes the data based on type
183
213
  # @param string type Data type
184
214
  # @param string value Value to be deserialized
185
215
  # @return [Object] Deserialized data
186
- def _deserialize(type, value)
216
+ def self._deserialize(type, value)
187
217
  case type.to_sym
188
- when :DateTime
189
- DateTime.parse(value)
218
+ when :Time
219
+ Time.parse(value)
190
220
  when :Date
191
221
  Date.parse(value)
192
222
  when :String
@@ -216,7 +246,9 @@ module PulpNpmClient
216
246
  end
217
247
  end
218
248
  else # model
219
- PulpNpmClient.const_get(type).build_from_hash(value)
249
+ # models (e.g. Pet) or oneOf
250
+ klass = PulpNpmClient.const_get(type)
251
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
252
  end
221
253
  end
222
254
 
@@ -242,7 +274,7 @@ module PulpNpmClient
242
274
  is_nullable = self.class.openapi_nullable.include?(attr)
243
275
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
276
  end
245
-
277
+
246
278
  hash[param] = _to_hash(value)
247
279
  end
248
280
  hash
@@ -265,5 +297,7 @@ module PulpNpmClient
265
297
  value
266
298
  end
267
299
  end
300
+
268
301
  end
302
+
269
303
  end