pulp_rpm_client 3.22.2 → 3.22.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -29
- data/docs/AcsRpmApi.md +19 -9
- data/docs/ContentAdvisoriesApi.md +6 -4
- data/docs/ContentDistributionTreesApi.md +3 -1
- data/docs/ContentModulemdDefaultsApi.md +3 -1
- data/docs/ContentModulemdObsoletesApi.md +3 -1
- data/docs/ContentModulemdsApi.md +3 -1
- data/docs/ContentPackagecategoriesApi.md +3 -1
- data/docs/ContentPackageenvironmentsApi.md +3 -1
- data/docs/ContentPackagegroupsApi.md +3 -1
- data/docs/ContentPackagelangpacksApi.md +3 -1
- data/docs/ContentPackagesApi.md +5 -3
- data/docs/ContentRepoMetadataFilesApi.md +3 -1
- data/docs/DistributionsRpmApi.md +132 -10
- data/docs/PublicationsRpmApi.md +15 -9
- data/docs/RemotesRpmApi.md +131 -9
- data/docs/RemotesUlnApi.md +131 -9
- data/docs/RepositoriesRpmApi.md +132 -10
- data/docs/RepositoriesRpmVersionsApi.md +3 -1
- data/docs/RpmCompsApi.md +1 -1
- data/docs/RpmCopyApi.md +1 -1
- data/docs/RpmModulemd.md +3 -1
- data/docs/RpmModulemdDefaults.md +3 -1
- data/docs/RpmModulemdObsolete.md +3 -1
- data/docs/RpmPackage.md +3 -3
- data/docs/RpmUpdateRecord.md +3 -3
- data/docs/SetLabel.md +19 -0
- data/docs/SetLabelResponse.md +19 -0
- data/docs/UnsetLabel.md +17 -0
- data/docs/UnsetLabelResponse.md +19 -0
- data/lib/pulp_rpm_client/api/acs_rpm_api.rb +17 -0
- data/lib/pulp_rpm_client/api/content_advisories_api.rb +6 -3
- data/lib/pulp_rpm_client/api/content_distribution_trees_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_modulemd_defaults_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_modulemd_obsoletes_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_modulemds_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_packagecategories_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_packageenvironments_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_packagegroups_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_packagelangpacks_api.rb +3 -0
- data/lib/pulp_rpm_client/api/content_packages_api.rb +6 -3
- data/lib/pulp_rpm_client/api/content_repo_metadata_files_api.rb +3 -0
- data/lib/pulp_rpm_client/api/distributions_rpm_api.rb +157 -0
- data/lib/pulp_rpm_client/api/publications_rpm_api.rb +11 -0
- data/lib/pulp_rpm_client/api/remotes_rpm_api.rb +157 -0
- data/lib/pulp_rpm_client/api/remotes_uln_api.rb +157 -0
- data/lib/pulp_rpm_client/api/repositories_rpm_api.rb +157 -0
- data/lib/pulp_rpm_client/api/repositories_rpm_versions_api.rb +3 -0
- data/lib/pulp_rpm_client/configuration.rb +2 -2
- data/lib/pulp_rpm_client/models/rpm_modulemd.rb +11 -1
- data/lib/pulp_rpm_client/models/rpm_modulemd_defaults.rb +11 -1
- data/lib/pulp_rpm_client/models/rpm_modulemd_obsolete.rb +11 -1
- data/lib/pulp_rpm_client/models/rpm_package.rb +11 -11
- data/lib/pulp_rpm_client/models/rpm_update_record.rb +14 -14
- data/lib/pulp_rpm_client/models/set_label.rb +252 -0
- data/lib/pulp_rpm_client/models/set_label_response.rb +243 -0
- data/lib/pulp_rpm_client/models/unset_label.rb +242 -0
- data/lib/pulp_rpm_client/models/unset_label_response.rb +242 -0
- data/lib/pulp_rpm_client/version.rb +1 -1
- data/lib/pulp_rpm_client.rb +4 -0
- data/spec/api/acs_rpm_api_spec.rb +7 -0
- data/spec/api/content_advisories_api_spec.rb +2 -1
- data/spec/api/content_distribution_trees_api_spec.rb +1 -0
- data/spec/api/content_modulemd_defaults_api_spec.rb +1 -0
- data/spec/api/content_modulemd_obsoletes_api_spec.rb +1 -0
- data/spec/api/content_modulemds_api_spec.rb +1 -0
- data/spec/api/content_packagecategories_api_spec.rb +1 -0
- data/spec/api/content_packageenvironments_api_spec.rb +1 -0
- data/spec/api/content_packagegroups_api_spec.rb +1 -0
- data/spec/api/content_packagelangpacks_api_spec.rb +1 -0
- data/spec/api/content_packages_api_spec.rb +2 -1
- data/spec/api/content_repo_metadata_files_api_spec.rb +1 -0
- data/spec/api/distributions_rpm_api_spec.rb +33 -0
- data/spec/api/publications_rpm_api_spec.rb +5 -0
- data/spec/api/remotes_rpm_api_spec.rb +33 -0
- data/spec/api/remotes_uln_api_spec.rb +33 -0
- data/spec/api/repositories_rpm_api_spec.rb +33 -0
- data/spec/api/repositories_rpm_versions_api_spec.rb +1 -0
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/rpm_modulemd_defaults_spec.rb +6 -0
- data/spec/models/rpm_modulemd_obsolete_spec.rb +6 -0
- data/spec/models/rpm_modulemd_spec.rb +6 -0
- data/spec/models/rpm_package_spec.rb +4 -4
- data/spec/models/rpm_update_record_spec.rb +2 -2
- data/spec/models/set_label_response_spec.rb +47 -0
- data/spec/models/set_label_spec.rb +47 -0
- data/spec/models/unset_label_response_spec.rb +47 -0
- data/spec/models/unset_label_spec.rb +41 -0
- metadata +97 -81
@@ -15,6 +15,9 @@ require 'date'
|
|
15
15
|
module PulpRpmClient
|
16
16
|
# ModulemdDefaults serializer.
|
17
17
|
class RpmModulemdDefaults
|
18
|
+
# A URI of a repository the new content unit should be associated with.
|
19
|
+
attr_accessor :repository
|
20
|
+
|
18
21
|
# Modulemd name.
|
19
22
|
attr_accessor :_module
|
20
23
|
|
@@ -30,6 +33,7 @@ module PulpRpmClient
|
|
30
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
34
|
def self.attribute_map
|
32
35
|
{
|
36
|
+
:'repository' => :'repository',
|
33
37
|
:'_module' => :'module',
|
34
38
|
:'stream' => :'stream',
|
35
39
|
:'profiles' => :'profiles',
|
@@ -40,6 +44,7 @@ module PulpRpmClient
|
|
40
44
|
# Attribute type mapping.
|
41
45
|
def self.openapi_types
|
42
46
|
{
|
47
|
+
:'repository' => :'String',
|
43
48
|
:'_module' => :'String',
|
44
49
|
:'stream' => :'String',
|
45
50
|
:'profiles' => :'Object',
|
@@ -68,6 +73,10 @@ module PulpRpmClient
|
|
68
73
|
h[k.to_sym] = v
|
69
74
|
}
|
70
75
|
|
76
|
+
if attributes.key?(:'repository')
|
77
|
+
self.repository = attributes[:'repository']
|
78
|
+
end
|
79
|
+
|
71
80
|
if attributes.key?(:'_module')
|
72
81
|
self._module = attributes[:'_module']
|
73
82
|
end
|
@@ -180,6 +189,7 @@ module PulpRpmClient
|
|
180
189
|
def ==(o)
|
181
190
|
return true if self.equal?(o)
|
182
191
|
self.class == o.class &&
|
192
|
+
repository == o.repository &&
|
183
193
|
_module == o._module &&
|
184
194
|
stream == o.stream &&
|
185
195
|
profiles == o.profiles &&
|
@@ -195,7 +205,7 @@ module PulpRpmClient
|
|
195
205
|
# Calculates hash code according to all attributes.
|
196
206
|
# @return [Integer] Hash code
|
197
207
|
def hash
|
198
|
-
[_module, stream, profiles, snippet].hash
|
208
|
+
[repository, _module, stream, profiles, snippet].hash
|
199
209
|
end
|
200
210
|
|
201
211
|
# Builds the object from hash
|
@@ -15,6 +15,9 @@ require 'date'
|
|
15
15
|
module PulpRpmClient
|
16
16
|
# ModulemdObsolete serializer.
|
17
17
|
class RpmModulemdObsolete
|
18
|
+
# A URI of a repository the new content unit should be associated with.
|
19
|
+
attr_accessor :repository
|
20
|
+
|
18
21
|
# Obsolete modified time.
|
19
22
|
attr_accessor :modified
|
20
23
|
|
@@ -48,6 +51,7 @@ module PulpRpmClient
|
|
48
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
49
52
|
def self.attribute_map
|
50
53
|
{
|
54
|
+
:'repository' => :'repository',
|
51
55
|
:'modified' => :'modified',
|
52
56
|
:'module_name' => :'module_name',
|
53
57
|
:'module_stream' => :'module_stream',
|
@@ -64,6 +68,7 @@ module PulpRpmClient
|
|
64
68
|
# Attribute type mapping.
|
65
69
|
def self.openapi_types
|
66
70
|
{
|
71
|
+
:'repository' => :'String',
|
67
72
|
:'modified' => :'String',
|
68
73
|
:'module_name' => :'String',
|
69
74
|
:'module_stream' => :'String',
|
@@ -103,6 +108,10 @@ module PulpRpmClient
|
|
103
108
|
h[k.to_sym] = v
|
104
109
|
}
|
105
110
|
|
111
|
+
if attributes.key?(:'repository')
|
112
|
+
self.repository = attributes[:'repository']
|
113
|
+
end
|
114
|
+
|
106
115
|
if attributes.key?(:'modified')
|
107
116
|
self.modified = attributes[:'modified']
|
108
117
|
end
|
@@ -357,6 +366,7 @@ module PulpRpmClient
|
|
357
366
|
def ==(o)
|
358
367
|
return true if self.equal?(o)
|
359
368
|
self.class == o.class &&
|
369
|
+
repository == o.repository &&
|
360
370
|
modified == o.modified &&
|
361
371
|
module_name == o.module_name &&
|
362
372
|
module_stream == o.module_stream &&
|
@@ -378,7 +388,7 @@ module PulpRpmClient
|
|
378
388
|
# Calculates hash code according to all attributes.
|
379
389
|
# @return [Integer] Hash code
|
380
390
|
def hash
|
381
|
-
[modified, module_name, module_stream, message, override_previous, module_context, eol_date, obsoleted_by_module_name, obsoleted_by_module_stream, snippet].hash
|
391
|
+
[repository, modified, module_name, module_stream, message, override_previous, module_context, eol_date, obsoleted_by_module_name, obsoleted_by_module_stream, snippet].hash
|
382
392
|
end
|
383
393
|
|
384
394
|
# Builds the object from hash
|
@@ -15,6 +15,9 @@ require 'date'
|
|
15
15
|
module PulpRpmClient
|
16
16
|
# A Serializer for Package. Add serializers for the new fields defined in Package and add those fields to the Meta class keeping fields from the parent class as well. Provide help_text.
|
17
17
|
class RpmPackage
|
18
|
+
# A URI of a repository the new content unit should be associated with.
|
19
|
+
attr_accessor :repository
|
20
|
+
|
18
21
|
# Artifact file representing the physical content
|
19
22
|
attr_accessor :artifact
|
20
23
|
|
@@ -24,19 +27,16 @@ module PulpRpmClient
|
|
24
27
|
# An uploaded file that may be turned into the artifact of the content unit.
|
25
28
|
attr_accessor :file
|
26
29
|
|
27
|
-
# A URI of a repository the new content unit should be associated with.
|
28
|
-
attr_accessor :repository
|
29
|
-
|
30
30
|
# An uncommitted upload that may be turned into the artifact of the content unit.
|
31
31
|
attr_accessor :upload
|
32
32
|
|
33
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
34
34
|
def self.attribute_map
|
35
35
|
{
|
36
|
+
:'repository' => :'repository',
|
36
37
|
:'artifact' => :'artifact',
|
37
38
|
:'relative_path' => :'relative_path',
|
38
39
|
:'file' => :'file',
|
39
|
-
:'repository' => :'repository',
|
40
40
|
:'upload' => :'upload'
|
41
41
|
}
|
42
42
|
end
|
@@ -44,10 +44,10 @@ module PulpRpmClient
|
|
44
44
|
# Attribute type mapping.
|
45
45
|
def self.openapi_types
|
46
46
|
{
|
47
|
+
:'repository' => :'String',
|
47
48
|
:'artifact' => :'String',
|
48
49
|
:'relative_path' => :'String',
|
49
50
|
:'file' => :'File',
|
50
|
-
:'repository' => :'String',
|
51
51
|
:'upload' => :'String'
|
52
52
|
}
|
53
53
|
end
|
@@ -73,6 +73,10 @@ module PulpRpmClient
|
|
73
73
|
h[k.to_sym] = v
|
74
74
|
}
|
75
75
|
|
76
|
+
if attributes.key?(:'repository')
|
77
|
+
self.repository = attributes[:'repository']
|
78
|
+
end
|
79
|
+
|
76
80
|
if attributes.key?(:'artifact')
|
77
81
|
self.artifact = attributes[:'artifact']
|
78
82
|
end
|
@@ -85,10 +89,6 @@ module PulpRpmClient
|
|
85
89
|
self.file = attributes[:'file']
|
86
90
|
end
|
87
91
|
|
88
|
-
if attributes.key?(:'repository')
|
89
|
-
self.repository = attributes[:'repository']
|
90
|
-
end
|
91
|
-
|
92
92
|
if attributes.key?(:'upload')
|
93
93
|
self.upload = attributes[:'upload']
|
94
94
|
end
|
@@ -127,10 +127,10 @@ module PulpRpmClient
|
|
127
127
|
def ==(o)
|
128
128
|
return true if self.equal?(o)
|
129
129
|
self.class == o.class &&
|
130
|
+
repository == o.repository &&
|
130
131
|
artifact == o.artifact &&
|
131
132
|
relative_path == o.relative_path &&
|
132
133
|
file == o.file &&
|
133
|
-
repository == o.repository &&
|
134
134
|
upload == o.upload
|
135
135
|
end
|
136
136
|
|
@@ -143,7 +143,7 @@ module PulpRpmClient
|
|
143
143
|
# Calculates hash code according to all attributes.
|
144
144
|
# @return [Integer] Hash code
|
145
145
|
def hash
|
146
|
-
[artifact, relative_path, file,
|
146
|
+
[repository, artifact, relative_path, file, upload].hash
|
147
147
|
end
|
148
148
|
|
149
149
|
# Builds the object from hash
|
@@ -15,25 +15,25 @@ require 'date'
|
|
15
15
|
module PulpRpmClient
|
16
16
|
# A Serializer for UpdateRecord.
|
17
17
|
class RpmUpdateRecord
|
18
|
-
# An uploaded file that may be turned into the artifact of the content unit.
|
19
|
-
attr_accessor :file
|
20
|
-
|
21
18
|
# A URI of a repository the new content unit should be associated with.
|
22
19
|
attr_accessor :repository
|
23
20
|
|
21
|
+
# An uploaded file that may be turned into the artifact of the content unit.
|
22
|
+
attr_accessor :file
|
23
|
+
|
24
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
25
25
|
def self.attribute_map
|
26
26
|
{
|
27
|
-
:'
|
28
|
-
:'
|
27
|
+
:'repository' => :'repository',
|
28
|
+
:'file' => :'file'
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
32
|
# Attribute type mapping.
|
33
33
|
def self.openapi_types
|
34
34
|
{
|
35
|
-
:'
|
36
|
-
:'
|
35
|
+
:'repository' => :'String',
|
36
|
+
:'file' => :'File'
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -58,13 +58,13 @@ module PulpRpmClient
|
|
58
58
|
h[k.to_sym] = v
|
59
59
|
}
|
60
60
|
|
61
|
-
if attributes.key?(:'file')
|
62
|
-
self.file = attributes[:'file']
|
63
|
-
end
|
64
|
-
|
65
61
|
if attributes.key?(:'repository')
|
66
62
|
self.repository = attributes[:'repository']
|
67
63
|
end
|
64
|
+
|
65
|
+
if attributes.key?(:'file')
|
66
|
+
self.file = attributes[:'file']
|
67
|
+
end
|
68
68
|
end
|
69
69
|
|
70
70
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -85,8 +85,8 @@ module PulpRpmClient
|
|
85
85
|
def ==(o)
|
86
86
|
return true if self.equal?(o)
|
87
87
|
self.class == o.class &&
|
88
|
-
|
89
|
-
|
88
|
+
repository == o.repository &&
|
89
|
+
file == o.file
|
90
90
|
end
|
91
91
|
|
92
92
|
# @see the `==` method
|
@@ -98,7 +98,7 @@ module PulpRpmClient
|
|
98
98
|
# Calculates hash code according to all attributes.
|
99
99
|
# @return [Integer] Hash code
|
100
100
|
def hash
|
101
|
-
[
|
101
|
+
[repository, file].hash
|
102
102
|
end
|
103
103
|
|
104
104
|
# Builds the object from hash
|
@@ -0,0 +1,252 @@
|
|
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 PulpRpmClient
|
16
|
+
# Serializer for synchronously setting a label.
|
17
|
+
class SetLabel
|
18
|
+
attr_accessor :key
|
19
|
+
|
20
|
+
attr_accessor :value
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'key' => :'key',
|
26
|
+
:'value' => :'value'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'key' => :'String',
|
34
|
+
:'value' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
:'value'
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::SetLabel` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::SetLabel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'key')
|
61
|
+
self.key = attributes[:'key']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'value')
|
65
|
+
self.value = attributes[:'value']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @key.nil?
|
74
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @key.to_s.length < 1
|
78
|
+
invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
|
79
|
+
end
|
80
|
+
|
81
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
82
|
+
if @key !~ pattern
|
83
|
+
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
84
|
+
end
|
85
|
+
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
return false if @key.nil?
|
93
|
+
return false if @key.to_s.length < 1
|
94
|
+
return false if @key !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Custom attribute writer method with validation
|
99
|
+
# @param [Object] key Value to be assigned
|
100
|
+
def key=(key)
|
101
|
+
if key.nil?
|
102
|
+
fail ArgumentError, 'key cannot be nil'
|
103
|
+
end
|
104
|
+
|
105
|
+
if key.to_s.length < 1
|
106
|
+
fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
|
107
|
+
end
|
108
|
+
|
109
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
110
|
+
if key !~ pattern
|
111
|
+
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
112
|
+
end
|
113
|
+
|
114
|
+
@key = key
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
key == o.key &&
|
123
|
+
value == o.value
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[key, value].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
new.build_from_hash(attributes)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
PulpRpmClient.const_get(type).build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = self.send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|