pulp_deb_client 2.0.0b2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +163 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContentGenericContentsApi.md +194 -0
  7. data/docs/ContentInstallerFileIndexApi.md +186 -0
  8. data/docs/ContentInstallerPackagesApi.md +194 -0
  9. data/docs/ContentPackageIndexApi.md +186 -0
  10. data/docs/ContentPackagesApi.md +194 -0
  11. data/docs/ContentReleasesApi.md +186 -0
  12. data/docs/DebDistribution.md +29 -0
  13. data/docs/DebPublication.md +31 -0
  14. data/docs/DebRemote.md +57 -0
  15. data/docs/DistributionsAptApi.md +358 -0
  16. data/docs/GenericContent.md +41 -0
  17. data/docs/InlineResponse200.md +23 -0
  18. data/docs/InlineResponse2001.md +23 -0
  19. data/docs/InlineResponse2002.md +23 -0
  20. data/docs/InlineResponse2003.md +23 -0
  21. data/docs/InlineResponse2004.md +23 -0
  22. data/docs/InlineResponse2005.md +23 -0
  23. data/docs/InlineResponse2006.md +23 -0
  24. data/docs/InlineResponse2007.md +23 -0
  25. data/docs/InlineResponse2008.md +23 -0
  26. data/docs/InlineResponse2009.md +23 -0
  27. data/docs/InstallerFileIndex.md +31 -0
  28. data/docs/InstallerPackage.md +99 -0
  29. data/docs/Package.md +99 -0
  30. data/docs/PackageIndex.md +31 -0
  31. data/docs/PublicationsAptApi.md +235 -0
  32. data/docs/PublicationsVerbatimApi.md +235 -0
  33. data/docs/Release.md +31 -0
  34. data/docs/RemotesAptApi.md +417 -0
  35. data/docs/RepositorySyncURL.md +19 -0
  36. data/docs/VerbatimPublication.md +27 -0
  37. data/git_push.sh +58 -0
  38. data/lib/pulp_deb_client/api/content_generic_contents_api.rb +239 -0
  39. data/lib/pulp_deb_client/api/content_installer_file_index_api.rb +225 -0
  40. data/lib/pulp_deb_client/api/content_installer_packages_api.rb +235 -0
  41. data/lib/pulp_deb_client/api/content_package_index_api.rb +225 -0
  42. data/lib/pulp_deb_client/api/content_packages_api.rb +235 -0
  43. data/lib/pulp_deb_client/api/content_releases_api.rb +225 -0
  44. data/lib/pulp_deb_client/api/distributions_apt_api.rb +436 -0
  45. data/lib/pulp_deb_client/api/publications_apt_api.rb +279 -0
  46. data/lib/pulp_deb_client/api/publications_verbatim_api.rb +279 -0
  47. data/lib/pulp_deb_client/api/remotes_apt_api.rb +510 -0
  48. data/lib/pulp_deb_client/api_client.rb +402 -0
  49. data/lib/pulp_deb_client/api_error.rb +57 -0
  50. data/lib/pulp_deb_client/configuration.rb +243 -0
  51. data/lib/pulp_deb_client/models/async_operation_response.rb +202 -0
  52. data/lib/pulp_deb_client/models/deb_distribution.rb +337 -0
  53. data/lib/pulp_deb_client/models/deb_publication.rb +282 -0
  54. data/lib/pulp_deb_client/models/deb_remote.rb +653 -0
  55. data/lib/pulp_deb_client/models/generic_content.rb +444 -0
  56. data/lib/pulp_deb_client/models/inline_response200.rb +235 -0
  57. data/lib/pulp_deb_client/models/inline_response2001.rb +235 -0
  58. data/lib/pulp_deb_client/models/inline_response2002.rb +235 -0
  59. data/lib/pulp_deb_client/models/inline_response2003.rb +235 -0
  60. data/lib/pulp_deb_client/models/inline_response2004.rb +235 -0
  61. data/lib/pulp_deb_client/models/inline_response2005.rb +235 -0
  62. data/lib/pulp_deb_client/models/inline_response2006.rb +235 -0
  63. data/lib/pulp_deb_client/models/inline_response2007.rb +235 -0
  64. data/lib/pulp_deb_client/models/inline_response2008.rb +235 -0
  65. data/lib/pulp_deb_client/models/inline_response2009.rb +235 -0
  66. data/lib/pulp_deb_client/models/installer_file_index.rb +355 -0
  67. data/lib/pulp_deb_client/models/installer_package.rb +1101 -0
  68. data/lib/pulp_deb_client/models/package.rb +1101 -0
  69. data/lib/pulp_deb_client/models/package_index.rb +355 -0
  70. data/lib/pulp_deb_client/models/release.rb +356 -0
  71. data/lib/pulp_deb_client/models/repository_sync_url.rb +214 -0
  72. data/lib/pulp_deb_client/models/verbatim_publication.rb +258 -0
  73. data/lib/pulp_deb_client/version.rb +15 -0
  74. data/lib/pulp_deb_client.rb +71 -0
  75. data/pulp_deb_client.gemspec +39 -0
  76. data/spec/api/content_generic_contents_api_spec.rb +80 -0
  77. data/spec/api/content_installer_file_index_api_spec.rb +77 -0
  78. data/spec/api/content_installer_packages_api_spec.rb +80 -0
  79. data/spec/api/content_package_index_api_spec.rb +77 -0
  80. data/spec/api/content_packages_api_spec.rb +80 -0
  81. data/spec/api/content_releases_api_spec.rb +77 -0
  82. data/spec/api/distributions_apt_api_spec.rb +118 -0
  83. data/spec/api/publications_apt_api_spec.rb +87 -0
  84. data/spec/api/publications_verbatim_api_spec.rb +87 -0
  85. data/spec/api/remotes_apt_api_spec.rb +132 -0
  86. data/spec/api_client_spec.rb +188 -0
  87. data/spec/configuration_spec.rb +42 -0
  88. data/spec/models/async_operation_response_spec.rb +41 -0
  89. data/spec/models/deb_distribution_spec.rb +77 -0
  90. data/spec/models/deb_publication_spec.rb +83 -0
  91. data/spec/models/deb_remote_spec.rb +165 -0
  92. data/spec/models/generic_content_spec.rb +113 -0
  93. data/spec/models/inline_response2001_spec.rb +59 -0
  94. data/spec/models/inline_response2002_spec.rb +59 -0
  95. data/spec/models/inline_response2003_spec.rb +59 -0
  96. data/spec/models/inline_response2004_spec.rb +59 -0
  97. data/spec/models/inline_response2005_spec.rb +59 -0
  98. data/spec/models/inline_response2006_spec.rb +59 -0
  99. data/spec/models/inline_response2007_spec.rb +59 -0
  100. data/spec/models/inline_response2008_spec.rb +59 -0
  101. data/spec/models/inline_response2009_spec.rb +59 -0
  102. data/spec/models/inline_response200_spec.rb +59 -0
  103. data/spec/models/installer_file_index_spec.rb +83 -0
  104. data/spec/models/installer_package_spec.rb +287 -0
  105. data/spec/models/package_index_spec.rb +83 -0
  106. data/spec/models/package_spec.rb +287 -0
  107. data/spec/models/release_spec.rb +83 -0
  108. data/spec/models/repository_sync_url_spec.rb +47 -0
  109. data/spec/models/verbatim_publication_spec.rb +71 -0
  110. data/spec/spec_helper.rb +111 -0
  111. metadata +242 -0
@@ -0,0 +1,355 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpDebClient
16
+ class PackageIndex
17
+ attr_accessor :_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :_created
21
+
22
+ attr_accessor :_type
23
+
24
+ # A dict mapping relative paths inside the Content to the correspondingArtifact URLs. E.g.: {'relative/path': '/artifacts/1/'
25
+ attr_accessor :artifacts
26
+
27
+ # Release this index file belongs to.
28
+ attr_accessor :release
29
+
30
+ # Component of the component - architecture combination.
31
+ attr_accessor :component
32
+
33
+ # Architecture of the component - architecture combination.
34
+ attr_accessor :architecture
35
+
36
+ # Path of file relative to url.
37
+ attr_accessor :relative_path
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'_href' => :'_href',
43
+ :'_created' => :'_created',
44
+ :'_type' => :'_type',
45
+ :'artifacts' => :'artifacts',
46
+ :'release' => :'release',
47
+ :'component' => :'component',
48
+ :'architecture' => :'architecture',
49
+ :'relative_path' => :'relative_path'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'_href' => :'String',
57
+ :'_created' => :'DateTime',
58
+ :'_type' => :'String',
59
+ :'artifacts' => :'Hash<String, String>',
60
+ :'release' => :'String',
61
+ :'component' => :'String',
62
+ :'architecture' => :'String',
63
+ :'relative_path' => :'String'
64
+ }
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::PackageIndex` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::PackageIndex`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'_href')
83
+ self._href = attributes[:'_href']
84
+ end
85
+
86
+ if attributes.key?(:'_created')
87
+ self._created = attributes[:'_created']
88
+ end
89
+
90
+ if attributes.key?(:'_type')
91
+ self._type = attributes[:'_type']
92
+ end
93
+
94
+ if attributes.key?(:'artifacts')
95
+ if (value = attributes[:'artifacts']).is_a?(Hash)
96
+ self.artifacts = value
97
+ end
98
+ end
99
+
100
+ if attributes.key?(:'release')
101
+ self.release = attributes[:'release']
102
+ end
103
+
104
+ if attributes.key?(:'component')
105
+ self.component = attributes[:'component']
106
+ end
107
+
108
+ if attributes.key?(:'architecture')
109
+ self.architecture = attributes[:'architecture']
110
+ end
111
+
112
+ if attributes.key?(:'relative_path')
113
+ self.relative_path = attributes[:'relative_path']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ if !@_type.nil? && @_type.to_s.length < 1
122
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
123
+ end
124
+
125
+ if @artifacts.nil?
126
+ invalid_properties.push('invalid value for "artifacts", artifacts cannot be nil.')
127
+ end
128
+
129
+ if @release.nil?
130
+ invalid_properties.push('invalid value for "release", release cannot be nil.')
131
+ end
132
+
133
+ if @component.nil?
134
+ invalid_properties.push('invalid value for "component", component cannot be nil.')
135
+ end
136
+
137
+ if @component.to_s.length < 1
138
+ invalid_properties.push('invalid value for "component", the character length must be great than or equal to 1.')
139
+ end
140
+
141
+ if @architecture.nil?
142
+ invalid_properties.push('invalid value for "architecture", architecture cannot be nil.')
143
+ end
144
+
145
+ if @architecture.to_s.length < 1
146
+ invalid_properties.push('invalid value for "architecture", the character length must be great than or equal to 1.')
147
+ end
148
+
149
+ if !@relative_path.nil? && @relative_path.to_s.length < 1
150
+ invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return false if !@_type.nil? && @_type.to_s.length < 1
160
+ return false if @artifacts.nil?
161
+ return false if @release.nil?
162
+ return false if @component.nil?
163
+ return false if @component.to_s.length < 1
164
+ return false if @architecture.nil?
165
+ return false if @architecture.to_s.length < 1
166
+ return false if !@relative_path.nil? && @relative_path.to_s.length < 1
167
+ true
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] _type Value to be assigned
172
+ def _type=(_type)
173
+ if !_type.nil? && _type.to_s.length < 1
174
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
175
+ end
176
+
177
+ @_type = _type
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] component Value to be assigned
182
+ def component=(component)
183
+ if component.nil?
184
+ fail ArgumentError, 'component cannot be nil'
185
+ end
186
+
187
+ if component.to_s.length < 1
188
+ fail ArgumentError, 'invalid value for "component", the character length must be great than or equal to 1.'
189
+ end
190
+
191
+ @component = component
192
+ end
193
+
194
+ # Custom attribute writer method with validation
195
+ # @param [Object] architecture Value to be assigned
196
+ def architecture=(architecture)
197
+ if architecture.nil?
198
+ fail ArgumentError, 'architecture cannot be nil'
199
+ end
200
+
201
+ if architecture.to_s.length < 1
202
+ fail ArgumentError, 'invalid value for "architecture", the character length must be great than or equal to 1.'
203
+ end
204
+
205
+ @architecture = architecture
206
+ end
207
+
208
+ # Custom attribute writer method with validation
209
+ # @param [Object] relative_path Value to be assigned
210
+ def relative_path=(relative_path)
211
+ if !relative_path.nil? && relative_path.to_s.length < 1
212
+ fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
213
+ end
214
+
215
+ @relative_path = relative_path
216
+ end
217
+
218
+ # Checks equality by comparing each attribute.
219
+ # @param [Object] Object to be compared
220
+ def ==(o)
221
+ return true if self.equal?(o)
222
+ self.class == o.class &&
223
+ _href == o._href &&
224
+ _created == o._created &&
225
+ _type == o._type &&
226
+ artifacts == o.artifacts &&
227
+ release == o.release &&
228
+ component == o.component &&
229
+ architecture == o.architecture &&
230
+ relative_path == o.relative_path
231
+ end
232
+
233
+ # @see the `==` method
234
+ # @param [Object] Object to be compared
235
+ def eql?(o)
236
+ self == o
237
+ end
238
+
239
+ # Calculates hash code according to all attributes.
240
+ # @return [Integer] Hash code
241
+ def hash
242
+ [_href, _created, _type, artifacts, release, component, architecture, relative_path].hash
243
+ end
244
+
245
+ # Builds the object from hash
246
+ # @param [Hash] attributes Model attributes in the form of hash
247
+ # @return [Object] Returns the model itself
248
+ def self.build_from_hash(attributes)
249
+ new.build_from_hash(attributes)
250
+ end
251
+
252
+ # Builds the object from hash
253
+ # @param [Hash] attributes Model attributes in the form of hash
254
+ # @return [Object] Returns the model itself
255
+ def build_from_hash(attributes)
256
+ return nil unless attributes.is_a?(Hash)
257
+ self.class.openapi_types.each_pair do |key, type|
258
+ if type =~ /\AArray<(.*)>/i
259
+ # check to ensure the input is an array given that the attribute
260
+ # is documented as an array but the input is not
261
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
262
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
263
+ end
264
+ elsif !attributes[self.class.attribute_map[key]].nil?
265
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
266
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
267
+ end
268
+
269
+ self
270
+ end
271
+
272
+ # Deserializes the data based on type
273
+ # @param string type Data type
274
+ # @param string value Value to be deserialized
275
+ # @return [Object] Deserialized data
276
+ def _deserialize(type, value)
277
+ case type.to_sym
278
+ when :DateTime
279
+ DateTime.parse(value)
280
+ when :Date
281
+ Date.parse(value)
282
+ when :String
283
+ value.to_s
284
+ when :Integer
285
+ value.to_i
286
+ when :Float
287
+ value.to_f
288
+ when :Boolean
289
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
290
+ true
291
+ else
292
+ false
293
+ end
294
+ when :Object
295
+ # generic object (usually a Hash), return directly
296
+ value
297
+ when /\AArray<(?<inner_type>.+)>\z/
298
+ inner_type = Regexp.last_match[:inner_type]
299
+ value.map { |v| _deserialize(inner_type, v) }
300
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
301
+ k_type = Regexp.last_match[:k_type]
302
+ v_type = Regexp.last_match[:v_type]
303
+ {}.tap do |hash|
304
+ value.each do |k, v|
305
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
306
+ end
307
+ end
308
+ else # model
309
+ PulpDebClient.const_get(type).build_from_hash(value)
310
+ end
311
+ end
312
+
313
+ # Returns the string representation of the object
314
+ # @return [String] String presentation of the object
315
+ def to_s
316
+ to_hash.to_s
317
+ end
318
+
319
+ # to_body is an alias to to_hash (backward compatibility)
320
+ # @return [Hash] Returns the object in the form of hash
321
+ def to_body
322
+ to_hash
323
+ end
324
+
325
+ # Returns the object in the form of hash
326
+ # @return [Hash] Returns the object in the form of hash
327
+ def to_hash
328
+ hash = {}
329
+ self.class.attribute_map.each_pair do |attr, param|
330
+ value = self.send(attr)
331
+ next if value.nil?
332
+ hash[param] = _to_hash(value)
333
+ end
334
+ hash
335
+ end
336
+
337
+ # Outputs non-array value in the form of hash
338
+ # For object, use to_hash. Otherwise, just return the value
339
+ # @param [Object] value Any valid value
340
+ # @return [Hash] Returns the value in the form of hash
341
+ def _to_hash(value)
342
+ if value.is_a?(Array)
343
+ value.compact.map { |v| _to_hash(v) }
344
+ elsif value.is_a?(Hash)
345
+ {}.tap do |hash|
346
+ value.each { |k, v| hash[k] = _to_hash(v) }
347
+ end
348
+ elsif value.respond_to? :to_hash
349
+ value.to_hash
350
+ else
351
+ value
352
+ end
353
+ end
354
+ end
355
+ end
@@ -0,0 +1,356 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpDebClient
16
+ class Release
17
+ attr_accessor :_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :_created
21
+
22
+ attr_accessor :_type
23
+
24
+ # A dict mapping relative paths inside the Content to the correspondingArtifact URLs. E.g.: {'relative/path': '/artifacts/1/'
25
+ attr_accessor :artifacts
26
+
27
+ # Codename of the release, i.e. \"buster\".
28
+ attr_accessor :codename
29
+
30
+ # Suite of the release, i.e. \"stable\".
31
+ attr_accessor :suite
32
+
33
+ # Distribution of the release, i.e. \"stable/updates\".
34
+ attr_accessor :distribution
35
+
36
+ # Path of file relative to url.
37
+ attr_accessor :relative_path
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'_href' => :'_href',
43
+ :'_created' => :'_created',
44
+ :'_type' => :'_type',
45
+ :'artifacts' => :'artifacts',
46
+ :'codename' => :'codename',
47
+ :'suite' => :'suite',
48
+ :'distribution' => :'distribution',
49
+ :'relative_path' => :'relative_path'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'_href' => :'String',
57
+ :'_created' => :'DateTime',
58
+ :'_type' => :'String',
59
+ :'artifacts' => :'Hash<String, String>',
60
+ :'codename' => :'String',
61
+ :'suite' => :'String',
62
+ :'distribution' => :'String',
63
+ :'relative_path' => :'String'
64
+ }
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::Release` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::Release`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'_href')
83
+ self._href = attributes[:'_href']
84
+ end
85
+
86
+ if attributes.key?(:'_created')
87
+ self._created = attributes[:'_created']
88
+ end
89
+
90
+ if attributes.key?(:'_type')
91
+ self._type = attributes[:'_type']
92
+ end
93
+
94
+ if attributes.key?(:'artifacts')
95
+ if (value = attributes[:'artifacts']).is_a?(Hash)
96
+ self.artifacts = value
97
+ end
98
+ end
99
+
100
+ if attributes.key?(:'codename')
101
+ self.codename = attributes[:'codename']
102
+ end
103
+
104
+ if attributes.key?(:'suite')
105
+ self.suite = attributes[:'suite']
106
+ end
107
+
108
+ if attributes.key?(:'distribution')
109
+ self.distribution = attributes[:'distribution']
110
+ end
111
+
112
+ if attributes.key?(:'relative_path')
113
+ self.relative_path = attributes[:'relative_path']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ if !@_type.nil? && @_type.to_s.length < 1
122
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
123
+ end
124
+
125
+ if @artifacts.nil?
126
+ invalid_properties.push('invalid value for "artifacts", artifacts cannot be nil.')
127
+ end
128
+
129
+ if @codename.nil?
130
+ invalid_properties.push('invalid value for "codename", codename cannot be nil.')
131
+ end
132
+
133
+ if @codename.to_s.length < 1
134
+ invalid_properties.push('invalid value for "codename", the character length must be great than or equal to 1.')
135
+ end
136
+
137
+ if !@suite.nil? && @suite.to_s.length < 1
138
+ invalid_properties.push('invalid value for "suite", the character length must be great than or equal to 1.')
139
+ end
140
+
141
+ if !@distribution.nil? && @distribution.to_s.length < 1
142
+ invalid_properties.push('invalid value for "distribution", the character length must be great than or equal to 1.')
143
+ end
144
+
145
+ if !@relative_path.nil? && @relative_path.to_s.length < 1
146
+ invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ return false if !@_type.nil? && @_type.to_s.length < 1
156
+ return false if @artifacts.nil?
157
+ return false if @codename.nil?
158
+ return false if @codename.to_s.length < 1
159
+ return false if !@suite.nil? && @suite.to_s.length < 1
160
+ return false if !@distribution.nil? && @distribution.to_s.length < 1
161
+ return false if !@relative_path.nil? && @relative_path.to_s.length < 1
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] _type Value to be assigned
167
+ def _type=(_type)
168
+ if !_type.nil? && _type.to_s.length < 1
169
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
170
+ end
171
+
172
+ @_type = _type
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] codename Value to be assigned
177
+ def codename=(codename)
178
+ if codename.nil?
179
+ fail ArgumentError, 'codename cannot be nil'
180
+ end
181
+
182
+ if codename.to_s.length < 1
183
+ fail ArgumentError, 'invalid value for "codename", the character length must be great than or equal to 1.'
184
+ end
185
+
186
+ @codename = codename
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] suite Value to be assigned
191
+ def suite=(suite)
192
+ if !suite.nil? && suite.to_s.length < 1
193
+ fail ArgumentError, 'invalid value for "suite", the character length must be great than or equal to 1.'
194
+ end
195
+
196
+ @suite = suite
197
+ end
198
+
199
+ # Custom attribute writer method with validation
200
+ # @param [Object] distribution Value to be assigned
201
+ def distribution=(distribution)
202
+ if !distribution.nil? && distribution.to_s.length < 1
203
+ fail ArgumentError, 'invalid value for "distribution", the character length must be great than or equal to 1.'
204
+ end
205
+
206
+ @distribution = distribution
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] relative_path Value to be assigned
211
+ def relative_path=(relative_path)
212
+ if !relative_path.nil? && relative_path.to_s.length < 1
213
+ fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
214
+ end
215
+
216
+ @relative_path = relative_path
217
+ end
218
+
219
+ # Checks equality by comparing each attribute.
220
+ # @param [Object] Object to be compared
221
+ def ==(o)
222
+ return true if self.equal?(o)
223
+ self.class == o.class &&
224
+ _href == o._href &&
225
+ _created == o._created &&
226
+ _type == o._type &&
227
+ artifacts == o.artifacts &&
228
+ codename == o.codename &&
229
+ suite == o.suite &&
230
+ distribution == o.distribution &&
231
+ relative_path == o.relative_path
232
+ end
233
+
234
+ # @see the `==` method
235
+ # @param [Object] Object to be compared
236
+ def eql?(o)
237
+ self == o
238
+ end
239
+
240
+ # Calculates hash code according to all attributes.
241
+ # @return [Integer] Hash code
242
+ def hash
243
+ [_href, _created, _type, artifacts, codename, suite, distribution, relative_path].hash
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def self.build_from_hash(attributes)
250
+ new.build_from_hash(attributes)
251
+ end
252
+
253
+ # Builds the object from hash
254
+ # @param [Hash] attributes Model attributes in the form of hash
255
+ # @return [Object] Returns the model itself
256
+ def build_from_hash(attributes)
257
+ return nil unless attributes.is_a?(Hash)
258
+ self.class.openapi_types.each_pair do |key, type|
259
+ if type =~ /\AArray<(.*)>/i
260
+ # check to ensure the input is an array given that the attribute
261
+ # is documented as an array but the input is not
262
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
263
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
264
+ end
265
+ elsif !attributes[self.class.attribute_map[key]].nil?
266
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
267
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
268
+ end
269
+
270
+ self
271
+ end
272
+
273
+ # Deserializes the data based on type
274
+ # @param string type Data type
275
+ # @param string value Value to be deserialized
276
+ # @return [Object] Deserialized data
277
+ def _deserialize(type, value)
278
+ case type.to_sym
279
+ when :DateTime
280
+ DateTime.parse(value)
281
+ when :Date
282
+ Date.parse(value)
283
+ when :String
284
+ value.to_s
285
+ when :Integer
286
+ value.to_i
287
+ when :Float
288
+ value.to_f
289
+ when :Boolean
290
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
291
+ true
292
+ else
293
+ false
294
+ end
295
+ when :Object
296
+ # generic object (usually a Hash), return directly
297
+ value
298
+ when /\AArray<(?<inner_type>.+)>\z/
299
+ inner_type = Regexp.last_match[:inner_type]
300
+ value.map { |v| _deserialize(inner_type, v) }
301
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
302
+ k_type = Regexp.last_match[:k_type]
303
+ v_type = Regexp.last_match[:v_type]
304
+ {}.tap do |hash|
305
+ value.each do |k, v|
306
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
307
+ end
308
+ end
309
+ else # model
310
+ PulpDebClient.const_get(type).build_from_hash(value)
311
+ end
312
+ end
313
+
314
+ # Returns the string representation of the object
315
+ # @return [String] String presentation of the object
316
+ def to_s
317
+ to_hash.to_s
318
+ end
319
+
320
+ # to_body is an alias to to_hash (backward compatibility)
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_body
323
+ to_hash
324
+ end
325
+
326
+ # Returns the object in the form of hash
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_hash
329
+ hash = {}
330
+ self.class.attribute_map.each_pair do |attr, param|
331
+ value = self.send(attr)
332
+ next if value.nil?
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+ end
356
+ end