pulp_deb_client 2.21.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -7
  3. data/docs/ContentGenericContentsApi.md +7 -5
  4. data/docs/ContentInstallerFileIndicesApi.md +3 -1
  5. data/docs/ContentInstallerPackagesApi.md +7 -5
  6. data/docs/ContentPackageIndicesApi.md +3 -1
  7. data/docs/ContentPackageReleaseComponentsApi.md +3 -1
  8. data/docs/ContentPackagesApi.md +27 -5
  9. data/docs/ContentReleaseArchitecturesApi.md +5 -7
  10. data/docs/ContentReleaseComponentsApi.md +7 -7
  11. data/docs/ContentReleaseFilesApi.md +3 -1
  12. data/docs/ContentReleasesApi.md +13 -3
  13. data/docs/ContentSourceIndicesApi.md +204 -0
  14. data/docs/ContentSourcePackagesApi.md +258 -0
  15. data/docs/ContentSourceReleaseComponentsApi.md +202 -0
  16. data/docs/DebAptPublication.md +4 -2
  17. data/docs/DebAptPublicationResponse.md +4 -2
  18. data/docs/DebAptRepository.md +7 -1
  19. data/docs/DebAptRepositoryResponse.md +7 -1
  20. data/docs/DebCopyApi.md +1 -1
  21. data/docs/DebGenericContent.md +2 -2
  22. data/docs/DebInstallerPackage.md +2 -2
  23. data/docs/DebPackage.md +2 -2
  24. data/docs/DebRelease.md +9 -1
  25. data/docs/DebReleaseArchitecture.md +1 -5
  26. data/docs/DebReleaseArchitectureResponse.md +1 -5
  27. data/docs/DebReleaseComponent.md +1 -5
  28. data/docs/DebReleaseComponentResponse.md +1 -5
  29. data/docs/DebReleaseFile.md +3 -3
  30. data/docs/DebReleaseFileResponse.md +3 -3
  31. data/docs/DebReleaseResponse.md +9 -1
  32. data/docs/DebSourceIndex.md +25 -0
  33. data/docs/DebSourceIndexResponse.md +27 -0
  34. data/docs/DebSourcePackage.md +21 -0
  35. data/docs/DebSourcePackageReleaseComponent.md +21 -0
  36. data/docs/DebSourcePackageReleaseComponentResponse.md +23 -0
  37. data/docs/DebSourcePackageResponse.md +77 -0
  38. data/docs/DistributionsAptApi.md +123 -1
  39. data/docs/PaginateddebSourceIndexResponseList.md +23 -0
  40. data/docs/PaginateddebSourcePackageReleaseComponentResponseList.md +23 -0
  41. data/docs/PaginateddebSourcePackageResponseList.md +23 -0
  42. data/docs/PatcheddebAptRepository.md +7 -1
  43. data/docs/PublicationsAptApi.md +3 -1
  44. data/docs/PublicationsVerbatimApi.md +3 -1
  45. data/docs/RemotesAptApi.md +123 -1
  46. data/docs/RepositoriesAptApi.md +123 -1
  47. data/docs/RepositoriesAptVersionsApi.md +3 -1
  48. data/docs/SetLabel.md +19 -0
  49. data/docs/SetLabelResponse.md +19 -0
  50. data/docs/UnsetLabel.md +17 -0
  51. data/docs/UnsetLabelResponse.md +19 -0
  52. data/lib/pulp_deb_client/api/content_generic_contents_api.rb +7 -4
  53. data/lib/pulp_deb_client/api/content_installer_file_indices_api.rb +3 -0
  54. data/lib/pulp_deb_client/api/content_installer_packages_api.rb +7 -4
  55. data/lib/pulp_deb_client/api/content_package_indices_api.rb +3 -0
  56. data/lib/pulp_deb_client/api/content_package_release_components_api.rb +3 -0
  57. data/lib/pulp_deb_client/api/content_packages_api.rb +37 -4
  58. data/lib/pulp_deb_client/api/content_release_architectures_api.rb +6 -9
  59. data/lib/pulp_deb_client/api/content_release_components_api.rb +9 -9
  60. data/lib/pulp_deb_client/api/content_release_files_api.rb +3 -0
  61. data/lib/pulp_deb_client/api/content_releases_api.rb +18 -3
  62. data/lib/pulp_deb_client/api/content_source_indices_api.rb +256 -0
  63. data/lib/pulp_deb_client/api/content_source_packages_api.rb +337 -0
  64. data/lib/pulp_deb_client/api/content_source_release_components_api.rb +253 -0
  65. data/lib/pulp_deb_client/api/distributions_apt_api.rb +155 -0
  66. data/lib/pulp_deb_client/api/publications_apt_api.rb +3 -0
  67. data/lib/pulp_deb_client/api/publications_verbatim_api.rb +3 -0
  68. data/lib/pulp_deb_client/api/remotes_apt_api.rb +155 -0
  69. data/lib/pulp_deb_client/api/repositories_apt_api.rb +155 -0
  70. data/lib/pulp_deb_client/api/repositories_apt_versions_api.rb +3 -0
  71. data/lib/pulp_deb_client/configuration.rb +2 -2
  72. data/lib/pulp_deb_client/models/deb_apt_publication.rb +14 -5
  73. data/lib/pulp_deb_client/models/deb_apt_publication_response.rb +14 -5
  74. data/lib/pulp_deb_client/models/deb_apt_repository.rb +38 -5
  75. data/lib/pulp_deb_client/models/deb_apt_repository_response.rb +38 -5
  76. data/lib/pulp_deb_client/models/deb_generic_content.rb +2 -2
  77. data/lib/pulp_deb_client/models/deb_installer_package.rb +2 -2
  78. data/lib/pulp_deb_client/models/deb_package.rb +2 -2
  79. data/lib/pulp_deb_client/models/deb_release.rb +104 -4
  80. data/lib/pulp_deb_client/models/deb_release_architecture.rb +4 -70
  81. data/lib/pulp_deb_client/models/deb_release_architecture_response.rb +4 -32
  82. data/lib/pulp_deb_client/models/deb_release_component.rb +4 -70
  83. data/lib/pulp_deb_client/models/deb_release_component_response.rb +4 -32
  84. data/lib/pulp_deb_client/models/deb_release_file.rb +3 -3
  85. data/lib/pulp_deb_client/models/deb_release_file_response.rb +3 -3
  86. data/lib/pulp_deb_client/models/deb_release_response.rb +44 -4
  87. data/lib/pulp_deb_client/models/deb_source_index.rb +297 -0
  88. data/lib/pulp_deb_client/models/deb_source_index_response.rb +272 -0
  89. data/lib/pulp_deb_client/models/deb_source_package.rb +248 -0
  90. data/lib/pulp_deb_client/models/deb_source_package_release_component.rb +238 -0
  91. data/lib/pulp_deb_client/models/deb_source_package_release_component_response.rb +247 -0
  92. data/lib/pulp_deb_client/models/deb_source_package_response.rb +485 -0
  93. data/lib/pulp_deb_client/models/paginateddeb_source_index_response_list.rb +237 -0
  94. data/lib/pulp_deb_client/models/paginateddeb_source_package_release_component_response_list.rb +237 -0
  95. data/lib/pulp_deb_client/models/paginateddeb_source_package_response_list.rb +237 -0
  96. data/lib/pulp_deb_client/models/patcheddeb_apt_repository.rb +38 -5
  97. data/lib/pulp_deb_client/models/set_label.rb +252 -0
  98. data/lib/pulp_deb_client/models/set_label_response.rb +243 -0
  99. data/lib/pulp_deb_client/models/unset_label.rb +242 -0
  100. data/lib/pulp_deb_client/models/unset_label_response.rb +242 -0
  101. data/lib/pulp_deb_client/version.rb +1 -1
  102. data/lib/pulp_deb_client.rb +16 -0
  103. data/spec/api/content_generic_contents_api_spec.rb +3 -2
  104. data/spec/api/content_installer_file_indices_api_spec.rb +1 -0
  105. data/spec/api/content_installer_packages_api_spec.rb +3 -2
  106. data/spec/api/content_package_indices_api_spec.rb +1 -0
  107. data/spec/api/content_package_release_components_api_spec.rb +1 -0
  108. data/spec/api/content_packages_api_spec.rb +13 -2
  109. data/spec/api/content_release_architectures_api_spec.rb +2 -3
  110. data/spec/api/content_release_components_api_spec.rb +3 -3
  111. data/spec/api/content_release_files_api_spec.rb +1 -0
  112. data/spec/api/content_releases_api_spec.rb +6 -1
  113. data/spec/api/content_source_indices_api_spec.rb +86 -0
  114. data/spec/api/content_source_packages_api_spec.rb +113 -0
  115. data/spec/api/content_source_release_components_api_spec.rb +85 -0
  116. data/spec/api/distributions_apt_api_spec.rb +31 -0
  117. data/spec/api/publications_apt_api_spec.rb +1 -0
  118. data/spec/api/publications_verbatim_api_spec.rb +1 -0
  119. data/spec/api/remotes_apt_api_spec.rb +31 -0
  120. data/spec/api/repositories_apt_api_spec.rb +31 -0
  121. data/spec/api/repositories_apt_versions_api_spec.rb +1 -0
  122. data/spec/configuration_spec.rb +3 -3
  123. data/spec/models/deb_apt_publication_response_spec.rb +6 -0
  124. data/spec/models/deb_apt_publication_spec.rb +6 -0
  125. data/spec/models/deb_apt_repository_response_spec.rb +18 -0
  126. data/spec/models/deb_apt_repository_spec.rb +18 -0
  127. data/spec/models/deb_release_architecture_response_spec.rb +0 -12
  128. data/spec/models/deb_release_architecture_spec.rb +0 -12
  129. data/spec/models/deb_release_component_response_spec.rb +0 -12
  130. data/spec/models/deb_release_component_spec.rb +0 -12
  131. data/spec/models/deb_release_response_spec.rb +24 -0
  132. data/spec/models/deb_release_spec.rb +24 -0
  133. data/spec/models/deb_source_index_response_spec.rb +71 -0
  134. data/spec/models/deb_source_index_spec.rb +65 -0
  135. data/spec/models/deb_source_package_release_component_response_spec.rb +59 -0
  136. data/spec/models/deb_source_package_release_component_spec.rb +53 -0
  137. data/spec/models/deb_source_package_response_spec.rb +221 -0
  138. data/spec/models/deb_source_package_spec.rb +53 -0
  139. data/spec/models/paginateddeb_source_index_response_list_spec.rb +59 -0
  140. data/spec/models/paginateddeb_source_package_release_component_response_list_spec.rb +59 -0
  141. data/spec/models/paginateddeb_source_package_response_list_spec.rb +59 -0
  142. data/spec/models/patcheddeb_apt_repository_spec.rb +18 -0
  143. data/spec/models/set_label_response_spec.rb +47 -0
  144. data/spec/models/set_label_spec.rb +47 -0
  145. data/spec/models/unset_label_response_spec.rb +47 -0
  146. data/spec/models/unset_label_spec.rb +41 -0
  147. metadata +122 -58
@@ -0,0 +1,248 @@
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 DscFile.
17
+ class DebSourcePackage
18
+ # A URI of a repository the new content unit should be associated with.
19
+ attr_accessor :repository
20
+
21
+ # Artifact URL of the Debian Source Control (dsc) file.
22
+ attr_accessor :artifact
23
+
24
+ # Relative path of the Debian Source Control (dsc) file.It is normally advised to let Pulp generate this.
25
+ attr_accessor :relative_path
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'repository' => :'repository',
31
+ :'artifact' => :'artifact',
32
+ :'relative_path' => :'relative_path'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'repository' => :'String',
40
+ :'artifact' => :'String',
41
+ :'relative_path' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::DebSourcePackage` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::DebSourcePackage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'repository')
67
+ self.repository = attributes[:'repository']
68
+ end
69
+
70
+ if attributes.key?(:'artifact')
71
+ self.artifact = attributes[:'artifact']
72
+ end
73
+
74
+ if attributes.key?(:'relative_path')
75
+ self.relative_path = attributes[:'relative_path']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @artifact.nil?
84
+ invalid_properties.push('invalid value for "artifact", artifact cannot be nil.')
85
+ end
86
+
87
+ if !@relative_path.nil? && @relative_path.to_s.length < 1
88
+ invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @artifact.nil?
98
+ return false if !@relative_path.nil? && @relative_path.to_s.length < 1
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] relative_path Value to be assigned
104
+ def relative_path=(relative_path)
105
+ if !relative_path.nil? && relative_path.to_s.length < 1
106
+ fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
107
+ end
108
+
109
+ @relative_path = relative_path
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ repository == o.repository &&
118
+ artifact == o.artifact &&
119
+ relative_path == o.relative_path
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [repository, artifact, relative_path].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ PulpDebClient.const_get(type).build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+ end
248
+ end
@@ -0,0 +1,238 @@
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 SourcePackageReleaseComponent.
17
+ class DebSourcePackageReleaseComponent
18
+ # A URI of a repository the new content unit should be associated with.
19
+ attr_accessor :repository
20
+
21
+ # Source package that is contained in release_component.
22
+ attr_accessor :source_package
23
+
24
+ # ReleaseComponent this source package is contained in.
25
+ attr_accessor :release_component
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'repository' => :'repository',
31
+ :'source_package' => :'source_package',
32
+ :'release_component' => :'release_component'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'repository' => :'String',
40
+ :'source_package' => :'String',
41
+ :'release_component' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::DebSourcePackageReleaseComponent` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::DebSourcePackageReleaseComponent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'repository')
67
+ self.repository = attributes[:'repository']
68
+ end
69
+
70
+ if attributes.key?(:'source_package')
71
+ self.source_package = attributes[:'source_package']
72
+ end
73
+
74
+ if attributes.key?(:'release_component')
75
+ self.release_component = attributes[:'release_component']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @source_package.nil?
84
+ invalid_properties.push('invalid value for "source_package", source_package cannot be nil.')
85
+ end
86
+
87
+ if @release_component.nil?
88
+ invalid_properties.push('invalid value for "release_component", release_component cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @source_package.nil?
98
+ return false if @release_component.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ repository == o.repository &&
108
+ source_package == o.source_package &&
109
+ release_component == o.release_component
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [repository, source_package, release_component].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ new.build_from_hash(attributes)
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.openapi_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ PulpDebClient.const_get(type).build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+ end
238
+ end