pulp_deb_client 3.0.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -6
- data/docs/ContentGenericContentsApi.md +4 -4
- data/docs/ContentInstallerPackagesApi.md +4 -4
- data/docs/ContentPackagesApi.md +20 -4
- data/docs/ContentSourceIndicesApi.md +204 -0
- data/docs/ContentSourcePackagesApi.md +258 -0
- data/docs/ContentSourceReleaseComponentsApi.md +202 -0
- data/docs/DebGenericContent.md +2 -2
- data/docs/DebInstallerPackage.md +2 -2
- data/docs/DebPackage.md +2 -2
- data/docs/DebSourceIndex.md +25 -0
- data/docs/DebSourceIndexResponse.md +27 -0
- data/docs/DebSourcePackage.md +21 -0
- data/docs/DebSourcePackageReleaseComponent.md +21 -0
- data/docs/DebSourcePackageReleaseComponentResponse.md +23 -0
- data/docs/DebSourcePackageResponse.md +77 -0
- data/docs/PaginateddebSourceIndexResponseList.md +23 -0
- data/docs/PaginateddebSourcePackageReleaseComponentResponseList.md +23 -0
- data/docs/PaginateddebSourcePackageResponseList.md +23 -0
- data/lib/pulp_deb_client/api/content_generic_contents_api.rb +4 -4
- data/lib/pulp_deb_client/api/content_installer_packages_api.rb +4 -4
- data/lib/pulp_deb_client/api/content_packages_api.rb +28 -4
- data/lib/pulp_deb_client/api/content_source_indices_api.rb +256 -0
- data/lib/pulp_deb_client/api/content_source_packages_api.rb +337 -0
- data/lib/pulp_deb_client/api/content_source_release_components_api.rb +253 -0
- data/lib/pulp_deb_client/models/deb_generic_content.rb +2 -2
- data/lib/pulp_deb_client/models/deb_installer_package.rb +2 -2
- data/lib/pulp_deb_client/models/deb_package.rb +2 -2
- data/lib/pulp_deb_client/models/deb_source_index.rb +297 -0
- data/lib/pulp_deb_client/models/deb_source_index_response.rb +272 -0
- data/lib/pulp_deb_client/models/deb_source_package.rb +248 -0
- data/lib/pulp_deb_client/models/deb_source_package_release_component.rb +238 -0
- data/lib/pulp_deb_client/models/deb_source_package_release_component_response.rb +247 -0
- data/lib/pulp_deb_client/models/deb_source_package_response.rb +485 -0
- data/lib/pulp_deb_client/models/paginateddeb_source_index_response_list.rb +237 -0
- data/lib/pulp_deb_client/models/paginateddeb_source_package_release_component_response_list.rb +237 -0
- data/lib/pulp_deb_client/models/paginateddeb_source_package_response_list.rb +237 -0
- data/lib/pulp_deb_client/version.rb +1 -1
- data/lib/pulp_deb_client.rb +12 -0
- data/spec/api/content_generic_contents_api_spec.rb +2 -2
- data/spec/api/content_installer_packages_api_spec.rb +2 -2
- data/spec/api/content_packages_api_spec.rb +10 -2
- data/spec/api/content_source_indices_api_spec.rb +86 -0
- data/spec/api/content_source_packages_api_spec.rb +113 -0
- data/spec/api/content_source_release_components_api_spec.rb +85 -0
- data/spec/models/deb_source_index_response_spec.rb +71 -0
- data/spec/models/deb_source_index_spec.rb +65 -0
- data/spec/models/deb_source_package_release_component_response_spec.rb +59 -0
- data/spec/models/deb_source_package_release_component_spec.rb +53 -0
- data/spec/models/deb_source_package_response_spec.rb +221 -0
- data/spec/models/deb_source_package_spec.rb +53 -0
- data/spec/models/paginateddeb_source_index_response_list_spec.rb +59 -0
- data/spec/models/paginateddeb_source_package_release_component_response_list_spec.rb +59 -0
- data/spec/models/paginateddeb_source_package_response_list_spec.rb +59 -0
- metadata +110 -62
@@ -24,10 +24,10 @@ module PulpDebClient
|
|
24
24
|
# Path where the artifact is located relative to distributions base_path
|
25
25
|
attr_accessor :relative_path
|
26
26
|
|
27
|
-
# An uploaded file that may be turned into the
|
27
|
+
# An uploaded file that may be turned into the content unit.
|
28
28
|
attr_accessor :file
|
29
29
|
|
30
|
-
# An uncommitted upload that may be turned into the
|
30
|
+
# An uncommitted upload that may be turned into the content unit.
|
31
31
|
attr_accessor :upload
|
32
32
|
|
33
33
|
# Name of the distribution.
|
@@ -0,0 +1,297 @@
|
|
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.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpDebClient
|
16
|
+
# A serializer for SourceIndex.
|
17
|
+
class DebSourceIndex
|
18
|
+
# A URI of a repository the new content unit should be associated with.
|
19
|
+
attr_accessor :repository
|
20
|
+
|
21
|
+
# A dict mapping relative paths inside the Content to the correspondingArtifact URLs. E.g.: {'relative/path': '/artifacts/1/'
|
22
|
+
attr_accessor :artifacts
|
23
|
+
|
24
|
+
# Release this index file belongs to.
|
25
|
+
attr_accessor :release
|
26
|
+
|
27
|
+
# Component this index file belongs to.
|
28
|
+
attr_accessor :component
|
29
|
+
|
30
|
+
# Path of file relative to url.
|
31
|
+
attr_accessor :relative_path
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:'repository' => :'repository',
|
37
|
+
:'artifacts' => :'artifacts',
|
38
|
+
:'release' => :'release',
|
39
|
+
:'component' => :'component',
|
40
|
+
:'relative_path' => :'relative_path'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.openapi_types
|
46
|
+
{
|
47
|
+
:'repository' => :'String',
|
48
|
+
:'artifacts' => :'Object',
|
49
|
+
:'release' => :'String',
|
50
|
+
:'component' => :'String',
|
51
|
+
:'relative_path' => :'String'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# List of attributes with nullable: true
|
56
|
+
def self.openapi_nullable
|
57
|
+
Set.new([
|
58
|
+
])
|
59
|
+
end
|
60
|
+
|
61
|
+
# Initializes the object
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
+
def initialize(attributes = {})
|
64
|
+
if (!attributes.is_a?(Hash))
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::DebSourceIndex` initialize method"
|
66
|
+
end
|
67
|
+
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
70
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
71
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::DebSourceIndex`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
|
+
end
|
73
|
+
h[k.to_sym] = v
|
74
|
+
}
|
75
|
+
|
76
|
+
if attributes.key?(:'repository')
|
77
|
+
self.repository = attributes[:'repository']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'artifacts')
|
81
|
+
self.artifacts = attributes[:'artifacts']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'release')
|
85
|
+
self.release = attributes[:'release']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'component')
|
89
|
+
self.component = attributes[:'component']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'relative_path')
|
93
|
+
self.relative_path = attributes[:'relative_path']
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
98
|
+
# @return Array for valid properties with the reasons
|
99
|
+
def list_invalid_properties
|
100
|
+
invalid_properties = Array.new
|
101
|
+
if @artifacts.nil?
|
102
|
+
invalid_properties.push('invalid value for "artifacts", artifacts cannot be nil.')
|
103
|
+
end
|
104
|
+
|
105
|
+
if @release.nil?
|
106
|
+
invalid_properties.push('invalid value for "release", release cannot be nil.')
|
107
|
+
end
|
108
|
+
|
109
|
+
if @component.nil?
|
110
|
+
invalid_properties.push('invalid value for "component", component cannot be nil.')
|
111
|
+
end
|
112
|
+
|
113
|
+
if @component.to_s.length < 1
|
114
|
+
invalid_properties.push('invalid value for "component", the character length must be great than or equal to 1.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if !@relative_path.nil? && @relative_path.to_s.length < 1
|
118
|
+
invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
|
119
|
+
end
|
120
|
+
|
121
|
+
invalid_properties
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check to see if the all the properties in the model are valid
|
125
|
+
# @return true if the model is valid
|
126
|
+
def valid?
|
127
|
+
return false if @artifacts.nil?
|
128
|
+
return false if @release.nil?
|
129
|
+
return false if @component.nil?
|
130
|
+
return false if @component.to_s.length < 1
|
131
|
+
return false if !@relative_path.nil? && @relative_path.to_s.length < 1
|
132
|
+
true
|
133
|
+
end
|
134
|
+
|
135
|
+
# Custom attribute writer method with validation
|
136
|
+
# @param [Object] component Value to be assigned
|
137
|
+
def component=(component)
|
138
|
+
if component.nil?
|
139
|
+
fail ArgumentError, 'component cannot be nil'
|
140
|
+
end
|
141
|
+
|
142
|
+
if component.to_s.length < 1
|
143
|
+
fail ArgumentError, 'invalid value for "component", the character length must be great than or equal to 1.'
|
144
|
+
end
|
145
|
+
|
146
|
+
@component = component
|
147
|
+
end
|
148
|
+
|
149
|
+
# Custom attribute writer method with validation
|
150
|
+
# @param [Object] relative_path Value to be assigned
|
151
|
+
def relative_path=(relative_path)
|
152
|
+
if !relative_path.nil? && relative_path.to_s.length < 1
|
153
|
+
fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
|
154
|
+
end
|
155
|
+
|
156
|
+
@relative_path = relative_path
|
157
|
+
end
|
158
|
+
|
159
|
+
# Checks equality by comparing each attribute.
|
160
|
+
# @param [Object] Object to be compared
|
161
|
+
def ==(o)
|
162
|
+
return true if self.equal?(o)
|
163
|
+
self.class == o.class &&
|
164
|
+
repository == o.repository &&
|
165
|
+
artifacts == o.artifacts &&
|
166
|
+
release == o.release &&
|
167
|
+
component == o.component &&
|
168
|
+
relative_path == o.relative_path
|
169
|
+
end
|
170
|
+
|
171
|
+
# @see the `==` method
|
172
|
+
# @param [Object] Object to be compared
|
173
|
+
def eql?(o)
|
174
|
+
self == o
|
175
|
+
end
|
176
|
+
|
177
|
+
# Calculates hash code according to all attributes.
|
178
|
+
# @return [Integer] Hash code
|
179
|
+
def hash
|
180
|
+
[repository, artifacts, release, component, relative_path].hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Builds the object from hash
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
185
|
+
# @return [Object] Returns the model itself
|
186
|
+
def self.build_from_hash(attributes)
|
187
|
+
new.build_from_hash(attributes)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Builds the object from hash
|
191
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
192
|
+
# @return [Object] Returns the model itself
|
193
|
+
def build_from_hash(attributes)
|
194
|
+
return nil unless attributes.is_a?(Hash)
|
195
|
+
self.class.openapi_types.each_pair do |key, type|
|
196
|
+
if type =~ /\AArray<(.*)>/i
|
197
|
+
# check to ensure the input is an array given that the attribute
|
198
|
+
# is documented as an array but the input is not
|
199
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
200
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
201
|
+
end
|
202
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
203
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
204
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
205
|
+
end
|
206
|
+
|
207
|
+
self
|
208
|
+
end
|
209
|
+
|
210
|
+
# Deserializes the data based on type
|
211
|
+
# @param string type Data type
|
212
|
+
# @param string value Value to be deserialized
|
213
|
+
# @return [Object] Deserialized data
|
214
|
+
def _deserialize(type, value)
|
215
|
+
case type.to_sym
|
216
|
+
when :DateTime
|
217
|
+
DateTime.parse(value)
|
218
|
+
when :Date
|
219
|
+
Date.parse(value)
|
220
|
+
when :String
|
221
|
+
value.to_s
|
222
|
+
when :Integer
|
223
|
+
value.to_i
|
224
|
+
when :Float
|
225
|
+
value.to_f
|
226
|
+
when :Boolean
|
227
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
228
|
+
true
|
229
|
+
else
|
230
|
+
false
|
231
|
+
end
|
232
|
+
when :Object
|
233
|
+
# generic object (usually a Hash), return directly
|
234
|
+
value
|
235
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
236
|
+
inner_type = Regexp.last_match[:inner_type]
|
237
|
+
value.map { |v| _deserialize(inner_type, v) }
|
238
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
239
|
+
k_type = Regexp.last_match[:k_type]
|
240
|
+
v_type = Regexp.last_match[:v_type]
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each do |k, v|
|
243
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
else # model
|
247
|
+
PulpDebClient.const_get(type).build_from_hash(value)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
# Returns the string representation of the object
|
252
|
+
# @return [String] String presentation of the object
|
253
|
+
def to_s
|
254
|
+
to_hash.to_s
|
255
|
+
end
|
256
|
+
|
257
|
+
# to_body is an alias to to_hash (backward compatibility)
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
259
|
+
def to_body
|
260
|
+
to_hash
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns the object in the form of hash
|
264
|
+
# @return [Hash] Returns the object in the form of hash
|
265
|
+
def to_hash
|
266
|
+
hash = {}
|
267
|
+
self.class.attribute_map.each_pair do |attr, param|
|
268
|
+
value = self.send(attr)
|
269
|
+
if value.nil?
|
270
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
271
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
272
|
+
end
|
273
|
+
|
274
|
+
hash[param] = _to_hash(value)
|
275
|
+
end
|
276
|
+
hash
|
277
|
+
end
|
278
|
+
|
279
|
+
# Outputs non-array value in the form of hash
|
280
|
+
# For object, use to_hash. Otherwise, just return the value
|
281
|
+
# @param [Object] value Any valid value
|
282
|
+
# @return [Hash] Returns the value in the form of hash
|
283
|
+
def _to_hash(value)
|
284
|
+
if value.is_a?(Array)
|
285
|
+
value.compact.map { |v| _to_hash(v) }
|
286
|
+
elsif value.is_a?(Hash)
|
287
|
+
{}.tap do |hash|
|
288
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
289
|
+
end
|
290
|
+
elsif value.respond_to? :to_hash
|
291
|
+
value.to_hash
|
292
|
+
else
|
293
|
+
value
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
@@ -0,0 +1,272 @@
|
|
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.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpDebClient
|
16
|
+
# A serializer for SourceIndex.
|
17
|
+
class DebSourceIndexResponse
|
18
|
+
attr_accessor :pulp_href
|
19
|
+
|
20
|
+
# Timestamp of creation.
|
21
|
+
attr_accessor :pulp_created
|
22
|
+
|
23
|
+
# A dict mapping relative paths inside the Content to the correspondingArtifact URLs. E.g.: {'relative/path': '/artifacts/1/'
|
24
|
+
attr_accessor :artifacts
|
25
|
+
|
26
|
+
# Release this index file belongs to.
|
27
|
+
attr_accessor :release
|
28
|
+
|
29
|
+
# Component this index file belongs to.
|
30
|
+
attr_accessor :component
|
31
|
+
|
32
|
+
# Path of file relative to url.
|
33
|
+
attr_accessor :relative_path
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'pulp_href' => :'pulp_href',
|
39
|
+
:'pulp_created' => :'pulp_created',
|
40
|
+
:'artifacts' => :'artifacts',
|
41
|
+
:'release' => :'release',
|
42
|
+
:'component' => :'component',
|
43
|
+
:'relative_path' => :'relative_path'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.openapi_types
|
49
|
+
{
|
50
|
+
:'pulp_href' => :'String',
|
51
|
+
:'pulp_created' => :'DateTime',
|
52
|
+
:'artifacts' => :'Object',
|
53
|
+
:'release' => :'String',
|
54
|
+
:'component' => :'String',
|
55
|
+
:'relative_path' => :'String'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# List of attributes with nullable: true
|
60
|
+
def self.openapi_nullable
|
61
|
+
Set.new([
|
62
|
+
])
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
67
|
+
def initialize(attributes = {})
|
68
|
+
if (!attributes.is_a?(Hash))
|
69
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::DebSourceIndexResponse` initialize method"
|
70
|
+
end
|
71
|
+
|
72
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
74
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::DebSourceIndexResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
76
|
+
end
|
77
|
+
h[k.to_sym] = v
|
78
|
+
}
|
79
|
+
|
80
|
+
if attributes.key?(:'pulp_href')
|
81
|
+
self.pulp_href = attributes[:'pulp_href']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'pulp_created')
|
85
|
+
self.pulp_created = attributes[:'pulp_created']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'artifacts')
|
89
|
+
self.artifacts = attributes[:'artifacts']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'release')
|
93
|
+
self.release = attributes[:'release']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'component')
|
97
|
+
self.component = attributes[:'component']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'relative_path')
|
101
|
+
self.relative_path = attributes[:'relative_path']
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
106
|
+
# @return Array for valid properties with the reasons
|
107
|
+
def list_invalid_properties
|
108
|
+
invalid_properties = Array.new
|
109
|
+
if @artifacts.nil?
|
110
|
+
invalid_properties.push('invalid value for "artifacts", artifacts cannot be nil.')
|
111
|
+
end
|
112
|
+
|
113
|
+
if @release.nil?
|
114
|
+
invalid_properties.push('invalid value for "release", release cannot be nil.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if @component.nil?
|
118
|
+
invalid_properties.push('invalid value for "component", component cannot be nil.')
|
119
|
+
end
|
120
|
+
|
121
|
+
invalid_properties
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check to see if the all the properties in the model are valid
|
125
|
+
# @return true if the model is valid
|
126
|
+
def valid?
|
127
|
+
return false if @artifacts.nil?
|
128
|
+
return false if @release.nil?
|
129
|
+
return false if @component.nil?
|
130
|
+
true
|
131
|
+
end
|
132
|
+
|
133
|
+
# Checks equality by comparing each attribute.
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def ==(o)
|
136
|
+
return true if self.equal?(o)
|
137
|
+
self.class == o.class &&
|
138
|
+
pulp_href == o.pulp_href &&
|
139
|
+
pulp_created == o.pulp_created &&
|
140
|
+
artifacts == o.artifacts &&
|
141
|
+
release == o.release &&
|
142
|
+
component == o.component &&
|
143
|
+
relative_path == o.relative_path
|
144
|
+
end
|
145
|
+
|
146
|
+
# @see the `==` method
|
147
|
+
# @param [Object] Object to be compared
|
148
|
+
def eql?(o)
|
149
|
+
self == o
|
150
|
+
end
|
151
|
+
|
152
|
+
# Calculates hash code according to all attributes.
|
153
|
+
# @return [Integer] Hash code
|
154
|
+
def hash
|
155
|
+
[pulp_href, pulp_created, artifacts, release, component, relative_path].hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# Builds the object from hash
|
159
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
160
|
+
# @return [Object] Returns the model itself
|
161
|
+
def self.build_from_hash(attributes)
|
162
|
+
new.build_from_hash(attributes)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Builds the object from hash
|
166
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
167
|
+
# @return [Object] Returns the model itself
|
168
|
+
def build_from_hash(attributes)
|
169
|
+
return nil unless attributes.is_a?(Hash)
|
170
|
+
self.class.openapi_types.each_pair do |key, type|
|
171
|
+
if type =~ /\AArray<(.*)>/i
|
172
|
+
# check to ensure the input is an array given that the attribute
|
173
|
+
# is documented as an array but the input is not
|
174
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
176
|
+
end
|
177
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
180
|
+
end
|
181
|
+
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
185
|
+
# Deserializes the data based on type
|
186
|
+
# @param string type Data type
|
187
|
+
# @param string value Value to be deserialized
|
188
|
+
# @return [Object] Deserialized data
|
189
|
+
def _deserialize(type, value)
|
190
|
+
case type.to_sym
|
191
|
+
when :DateTime
|
192
|
+
DateTime.parse(value)
|
193
|
+
when :Date
|
194
|
+
Date.parse(value)
|
195
|
+
when :String
|
196
|
+
value.to_s
|
197
|
+
when :Integer
|
198
|
+
value.to_i
|
199
|
+
when :Float
|
200
|
+
value.to_f
|
201
|
+
when :Boolean
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
+
true
|
204
|
+
else
|
205
|
+
false
|
206
|
+
end
|
207
|
+
when :Object
|
208
|
+
# generic object (usually a Hash), return directly
|
209
|
+
value
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each do |k, v|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
else # model
|
222
|
+
PulpDebClient.const_get(type).build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
if value.nil?
|
245
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
246
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
247
|
+
end
|
248
|
+
|
249
|
+
hash[param] = _to_hash(value)
|
250
|
+
end
|
251
|
+
hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Outputs non-array value in the form of hash
|
255
|
+
# For object, use to_hash. Otherwise, just return the value
|
256
|
+
# @param [Object] value Any valid value
|
257
|
+
# @return [Hash] Returns the value in the form of hash
|
258
|
+
def _to_hash(value)
|
259
|
+
if value.is_a?(Array)
|
260
|
+
value.compact.map { |v| _to_hash(v) }
|
261
|
+
elsif value.is_a?(Hash)
|
262
|
+
{}.tap do |hash|
|
263
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
264
|
+
end
|
265
|
+
elsif value.respond_to? :to_hash
|
266
|
+
value.to_hash
|
267
|
+
else
|
268
|
+
value
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|