pulp_npm_client 0.1.0a1.dev01595813316 → 0.1.0a1.dev01596158992

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pulp_npm_client might be problematic. Click here for more details.

Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -11
  3. data/docs/ContentPackagesApi.md +27 -27
  4. data/docs/ContentSummary.md +3 -3
  5. data/docs/ContentSummaryResponse.md +21 -0
  6. data/docs/DistributionsNpmApi.md +104 -56
  7. data/docs/InlineResponse200.md +3 -3
  8. data/docs/InlineResponse2001.md +3 -3
  9. data/docs/InlineResponse2002.md +3 -3
  10. data/docs/InlineResponse2003.md +3 -3
  11. data/docs/InlineResponse2004.md +3 -3
  12. data/docs/NpmNpmDistribution.md +1 -7
  13. data/docs/NpmNpmDistributionResponse.md +31 -0
  14. data/docs/NpmNpmRemote.md +4 -10
  15. data/docs/NpmNpmRemoteResponse.md +43 -0
  16. data/docs/NpmNpmRepository.md +4 -10
  17. data/docs/NpmNpmRepositoryResponse.md +29 -0
  18. data/docs/NpmPackage.md +5 -5
  19. data/docs/NpmPackageResponse.md +27 -0
  20. data/docs/PatchednpmNpmDistribution.md +25 -0
  21. data/docs/PatchednpmNpmRemote.md +37 -0
  22. data/docs/PatchednpmNpmRepository.md +21 -0
  23. data/docs/PolicyEnum.md +16 -0
  24. data/docs/RemotesNpmApi.md +124 -64
  25. data/docs/RepositoriesNpmApi.md +94 -70
  26. data/docs/RepositoriesNpmVersionsApi.md +90 -58
  27. data/docs/RepositoryAddRemoveContent.md +2 -2
  28. data/docs/RepositorySyncURL.md +1 -1
  29. data/docs/RepositoryVersion.md +1 -9
  30. data/docs/RepositoryVersionResponse.md +25 -0
  31. data/lib/pulp_npm_client.rb +12 -2
  32. data/lib/pulp_npm_client/api/content_packages_api.rb +34 -46
  33. data/lib/pulp_npm_client/api/distributions_npm_api.rb +131 -68
  34. data/lib/pulp_npm_client/api/remotes_npm_api.rb +165 -84
  35. data/lib/pulp_npm_client/api/repositories_npm_api.rb +121 -94
  36. data/lib/pulp_npm_client/api/repositories_npm_versions_api.rb +119 -74
  37. data/lib/pulp_npm_client/api_client.rb +2 -2
  38. data/lib/pulp_npm_client/api_error.rb +2 -2
  39. data/lib/pulp_npm_client/configuration.rb +3 -3
  40. data/lib/pulp_npm_client/models/async_operation_response.rb +3 -2
  41. data/lib/pulp_npm_client/models/content_summary.rb +9 -15
  42. data/lib/pulp_npm_client/models/content_summary_response.rb +240 -0
  43. data/lib/pulp_npm_client/models/inline_response200.rb +3 -13
  44. data/lib/pulp_npm_client/models/inline_response2001.rb +3 -13
  45. data/lib/pulp_npm_client/models/inline_response2002.rb +3 -13
  46. data/lib/pulp_npm_client/models/inline_response2003.rb +3 -13
  47. data/lib/pulp_npm_client/models/inline_response2004.rb +3 -13
  48. data/lib/pulp_npm_client/models/npm_npm_distribution.rb +4 -85
  49. data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +290 -0
  50. data/lib/pulp_npm_client/models/npm_npm_remote.rb +7 -199
  51. data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +368 -0
  52. data/lib/pulp_npm_client/models/npm_npm_repository.rb +18 -78
  53. data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +271 -0
  54. data/lib/pulp_npm_client/models/npm_package.rb +24 -79
  55. data/lib/pulp_npm_client/models/npm_package_response.rb +269 -0
  56. data/lib/pulp_npm_client/models/patchednpm_npm_distribution.rb +251 -0
  57. data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +329 -0
  58. data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +229 -0
  59. data/lib/pulp_npm_client/models/policy_enum.rb +37 -0
  60. data/lib/pulp_npm_client/models/repository_add_remove_content.rb +5 -4
  61. data/lib/pulp_npm_client/models/repository_sync_url.rb +3 -8
  62. data/lib/pulp_npm_client/models/repository_version.rb +7 -43
  63. data/lib/pulp_npm_client/models/repository_version_response.rb +246 -0
  64. data/lib/pulp_npm_client/version.rb +3 -3
  65. data/pulp_npm_client.gemspec +4 -4
  66. data/spec/api/content_packages_api_spec.rb +14 -14
  67. data/spec/api/distributions_npm_api_spec.rb +39 -18
  68. data/spec/api/remotes_npm_api_spec.rb +51 -24
  69. data/spec/api/repositories_npm_api_spec.rb +31 -22
  70. data/spec/api/repositories_npm_versions_api_spec.rb +38 -23
  71. data/spec/api_client_spec.rb +2 -2
  72. data/spec/configuration_spec.rb +2 -2
  73. data/spec/models/async_operation_response_spec.rb +2 -2
  74. data/spec/models/content_summary_response_spec.rb +53 -0
  75. data/spec/models/content_summary_spec.rb +2 -2
  76. data/spec/models/inline_response2001_spec.rb +2 -2
  77. data/spec/models/inline_response2002_spec.rb +2 -2
  78. data/spec/models/inline_response2003_spec.rb +2 -2
  79. data/spec/models/inline_response2004_spec.rb +2 -2
  80. data/spec/models/inline_response200_spec.rb +2 -2
  81. data/spec/models/npm_npm_distribution_response_spec.rb +83 -0
  82. data/spec/models/npm_npm_distribution_spec.rb +2 -20
  83. data/spec/models/npm_npm_remote_response_spec.rb +119 -0
  84. data/spec/models/npm_npm_remote_spec.rb +2 -24
  85. data/spec/models/npm_npm_repository_response_spec.rb +77 -0
  86. data/spec/models/npm_npm_repository_spec.rb +5 -23
  87. data/spec/models/npm_package_response_spec.rb +71 -0
  88. data/spec/models/npm_package_spec.rb +6 -6
  89. data/spec/models/patchednpm_npm_distribution_spec.rb +65 -0
  90. data/spec/models/patchednpm_npm_remote_spec.rb +101 -0
  91. data/spec/models/patchednpm_npm_repository_spec.rb +53 -0
  92. data/spec/models/policy_enum_spec.rb +35 -0
  93. data/spec/models/repository_add_remove_content_spec.rb +2 -2
  94. data/spec/models/repository_sync_url_spec.rb +2 -2
  95. data/spec/models/repository_version_response_spec.rb +65 -0
  96. data/spec/models/repository_version_spec.rb +2 -26
  97. data/spec/spec_helper.rb +2 -2
  98. metadata +54 -14
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Pulp 3 API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
5
 
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
9
  OpenAPI Generator version: 4.2.3
10
10
 
@@ -13,22 +13,18 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module PulpNpmClient
16
+ # 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::
16
17
  class NpmNpmRemote
17
- attr_accessor :pulp_href
18
-
19
- # Timestamp of creation.
20
- attr_accessor :pulp_created
21
-
22
18
  # A unique name for this remote.
23
19
  attr_accessor :name
24
20
 
25
21
  # The URL of an external content source.
26
22
  attr_accessor :url
27
23
 
28
- # A string containing the PEM encoded CA certificate used to validate the server certificate presented by the remote server. All new line characters must be escaped.
24
+ # A PEM encoded CA certificate used to validate the server certificate presented by the remote server.
29
25
  attr_accessor :ca_cert
30
26
 
31
- # A string containing the PEM encoded client certificate used for authentication. All new line characters must be escaped.
27
+ # A PEM encoded client certificate used for authentication.
32
28
  attr_accessor :client_cert
33
29
 
34
30
  # A PEM encoded private key used for authentication.
@@ -46,42 +42,15 @@ module PulpNpmClient
46
42
  # The password to be used for authentication when syncing.
47
43
  attr_accessor :password
48
44
 
49
- # Timestamp of the most recent update of the remote.
50
- attr_accessor :pulp_last_updated
51
-
52
45
  # Total number of simultaneous connections.
53
46
  attr_accessor :download_concurrency
54
47
 
55
48
  # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default.
56
49
  attr_accessor :policy
57
50
 
58
- class EnumAttributeValidator
59
- attr_reader :datatype
60
- attr_reader :allowable_values
61
-
62
- def initialize(datatype, allowable_values)
63
- @allowable_values = allowable_values.map do |value|
64
- case datatype.to_s
65
- when /Integer/i
66
- value.to_i
67
- when /Float/i
68
- value.to_f
69
- else
70
- value
71
- end
72
- end
73
- end
74
-
75
- def valid?(value)
76
- !value || allowable_values.include?(value)
77
- end
78
- end
79
-
80
51
  # Attribute mapping from ruby-style variable name to JSON key.
81
52
  def self.attribute_map
82
53
  {
83
- :'pulp_href' => :'pulp_href',
84
- :'pulp_created' => :'pulp_created',
85
54
  :'name' => :'name',
86
55
  :'url' => :'url',
87
56
  :'ca_cert' => :'ca_cert',
@@ -91,7 +60,6 @@ module PulpNpmClient
91
60
  :'proxy_url' => :'proxy_url',
92
61
  :'username' => :'username',
93
62
  :'password' => :'password',
94
- :'pulp_last_updated' => :'pulp_last_updated',
95
63
  :'download_concurrency' => :'download_concurrency',
96
64
  :'policy' => :'policy'
97
65
  }
@@ -100,8 +68,6 @@ module PulpNpmClient
100
68
  # Attribute type mapping.
101
69
  def self.openapi_types
102
70
  {
103
- :'pulp_href' => :'String',
104
- :'pulp_created' => :'DateTime',
105
71
  :'name' => :'String',
106
72
  :'url' => :'String',
107
73
  :'ca_cert' => :'String',
@@ -111,9 +77,8 @@ module PulpNpmClient
111
77
  :'proxy_url' => :'String',
112
78
  :'username' => :'String',
113
79
  :'password' => :'String',
114
- :'pulp_last_updated' => :'DateTime',
115
80
  :'download_concurrency' => :'Integer',
116
- :'policy' => :'String'
81
+ :'policy' => :'PolicyEnum'
117
82
  }
118
83
  end
119
84
 
@@ -144,14 +109,6 @@ module PulpNpmClient
144
109
  h[k.to_sym] = v
145
110
  }
146
111
 
147
- if attributes.key?(:'pulp_href')
148
- self.pulp_href = attributes[:'pulp_href']
149
- end
150
-
151
- if attributes.key?(:'pulp_created')
152
- self.pulp_created = attributes[:'pulp_created']
153
- end
154
-
155
112
  if attributes.key?(:'name')
156
113
  self.name = attributes[:'name']
157
114
  end
@@ -188,18 +145,12 @@ module PulpNpmClient
188
145
  self.password = attributes[:'password']
189
146
  end
190
147
 
191
- if attributes.key?(:'pulp_last_updated')
192
- self.pulp_last_updated = attributes[:'pulp_last_updated']
193
- end
194
-
195
148
  if attributes.key?(:'download_concurrency')
196
149
  self.download_concurrency = attributes[:'download_concurrency']
197
150
  end
198
151
 
199
152
  if attributes.key?(:'policy')
200
153
  self.policy = attributes[:'policy']
201
- else
202
- self.policy = 'immediate'
203
154
  end
204
155
  end
205
156
 
@@ -211,42 +162,10 @@ module PulpNpmClient
211
162
  invalid_properties.push('invalid value for "name", name cannot be nil.')
212
163
  end
213
164
 
214
- if @name.to_s.length < 1
215
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
216
- end
217
-
218
165
  if @url.nil?
219
166
  invalid_properties.push('invalid value for "url", url cannot be nil.')
220
167
  end
221
168
 
222
- if @url.to_s.length < 1
223
- invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
224
- end
225
-
226
- if !@ca_cert.nil? && @ca_cert.to_s.length < 1
227
- invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
228
- end
229
-
230
- if !@client_cert.nil? && @client_cert.to_s.length < 1
231
- invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
232
- end
233
-
234
- if !@client_key.nil? && @client_key.to_s.length < 1
235
- invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
236
- end
237
-
238
- if !@proxy_url.nil? && @proxy_url.to_s.length < 1
239
- invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
240
- end
241
-
242
- if !@username.nil? && @username.to_s.length < 1
243
- invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
244
- end
245
-
246
- if !@password.nil? && @password.to_s.length < 1
247
- invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
248
- end
249
-
250
169
  if !@download_concurrency.nil? && @download_concurrency < 1
251
170
  invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
252
171
  end
@@ -258,109 +177,11 @@ module PulpNpmClient
258
177
  # @return true if the model is valid
259
178
  def valid?
260
179
  return false if @name.nil?
261
- return false if @name.to_s.length < 1
262
180
  return false if @url.nil?
263
- return false if @url.to_s.length < 1
264
- return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
265
- return false if !@client_cert.nil? && @client_cert.to_s.length < 1
266
- return false if !@client_key.nil? && @client_key.to_s.length < 1
267
- return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
268
- return false if !@username.nil? && @username.to_s.length < 1
269
- return false if !@password.nil? && @password.to_s.length < 1
270
181
  return false if !@download_concurrency.nil? && @download_concurrency < 1
271
- policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
272
- return false unless policy_validator.valid?(@policy)
273
182
  true
274
183
  end
275
184
 
276
- # Custom attribute writer method with validation
277
- # @param [Object] name Value to be assigned
278
- def name=(name)
279
- if name.nil?
280
- fail ArgumentError, 'name cannot be nil'
281
- end
282
-
283
- if name.to_s.length < 1
284
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
285
- end
286
-
287
- @name = name
288
- end
289
-
290
- # Custom attribute writer method with validation
291
- # @param [Object] url Value to be assigned
292
- def url=(url)
293
- if url.nil?
294
- fail ArgumentError, 'url cannot be nil'
295
- end
296
-
297
- if url.to_s.length < 1
298
- fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
299
- end
300
-
301
- @url = url
302
- end
303
-
304
- # Custom attribute writer method with validation
305
- # @param [Object] ca_cert Value to be assigned
306
- def ca_cert=(ca_cert)
307
- if !ca_cert.nil? && ca_cert.to_s.length < 1
308
- fail ArgumentError, 'invalid value for "ca_cert", the character length must be great than or equal to 1.'
309
- end
310
-
311
- @ca_cert = ca_cert
312
- end
313
-
314
- # Custom attribute writer method with validation
315
- # @param [Object] client_cert Value to be assigned
316
- def client_cert=(client_cert)
317
- if !client_cert.nil? && client_cert.to_s.length < 1
318
- fail ArgumentError, 'invalid value for "client_cert", the character length must be great than or equal to 1.'
319
- end
320
-
321
- @client_cert = client_cert
322
- end
323
-
324
- # Custom attribute writer method with validation
325
- # @param [Object] client_key Value to be assigned
326
- def client_key=(client_key)
327
- if !client_key.nil? && client_key.to_s.length < 1
328
- fail ArgumentError, 'invalid value for "client_key", the character length must be great than or equal to 1.'
329
- end
330
-
331
- @client_key = client_key
332
- end
333
-
334
- # Custom attribute writer method with validation
335
- # @param [Object] proxy_url Value to be assigned
336
- def proxy_url=(proxy_url)
337
- if !proxy_url.nil? && proxy_url.to_s.length < 1
338
- fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
339
- end
340
-
341
- @proxy_url = proxy_url
342
- end
343
-
344
- # Custom attribute writer method with validation
345
- # @param [Object] username Value to be assigned
346
- def username=(username)
347
- if !username.nil? && username.to_s.length < 1
348
- fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
349
- end
350
-
351
- @username = username
352
- end
353
-
354
- # Custom attribute writer method with validation
355
- # @param [Object] password Value to be assigned
356
- def password=(password)
357
- if !password.nil? && password.to_s.length < 1
358
- fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
359
- end
360
-
361
- @password = password
362
- end
363
-
364
185
  # Custom attribute writer method with validation
365
186
  # @param [Object] download_concurrency Value to be assigned
366
187
  def download_concurrency=(download_concurrency)
@@ -371,23 +192,11 @@ module PulpNpmClient
371
192
  @download_concurrency = download_concurrency
372
193
  end
373
194
 
374
- # Custom attribute writer method checking allowed values (enum).
375
- # @param [Object] policy Object to be assigned
376
- def policy=(policy)
377
- validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
378
- unless validator.valid?(policy)
379
- fail ArgumentError, "invalid value for \"policy\", must be one of #{validator.allowable_values}."
380
- end
381
- @policy = policy
382
- end
383
-
384
195
  # Checks equality by comparing each attribute.
385
196
  # @param [Object] Object to be compared
386
197
  def ==(o)
387
198
  return true if self.equal?(o)
388
199
  self.class == o.class &&
389
- pulp_href == o.pulp_href &&
390
- pulp_created == o.pulp_created &&
391
200
  name == o.name &&
392
201
  url == o.url &&
393
202
  ca_cert == o.ca_cert &&
@@ -397,7 +206,6 @@ module PulpNpmClient
397
206
  proxy_url == o.proxy_url &&
398
207
  username == o.username &&
399
208
  password == o.password &&
400
- pulp_last_updated == o.pulp_last_updated &&
401
209
  download_concurrency == o.download_concurrency &&
402
210
  policy == o.policy
403
211
  end
@@ -411,7 +219,7 @@ module PulpNpmClient
411
219
  # Calculates hash code according to all attributes.
412
220
  # @return [Integer] Hash code
413
221
  def hash
414
- [pulp_href, pulp_created, name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, username, password, pulp_last_updated, download_concurrency, policy].hash
222
+ [name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, username, password, download_concurrency, policy].hash
415
223
  end
416
224
 
417
225
  # Builds the object from hash
@@ -0,0 +1,368 @@
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
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpNpmClient
16
+ # 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::
17
+ class NpmNpmRemoteResponse
18
+ attr_accessor :pulp_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :pulp_created
22
+
23
+ # A unique name for this remote.
24
+ attr_accessor :name
25
+
26
+ # The URL of an external content source.
27
+ attr_accessor :url
28
+
29
+ # A PEM encoded CA certificate used to validate the server certificate presented by the remote server.
30
+ attr_accessor :ca_cert
31
+
32
+ # A PEM encoded client certificate used for authentication.
33
+ attr_accessor :client_cert
34
+
35
+ # A PEM encoded private key used for authentication.
36
+ attr_accessor :client_key
37
+
38
+ # If True, TLS peer validation must be performed.
39
+ attr_accessor :tls_validation
40
+
41
+ # The proxy URL. Format: scheme://user:password@host:port
42
+ attr_accessor :proxy_url
43
+
44
+ # The username to be used for authentication when syncing.
45
+ attr_accessor :username
46
+
47
+ # The password to be used for authentication when syncing.
48
+ attr_accessor :password
49
+
50
+ # Timestamp of the most recent update of the remote.
51
+ attr_accessor :pulp_last_updated
52
+
53
+ # Total number of simultaneous connections.
54
+ attr_accessor :download_concurrency
55
+
56
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default.
57
+ attr_accessor :policy
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'pulp_href' => :'pulp_href',
63
+ :'pulp_created' => :'pulp_created',
64
+ :'name' => :'name',
65
+ :'url' => :'url',
66
+ :'ca_cert' => :'ca_cert',
67
+ :'client_cert' => :'client_cert',
68
+ :'client_key' => :'client_key',
69
+ :'tls_validation' => :'tls_validation',
70
+ :'proxy_url' => :'proxy_url',
71
+ :'username' => :'username',
72
+ :'password' => :'password',
73
+ :'pulp_last_updated' => :'pulp_last_updated',
74
+ :'download_concurrency' => :'download_concurrency',
75
+ :'policy' => :'policy'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'pulp_href' => :'String',
83
+ :'pulp_created' => :'DateTime',
84
+ :'name' => :'String',
85
+ :'url' => :'String',
86
+ :'ca_cert' => :'String',
87
+ :'client_cert' => :'String',
88
+ :'client_key' => :'String',
89
+ :'tls_validation' => :'Boolean',
90
+ :'proxy_url' => :'String',
91
+ :'username' => :'String',
92
+ :'password' => :'String',
93
+ :'pulp_last_updated' => :'DateTime',
94
+ :'download_concurrency' => :'Integer',
95
+ :'policy' => :'PolicyEnum'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ :'ca_cert',
103
+ :'client_cert',
104
+ :'client_key',
105
+ :'proxy_url',
106
+ :'username',
107
+ :'password',
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::NpmNpmRemoteResponse` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ attributes = attributes.each_with_object({}) { |(k, v), h|
120
+ if (!self.class.attribute_map.key?(k.to_sym))
121
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::NpmNpmRemoteResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
122
+ end
123
+ h[k.to_sym] = v
124
+ }
125
+
126
+ if attributes.key?(:'pulp_href')
127
+ self.pulp_href = attributes[:'pulp_href']
128
+ end
129
+
130
+ if attributes.key?(:'pulp_created')
131
+ self.pulp_created = attributes[:'pulp_created']
132
+ end
133
+
134
+ if attributes.key?(:'name')
135
+ self.name = attributes[:'name']
136
+ end
137
+
138
+ if attributes.key?(:'url')
139
+ self.url = attributes[:'url']
140
+ end
141
+
142
+ if attributes.key?(:'ca_cert')
143
+ self.ca_cert = attributes[:'ca_cert']
144
+ end
145
+
146
+ if attributes.key?(:'client_cert')
147
+ self.client_cert = attributes[:'client_cert']
148
+ end
149
+
150
+ if attributes.key?(:'client_key')
151
+ self.client_key = attributes[:'client_key']
152
+ end
153
+
154
+ if attributes.key?(:'tls_validation')
155
+ self.tls_validation = attributes[:'tls_validation']
156
+ end
157
+
158
+ if attributes.key?(:'proxy_url')
159
+ self.proxy_url = attributes[:'proxy_url']
160
+ end
161
+
162
+ if attributes.key?(:'username')
163
+ self.username = attributes[:'username']
164
+ end
165
+
166
+ if attributes.key?(:'password')
167
+ self.password = attributes[:'password']
168
+ end
169
+
170
+ if attributes.key?(:'pulp_last_updated')
171
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
172
+ end
173
+
174
+ if attributes.key?(:'download_concurrency')
175
+ self.download_concurrency = attributes[:'download_concurrency']
176
+ end
177
+
178
+ if attributes.key?(:'policy')
179
+ self.policy = attributes[:'policy']
180
+ end
181
+ end
182
+
183
+ # Show invalid properties with the reasons. Usually used together with valid?
184
+ # @return Array for valid properties with the reasons
185
+ def list_invalid_properties
186
+ invalid_properties = Array.new
187
+ if @name.nil?
188
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
189
+ end
190
+
191
+ if @url.nil?
192
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
193
+ end
194
+
195
+ if !@download_concurrency.nil? && @download_concurrency < 1
196
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
197
+ end
198
+
199
+ invalid_properties
200
+ end
201
+
202
+ # Check to see if the all the properties in the model are valid
203
+ # @return true if the model is valid
204
+ def valid?
205
+ return false if @name.nil?
206
+ return false if @url.nil?
207
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
208
+ true
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] download_concurrency Value to be assigned
213
+ def download_concurrency=(download_concurrency)
214
+ if !download_concurrency.nil? && download_concurrency < 1
215
+ fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
216
+ end
217
+
218
+ @download_concurrency = download_concurrency
219
+ end
220
+
221
+ # Checks equality by comparing each attribute.
222
+ # @param [Object] Object to be compared
223
+ def ==(o)
224
+ return true if self.equal?(o)
225
+ self.class == o.class &&
226
+ pulp_href == o.pulp_href &&
227
+ pulp_created == o.pulp_created &&
228
+ name == o.name &&
229
+ url == o.url &&
230
+ ca_cert == o.ca_cert &&
231
+ client_cert == o.client_cert &&
232
+ client_key == o.client_key &&
233
+ tls_validation == o.tls_validation &&
234
+ proxy_url == o.proxy_url &&
235
+ username == o.username &&
236
+ password == o.password &&
237
+ pulp_last_updated == o.pulp_last_updated &&
238
+ download_concurrency == o.download_concurrency &&
239
+ policy == o.policy
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Integer] Hash code
250
+ def hash
251
+ [pulp_href, pulp_created, name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, username, password, pulp_last_updated, download_concurrency, policy].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def self.build_from_hash(attributes)
258
+ new.build_from_hash(attributes)
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def build_from_hash(attributes)
265
+ return nil unless attributes.is_a?(Hash)
266
+ self.class.openapi_types.each_pair do |key, type|
267
+ if type =~ /\AArray<(.*)>/i
268
+ # check to ensure the input is an array given that the attribute
269
+ # is documented as an array but the input is not
270
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
271
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
272
+ end
273
+ elsif !attributes[self.class.attribute_map[key]].nil?
274
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
275
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
276
+ end
277
+
278
+ self
279
+ end
280
+
281
+ # Deserializes the data based on type
282
+ # @param string type Data type
283
+ # @param string value Value to be deserialized
284
+ # @return [Object] Deserialized data
285
+ def _deserialize(type, value)
286
+ case type.to_sym
287
+ when :DateTime
288
+ DateTime.parse(value)
289
+ when :Date
290
+ Date.parse(value)
291
+ when :String
292
+ value.to_s
293
+ when :Integer
294
+ value.to_i
295
+ when :Float
296
+ value.to_f
297
+ when :Boolean
298
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
299
+ true
300
+ else
301
+ false
302
+ end
303
+ when :Object
304
+ # generic object (usually a Hash), return directly
305
+ value
306
+ when /\AArray<(?<inner_type>.+)>\z/
307
+ inner_type = Regexp.last_match[:inner_type]
308
+ value.map { |v| _deserialize(inner_type, v) }
309
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
310
+ k_type = Regexp.last_match[:k_type]
311
+ v_type = Regexp.last_match[:v_type]
312
+ {}.tap do |hash|
313
+ value.each do |k, v|
314
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
315
+ end
316
+ end
317
+ else # model
318
+ PulpNpmClient.const_get(type).build_from_hash(value)
319
+ end
320
+ end
321
+
322
+ # Returns the string representation of the object
323
+ # @return [String] String presentation of the object
324
+ def to_s
325
+ to_hash.to_s
326
+ end
327
+
328
+ # to_body is an alias to to_hash (backward compatibility)
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_body
331
+ to_hash
332
+ end
333
+
334
+ # Returns the object in the form of hash
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_hash
337
+ hash = {}
338
+ self.class.attribute_map.each_pair do |attr, param|
339
+ value = self.send(attr)
340
+ if value.nil?
341
+ is_nullable = self.class.openapi_nullable.include?(attr)
342
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
343
+ end
344
+
345
+ hash[param] = _to_hash(value)
346
+ end
347
+ hash
348
+ end
349
+
350
+ # Outputs non-array value in the form of hash
351
+ # For object, use to_hash. Otherwise, just return the value
352
+ # @param [Object] value Any valid value
353
+ # @return [Hash] Returns the value in the form of hash
354
+ def _to_hash(value)
355
+ if value.is_a?(Array)
356
+ value.compact.map { |v| _to_hash(v) }
357
+ elsif value.is_a?(Hash)
358
+ {}.tap do |hash|
359
+ value.each { |k, v| hash[k] = _to_hash(v) }
360
+ end
361
+ elsif value.respond_to? :to_hash
362
+ value.to_hash
363
+ else
364
+ value
365
+ end
366
+ end
367
+ end
368
+ end