pulpcore_client 3.65.0 → 3.67.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -4
  3. data/docs/AccessPoliciesApi.md +4 -4
  4. data/docs/ArtifactDistributionResponse.md +12 -12
  5. data/docs/ContentApi.md +4 -4
  6. data/docs/ContentOpenpgpPublickeyApi.md +212 -0
  7. data/docs/ContentOpenpgpPublicsubkeyApi.md +150 -0
  8. data/docs/ContentOpenpgpSignatureApi.md +150 -0
  9. data/docs/ContentOpenpgpUserattributeApi.md +150 -0
  10. data/docs/ContentOpenpgpUseridApi.md +166 -0
  11. data/docs/DistributionsApi.md +4 -4
  12. data/docs/DistributionsOpenpgpApi.md +478 -0
  13. data/docs/FilesystemExportResponse.md +1 -1
  14. data/docs/ImportResponse.md +1 -1
  15. data/docs/NestedOpenPGPPublicSubkey.md +19 -0
  16. data/docs/NestedOpenPGPPublicSubkeyResponse.md +21 -0
  17. data/docs/NestedOpenPGPSignature.md +27 -0
  18. data/docs/NestedOpenPGPSignatureResponse.md +29 -0
  19. data/docs/NestedOpenPGPUserAttribute.md +17 -0
  20. data/docs/NestedOpenPGPUserAttributeResponse.md +19 -0
  21. data/docs/NestedOpenPGPUserID.md +17 -0
  22. data/docs/NestedOpenPGPUserIDResponse.md +19 -0
  23. data/docs/OpenPGPDistribution.md +29 -0
  24. data/docs/OpenPGPDistributionResponse.md +41 -0
  25. data/docs/OpenPGPKeyring.md +25 -0
  26. data/docs/OpenPGPKeyringResponse.md +37 -0
  27. data/docs/OpenPGPPublicKey.md +23 -0
  28. data/docs/OpenPGPPublicKeyResponse.md +33 -0
  29. data/docs/OpenPGPPublicSubkeyResponse.md +31 -0
  30. data/docs/OpenPGPSignatureResponse.md +39 -0
  31. data/docs/OpenPGPUserAttributeResponse.md +29 -0
  32. data/docs/OpenPGPUserIDResponse.md +29 -0
  33. data/docs/PaginatedOpenPGPDistributionResponseList.md +23 -0
  34. data/docs/PaginatedOpenPGPKeyringResponseList.md +23 -0
  35. data/docs/PaginatedOpenPGPPublicKeyResponseList.md +23 -0
  36. data/docs/PaginatedOpenPGPPublicSubkeyResponseList.md +23 -0
  37. data/docs/PaginatedOpenPGPSignatureResponseList.md +23 -0
  38. data/docs/PaginatedOpenPGPUserAttributeResponseList.md +23 -0
  39. data/docs/PaginatedOpenPGPUserIDResponseList.md +23 -0
  40. data/docs/PatchedOpenPGPDistribution.md +29 -0
  41. data/docs/PatchedOpenPGPKeyring.md +25 -0
  42. data/docs/PulpExportResponse.md +3 -3
  43. data/docs/RepositoriesApi.md +4 -4
  44. data/docs/RepositoriesOpenpgpKeyringApi.md +802 -0
  45. data/docs/RepositoryAddRemoveContent.md +21 -0
  46. data/docs/SetLabel.md +19 -0
  47. data/docs/SetLabelResponse.md +19 -0
  48. data/docs/TaskResponse.md +1 -1
  49. data/docs/TasksApi.md +2 -2
  50. data/docs/UnsetLabel.md +17 -0
  51. data/docs/UnsetLabelResponse.md +19 -0
  52. data/lib/pulpcore_client/api/access_policies_api.rb +8 -8
  53. data/lib/pulpcore_client/api/content_api.rb +6 -6
  54. data/lib/pulpcore_client/api/content_openpgp_publickey_api.rb +266 -0
  55. data/lib/pulpcore_client/api/content_openpgp_publicsubkey_api.rb +192 -0
  56. data/lib/pulpcore_client/api/content_openpgp_signature_api.rb +192 -0
  57. data/lib/pulpcore_client/api/content_openpgp_userattribute_api.rb +192 -0
  58. data/lib/pulpcore_client/api/content_openpgp_userid_api.rb +216 -0
  59. data/lib/pulpcore_client/api/distributions_api.rb +6 -6
  60. data/lib/pulpcore_client/api/distributions_openpgp_api.rb +592 -0
  61. data/lib/pulpcore_client/api/repositories_api.rb +6 -6
  62. data/lib/pulpcore_client/api/repositories_openpgp_keyring_api.rb +992 -0
  63. data/lib/pulpcore_client/api/tasks_api.rb +3 -3
  64. data/lib/pulpcore_client/models/artifact_distribution_response.rb +58 -58
  65. data/lib/pulpcore_client/models/filesystem_export_response.rb +1 -1
  66. data/lib/pulpcore_client/models/import_response.rb +1 -1
  67. data/lib/pulpcore_client/models/nested_open_pgp_public_subkey.rb +254 -0
  68. data/lib/pulpcore_client/models/nested_open_pgp_public_subkey_response.rb +256 -0
  69. data/lib/pulpcore_client/models/nested_open_pgp_signature.rb +305 -0
  70. data/lib/pulpcore_client/models/nested_open_pgp_signature_response.rb +290 -0
  71. data/lib/pulpcore_client/models/nested_open_pgp_user_attribute.rb +240 -0
  72. data/lib/pulpcore_client/models/nested_open_pgp_user_attribute_response.rb +242 -0
  73. data/lib/pulpcore_client/models/nested_open_pgp_user_id.rb +231 -0
  74. data/lib/pulpcore_client/models/nested_open_pgp_user_id_response.rb +223 -0
  75. data/lib/pulpcore_client/models/open_pgp_distribution.rb +322 -0
  76. data/lib/pulpcore_client/models/open_pgp_distribution_response.rb +343 -0
  77. data/lib/pulpcore_client/models/open_pgp_keyring.rb +306 -0
  78. data/lib/pulpcore_client/models/open_pgp_keyring_response.rb +329 -0
  79. data/lib/pulpcore_client/models/open_pgp_public_key.rb +253 -0
  80. data/lib/pulpcore_client/models/open_pgp_public_key_response.rb +303 -0
  81. data/lib/pulpcore_client/models/open_pgp_public_subkey_response.rb +304 -0
  82. data/lib/pulpcore_client/models/open_pgp_signature_response.rb +338 -0
  83. data/lib/pulpcore_client/models/open_pgp_user_attribute_response.rb +290 -0
  84. data/lib/pulpcore_client/models/open_pgp_user_id_response.rb +271 -0
  85. data/lib/pulpcore_client/models/paginated_open_pgp_distribution_response_list.rb +247 -0
  86. data/lib/pulpcore_client/models/paginated_open_pgp_keyring_response_list.rb +247 -0
  87. data/lib/pulpcore_client/models/paginated_open_pgp_public_key_response_list.rb +247 -0
  88. data/lib/pulpcore_client/models/paginated_open_pgp_public_subkey_response_list.rb +247 -0
  89. data/lib/pulpcore_client/models/paginated_open_pgp_signature_response_list.rb +247 -0
  90. data/lib/pulpcore_client/models/paginated_open_pgp_user_attribute_response_list.rb +247 -0
  91. data/lib/pulpcore_client/models/paginated_open_pgp_user_id_response_list.rb +247 -0
  92. data/lib/pulpcore_client/models/patched_open_pgp_distribution.rb +304 -0
  93. data/lib/pulpcore_client/models/patched_open_pgp_keyring.rb +297 -0
  94. data/lib/pulpcore_client/models/pulp_export_response.rb +3 -3
  95. data/lib/pulpcore_client/models/repository_add_remove_content.rb +232 -0
  96. data/lib/pulpcore_client/models/set_label.rb +252 -0
  97. data/lib/pulpcore_client/models/set_label_response.rb +243 -0
  98. data/lib/pulpcore_client/models/task_response.rb +1 -1
  99. data/lib/pulpcore_client/models/unset_label.rb +242 -0
  100. data/lib/pulpcore_client/models/unset_label_response.rb +242 -0
  101. data/lib/pulpcore_client/version.rb +1 -1
  102. data/lib/pulpcore_client.rb +39 -0
  103. data/spec/api/access_policies_api_spec.rb +4 -4
  104. data/spec/api/content_api_spec.rb +2 -2
  105. data/spec/api/content_openpgp_publickey_api_spec.rb +89 -0
  106. data/spec/api/content_openpgp_publicsubkey_api_spec.rb +74 -0
  107. data/spec/api/content_openpgp_signature_api_spec.rb +74 -0
  108. data/spec/api/content_openpgp_userattribute_api_spec.rb +74 -0
  109. data/spec/api/content_openpgp_userid_api_spec.rb +82 -0
  110. data/spec/api/distributions_api_spec.rb +2 -2
  111. data/spec/api/distributions_openpgp_api_spec.rb +148 -0
  112. data/spec/api/repositories_api_spec.rb +2 -2
  113. data/spec/api/repositories_openpgp_keyring_api_spec.rb +233 -0
  114. data/spec/api/tasks_api_spec.rb +1 -1
  115. data/spec/models/artifact_distribution_response_spec.rb +10 -10
  116. data/spec/models/nested_open_pgp_public_subkey_response_spec.rb +53 -0
  117. data/spec/models/nested_open_pgp_public_subkey_spec.rb +47 -0
  118. data/spec/models/nested_open_pgp_signature_response_spec.rb +77 -0
  119. data/spec/models/nested_open_pgp_signature_spec.rb +71 -0
  120. data/spec/models/nested_open_pgp_user_attribute_response_spec.rb +47 -0
  121. data/spec/models/nested_open_pgp_user_attribute_spec.rb +41 -0
  122. data/spec/models/nested_open_pgp_user_id_response_spec.rb +47 -0
  123. data/spec/models/nested_open_pgp_user_id_spec.rb +41 -0
  124. data/spec/models/open_pgp_distribution_response_spec.rb +113 -0
  125. data/spec/models/open_pgp_distribution_spec.rb +77 -0
  126. data/spec/models/open_pgp_keyring_response_spec.rb +101 -0
  127. data/spec/models/open_pgp_keyring_spec.rb +65 -0
  128. data/spec/models/open_pgp_public_key_response_spec.rb +89 -0
  129. data/spec/models/open_pgp_public_key_spec.rb +59 -0
  130. data/spec/models/open_pgp_public_subkey_response_spec.rb +83 -0
  131. data/spec/models/open_pgp_signature_response_spec.rb +107 -0
  132. data/spec/models/open_pgp_user_attribute_response_spec.rb +77 -0
  133. data/spec/models/open_pgp_user_id_response_spec.rb +77 -0
  134. data/spec/models/paginated_open_pgp_distribution_response_list_spec.rb +59 -0
  135. data/spec/models/paginated_open_pgp_keyring_response_list_spec.rb +59 -0
  136. data/spec/models/paginated_open_pgp_public_key_response_list_spec.rb +59 -0
  137. data/spec/models/paginated_open_pgp_public_subkey_response_list_spec.rb +59 -0
  138. data/spec/models/paginated_open_pgp_signature_response_list_spec.rb +59 -0
  139. data/spec/models/paginated_open_pgp_user_attribute_response_list_spec.rb +59 -0
  140. data/spec/models/paginated_open_pgp_user_id_response_list_spec.rb +59 -0
  141. data/spec/models/patched_open_pgp_distribution_spec.rb +77 -0
  142. data/spec/models/patched_open_pgp_keyring_spec.rb +65 -0
  143. data/spec/models/repository_add_remove_content_spec.rb +53 -0
  144. data/spec/models/set_label_response_spec.rb +47 -0
  145. data/spec/models/set_label_spec.rb +47 -0
  146. data/spec/models/unset_label_response_spec.rb +47 -0
  147. data/spec/models/unset_label_spec.rb +41 -0
  148. metadata +311 -155
@@ -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 PulpcoreClient
16
+ # Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class PatchedOpenPGPKeyring
18
+ attr_accessor :pulp_labels
19
+
20
+ # A unique name for this repository.
21
+ attr_accessor :name
22
+
23
+ # An optional description.
24
+ attr_accessor :description
25
+
26
+ # Retain X versions of the repository. Default is null which retains all versions.
27
+ attr_accessor :retain_repo_versions
28
+
29
+ # An optional remote to use by default when syncing.
30
+ attr_accessor :remote
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'pulp_labels' => :'pulp_labels',
36
+ :'name' => :'name',
37
+ :'description' => :'description',
38
+ :'retain_repo_versions' => :'retain_repo_versions',
39
+ :'remote' => :'remote'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'pulp_labels' => :'Hash<String, String>',
47
+ :'name' => :'String',
48
+ :'description' => :'String',
49
+ :'retain_repo_versions' => :'Integer',
50
+ :'remote' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'description',
58
+ :'retain_repo_versions',
59
+ :'remote'
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PatchedOpenPGPKeyring` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PatchedOpenPGPKeyring`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'pulp_labels')
79
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
80
+ self.pulp_labels = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
86
+ end
87
+
88
+ if attributes.key?(:'description')
89
+ self.description = attributes[:'description']
90
+ end
91
+
92
+ if attributes.key?(:'retain_repo_versions')
93
+ self.retain_repo_versions = attributes[:'retain_repo_versions']
94
+ end
95
+
96
+ if attributes.key?(:'remote')
97
+ self.remote = attributes[:'remote']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if !@name.nil? && @name.to_s.length < 1
106
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
107
+ end
108
+
109
+ if !@description.nil? && @description.to_s.length < 1
110
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
111
+ end
112
+
113
+ if !@retain_repo_versions.nil? && @retain_repo_versions < 1
114
+ invalid_properties.push('invalid value for "retain_repo_versions", must be greater than or equal to 1.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ return false if !@name.nil? && @name.to_s.length < 1
124
+ return false if !@description.nil? && @description.to_s.length < 1
125
+ return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] name Value to be assigned
131
+ def name=(name)
132
+ if !name.nil? && name.to_s.length < 1
133
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
134
+ end
135
+
136
+ @name = name
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] description Value to be assigned
141
+ def description=(description)
142
+ if !description.nil? && description.to_s.length < 1
143
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
144
+ end
145
+
146
+ @description = description
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] retain_repo_versions Value to be assigned
151
+ def retain_repo_versions=(retain_repo_versions)
152
+ if !retain_repo_versions.nil? && retain_repo_versions < 1
153
+ fail ArgumentError, 'invalid value for "retain_repo_versions", must be greater than or equal to 1.'
154
+ end
155
+
156
+ @retain_repo_versions = retain_repo_versions
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
+ pulp_labels == o.pulp_labels &&
165
+ name == o.name &&
166
+ description == o.description &&
167
+ retain_repo_versions == o.retain_repo_versions &&
168
+ remote == o.remote
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
+ [pulp_labels, name, description, retain_repo_versions, remote].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
+ PulpcoreClient.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
@@ -65,9 +65,9 @@ module PulpcoreClient
65
65
  :'pulp_last_updated' => :'DateTime',
66
66
  :'task' => :'String',
67
67
  :'exported_resources' => :'Array<String>',
68
- :'params' => :'AnyType',
69
- :'output_file_info' => :'AnyType',
70
- :'toc_info' => :'AnyType'
68
+ :'params' => :'Object',
69
+ :'output_file_info' => :'Object',
70
+ :'toc_info' => :'Object'
71
71
  }
72
72
  end
73
73
 
@@ -0,0 +1,232 @@
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 PulpcoreClient
16
+ # Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class RepositoryAddRemoveContent
18
+ # A list of content units to add to a new repository version. This content is added after remove_content_units are removed.
19
+ attr_accessor :add_content_units
20
+
21
+ # A list of content units to remove from the latest repository version. You may also specify '*' as an entry to remove all content. This content is removed before add_content_units are added.
22
+ attr_accessor :remove_content_units
23
+
24
+ # A repository version whose content will be used as the initial set of content for the new repository version
25
+ attr_accessor :base_version
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'add_content_units' => :'add_content_units',
31
+ :'remove_content_units' => :'remove_content_units',
32
+ :'base_version' => :'base_version'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'add_content_units' => :'Array<String>',
40
+ :'remove_content_units' => :'Array<String>',
41
+ :'base_version' => :'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 `PulpcoreClient::RepositoryAddRemoveContent` 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 `PulpcoreClient::RepositoryAddRemoveContent`. 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?(:'add_content_units')
67
+ if (value = attributes[:'add_content_units']).is_a?(Array)
68
+ self.add_content_units = value
69
+ end
70
+ end
71
+
72
+ if attributes.key?(:'remove_content_units')
73
+ if (value = attributes[:'remove_content_units']).is_a?(Array)
74
+ self.remove_content_units = value
75
+ end
76
+ end
77
+
78
+ if attributes.key?(:'base_version')
79
+ self.base_version = attributes[:'base_version']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ add_content_units == o.add_content_units &&
102
+ remove_content_units == o.remove_content_units &&
103
+ base_version == o.base_version
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [add_content_units, remove_content_units, base_version].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :DateTime
152
+ DateTime.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ PulpcoreClient.const_get(type).build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+ end
232
+ end