pulp_npm_client 0.1.0a4 → 0.2.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 +20 -15
  8. data/docs/NpmNpmDistributionResponse.md +32 -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 +20 -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 +66 -29
  46. data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +98 -31
  47. data/lib/pulp_npm_client/models/npm_npm_remote.rb +62 -26
  48. data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +100 -42
  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 +38 -26
  51. data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +60 -28
  52. data/lib/pulp_npm_client/models/npm_package_response.rb +59 -25
  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 +72 -31
  59. data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +68 -28
  60. data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +41 -27
  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 +44 -19
  81. data/spec/models/npm_npm_distribution_spec.rb +23 -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 +23 -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
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpNpmClient
17
+ class NpmNpmRemoteResponseHiddenFieldsInner
18
+ attr_accessor :name
19
+
20
+ attr_accessor :is_set
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'name' => :'name',
26
+ :'is_set' => :'is_set'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'name' => :'String',
39
+ :'is_set' => :'Boolean'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::NpmNpmRemoteResponseHiddenFieldsInner` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::NpmNpmRemoteResponseHiddenFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'name')
65
+ self.name = attributes[:'name']
66
+ else
67
+ self.name = nil
68
+ end
69
+
70
+ if attributes.key?(:'is_set')
71
+ self.is_set = attributes[:'is_set']
72
+ else
73
+ self.is_set = nil
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @name.nil?
83
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
84
+ end
85
+
86
+ if @is_set.nil?
87
+ invalid_properties.push('invalid value for "is_set", is_set cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ return false if @name.nil?
98
+ return false if @is_set.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ name == o.name &&
108
+ is_set == o.is_set
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [name, is_set].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def self._deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = PulpNpmClient.const_get(type)
185
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -6,14 +6,15 @@
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
- # 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
+ # 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 = core_serializers.RepositorySerializer.Meta.validators + [myValidator1, ...]
17
18
  class NpmNpmRepository
18
19
  attr_accessor :pulp_labels
19
20
 
@@ -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
- # 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
+ # 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 = core_serializers.RepositorySerializer.Meta.validators + [myValidator1, ...]
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