pulpcore_client 3.65.0 → 3.66.0

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