pulp_python_client 3.12.5 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -16
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentPackagesApi.md +170 -120
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsPypiApi.md +385 -182
  7. data/docs/ExcludePlatformsEnum.md +4 -5
  8. data/docs/MyPermissionsResponse.md +8 -7
  9. data/docs/NestedRole.md +12 -11
  10. data/docs/NestedRoleResponse.md +12 -11
  11. data/docs/ObjectRolesResponse.md +8 -7
  12. data/docs/PackageMetadataResponse.md +14 -13
  13. data/docs/PackageTypesEnum.md +4 -5
  14. data/docs/PackageUploadTaskResponse.md +12 -11
  15. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  16. data/docs/PaginatedpythonPythonDistributionResponseList.md +14 -13
  17. data/docs/PaginatedpythonPythonPackageContentResponseList.md +14 -13
  18. data/docs/PaginatedpythonPythonPublicationResponseList.md +14 -13
  19. data/docs/PaginatedpythonPythonRemoteResponseList.md +14 -13
  20. data/docs/PaginatedpythonPythonRepositoryResponseList.md +14 -13
  21. data/docs/PatchedpythonPythonDistribution.md +24 -23
  22. data/docs/PatchedpythonPythonRemote.md +60 -59
  23. data/docs/PatchedpythonPythonRepository.md +18 -17
  24. data/docs/PolicyEnum.md +4 -5
  25. data/docs/PublicationsPypiApi.md +267 -130
  26. data/docs/PypiApi.md +33 -17
  27. data/docs/PypiLegacyApi.md +34 -18
  28. data/docs/PypiMetadataApi.md +34 -18
  29. data/docs/PypiSimpleApi.md +95 -45
  30. data/docs/PythonPythonDistribution.md +24 -23
  31. data/docs/PythonPythonDistributionResponse.md +36 -35
  32. data/docs/PythonPythonPackageContentResponse.md +70 -69
  33. data/docs/PythonPythonPublication.md +10 -9
  34. data/docs/PythonPythonPublicationResponse.md +20 -19
  35. data/docs/PythonPythonRemote.md +60 -59
  36. data/docs/PythonPythonRemoteResponse.md +60 -59
  37. data/docs/PythonPythonRemoteResponseHiddenFieldsInner.md +20 -0
  38. data/docs/PythonPythonRepository.md +18 -17
  39. data/docs/PythonPythonRepositoryResponse.md +30 -29
  40. data/docs/RemotesPythonApi.md +420 -198
  41. data/docs/Repair.md +8 -7
  42. data/docs/RepositoriesPythonApi.md +444 -207
  43. data/docs/RepositoriesPythonVersionsApi.md +152 -82
  44. data/docs/RepositoryAddRemoveContent.md +12 -11
  45. data/docs/RepositorySyncURL.md +10 -9
  46. data/docs/RepositoryVersionResponse.md +22 -21
  47. data/docs/SetLabel.md +10 -9
  48. data/docs/SetLabelResponse.md +10 -9
  49. data/docs/SummaryResponse.md +12 -11
  50. data/docs/UnsetLabel.md +8 -7
  51. data/docs/UnsetLabelResponse.md +10 -9
  52. data/lib/pulp_python_client/api/content_packages_api.rb +21 -15
  53. data/lib/pulp_python_client/api/distributions_pypi_api.rb +89 -56
  54. data/lib/pulp_python_client/api/publications_pypi_api.rb +67 -47
  55. data/lib/pulp_python_client/api/pypi_api.rb +6 -5
  56. data/lib/pulp_python_client/api/pypi_legacy_api.rb +11 -7
  57. data/lib/pulp_python_client/api/pypi_metadata_api.rb +6 -5
  58. data/lib/pulp_python_client/api/pypi_simple_api.rb +19 -13
  59. data/lib/pulp_python_client/api/remotes_python_api.rb +113 -73
  60. data/lib/pulp_python_client/api/repositories_python_api.rb +107 -66
  61. data/lib/pulp_python_client/api/repositories_python_versions_api.rb +40 -30
  62. data/lib/pulp_python_client/api_client.rb +137 -102
  63. data/lib/pulp_python_client/api_error.rb +2 -1
  64. data/lib/pulp_python_client/configuration.rb +162 -21
  65. data/lib/pulp_python_client/models/async_operation_response.rb +32 -22
  66. data/lib/pulp_python_client/models/content_summary_response.rb +36 -22
  67. data/lib/pulp_python_client/models/exclude_platforms_enum.rb +8 -4
  68. data/lib/pulp_python_client/models/my_permissions_response.rb +32 -22
  69. data/lib/pulp_python_client/models/nested_role.rb +32 -22
  70. data/lib/pulp_python_client/models/nested_role_response.rb +32 -22
  71. data/lib/pulp_python_client/models/object_roles_response.rb +32 -22
  72. data/lib/pulp_python_client/models/package_metadata_response.rb +41 -37
  73. data/lib/pulp_python_client/models/package_types_enum.rb +8 -4
  74. data/lib/pulp_python_client/models/package_upload_task_response.rb +37 -23
  75. data/lib/pulp_python_client/models/paginated_repository_version_response_list.rb +34 -22
  76. data/lib/pulp_python_client/models/paginatedpython_python_distribution_response_list.rb +34 -22
  77. data/lib/pulp_python_client/models/paginatedpython_python_package_content_response_list.rb +34 -22
  78. data/lib/pulp_python_client/models/paginatedpython_python_publication_response_list.rb +34 -22
  79. data/lib/pulp_python_client/models/paginatedpython_python_remote_response_list.rb +34 -22
  80. data/lib/pulp_python_client/models/paginatedpython_python_repository_response_list.rb +34 -22
  81. data/lib/pulp_python_client/models/patchedpython_python_distribution.rb +40 -24
  82. data/lib/pulp_python_client/models/patchedpython_python_remote.rb +82 -44
  83. data/lib/pulp_python_client/models/patchedpython_python_repository.rb +35 -23
  84. data/lib/pulp_python_client/models/policy_enum.rb +8 -4
  85. data/lib/pulp_python_client/models/python_python_distribution.rb +34 -22
  86. data/lib/pulp_python_client/models/python_python_distribution_response.rb +36 -24
  87. data/lib/pulp_python_client/models/python_python_package_content_response.rb +38 -24
  88. data/lib/pulp_python_client/models/python_python_publication.rb +30 -22
  89. data/lib/pulp_python_client/models/python_python_publication_response.rb +32 -24
  90. data/lib/pulp_python_client/models/python_python_remote.rb +76 -42
  91. data/lib/pulp_python_client/models/python_python_remote_response.rb +79 -45
  92. data/lib/pulp_python_client/models/{python_python_remote_response_hidden_fields.rb → python_python_remote_response_hidden_fields_inner.rb} +37 -25
  93. data/lib/pulp_python_client/models/python_python_repository.rb +32 -22
  94. data/lib/pulp_python_client/models/python_python_repository_response.rb +34 -24
  95. data/lib/pulp_python_client/models/repair.rb +30 -22
  96. data/lib/pulp_python_client/models/repository_add_remove_content.rb +30 -22
  97. data/lib/pulp_python_client/models/repository_sync_url.rb +30 -22
  98. data/lib/pulp_python_client/models/repository_version_response.rb +32 -24
  99. data/lib/pulp_python_client/models/set_label.rb +34 -22
  100. data/lib/pulp_python_client/models/set_label_response.rb +34 -22
  101. data/lib/pulp_python_client/models/summary_response.rb +36 -22
  102. data/lib/pulp_python_client/models/unset_label.rb +32 -22
  103. data/lib/pulp_python_client/models/unset_label_response.rb +32 -22
  104. data/lib/pulp_python_client/version.rb +2 -2
  105. data/lib/pulp_python_client.rb +2 -5
  106. data/pulp_python_client.gemspec +9 -6
  107. data/spec/api/content_packages_api_spec.rb +4 -4
  108. data/spec/api/distributions_pypi_api_spec.rb +13 -13
  109. data/spec/api/publications_pypi_api_spec.rb +16 -15
  110. data/spec/api/pypi_api_spec.rb +2 -2
  111. data/spec/api/pypi_legacy_api_spec.rb +2 -2
  112. data/spec/api/pypi_metadata_api_spec.rb +2 -2
  113. data/spec/api/pypi_simple_api_spec.rb +4 -4
  114. data/spec/api/remotes_python_api_spec.rb +21 -20
  115. data/spec/api/repositories_python_api_spec.rb +15 -15
  116. data/spec/api/repositories_python_versions_api_spec.rb +12 -11
  117. data/spec/models/async_operation_response_spec.rb +7 -12
  118. data/spec/models/content_summary_response_spec.rb +9 -14
  119. data/spec/models/exclude_platforms_enum_spec.rb +6 -11
  120. data/spec/models/my_permissions_response_spec.rb +7 -12
  121. data/spec/models/nested_role_response_spec.rb +9 -14
  122. data/spec/models/nested_role_spec.rb +9 -14
  123. data/spec/models/object_roles_response_spec.rb +7 -12
  124. data/spec/models/package_metadata_response_spec.rb +10 -15
  125. data/spec/models/package_types_enum_spec.rb +6 -11
  126. data/spec/models/package_upload_task_response_spec.rb +9 -14
  127. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  128. data/spec/models/paginatedpython_python_distribution_response_list_spec.rb +10 -15
  129. data/spec/models/paginatedpython_python_package_content_response_list_spec.rb +10 -15
  130. data/spec/models/paginatedpython_python_publication_response_list_spec.rb +10 -15
  131. data/spec/models/paginatedpython_python_remote_response_list_spec.rb +10 -15
  132. data/spec/models/paginatedpython_python_repository_response_list_spec.rb +10 -15
  133. data/spec/models/patchedpython_python_distribution_spec.rb +15 -20
  134. data/spec/models/patchedpython_python_remote_spec.rb +33 -38
  135. data/spec/models/patchedpython_python_repository_spec.rb +12 -17
  136. data/spec/models/policy_enum_spec.rb +6 -11
  137. data/spec/models/python_python_distribution_response_spec.rb +21 -26
  138. data/spec/models/python_python_distribution_spec.rb +15 -20
  139. data/spec/models/python_python_package_content_response_spec.rb +38 -43
  140. data/spec/models/python_python_publication_response_spec.rb +13 -18
  141. data/spec/models/python_python_publication_spec.rb +8 -13
  142. data/spec/models/{python_python_remote_response_hidden_fields_spec.rb → python_python_remote_response_hidden_fields_inner_spec.rb} +11 -16
  143. data/spec/models/python_python_remote_response_spec.rb +33 -38
  144. data/spec/models/python_python_remote_spec.rb +33 -38
  145. data/spec/models/python_python_repository_response_spec.rb +18 -23
  146. data/spec/models/python_python_repository_spec.rb +12 -17
  147. data/spec/models/repair_spec.rb +7 -12
  148. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  149. data/spec/models/repository_sync_url_spec.rb +8 -13
  150. data/spec/models/repository_version_response_spec.rb +14 -19
  151. data/spec/models/set_label_response_spec.rb +8 -13
  152. data/spec/models/set_label_spec.rb +8 -13
  153. data/spec/models/summary_response_spec.rb +9 -14
  154. data/spec/models/unset_label_response_spec.rb +8 -13
  155. data/spec/models/unset_label_spec.rb +7 -12
  156. data/spec/spec_helper.rb +1 -1
  157. metadata +81 -69
  158. data/docs/PackageUpload.md +0 -21
  159. data/docs/PythonBanderRemote.md +0 -21
  160. data/docs/PythonPythonPackageContent.md +0 -71
  161. data/docs/PythonPythonRemoteResponseHiddenFields.md +0 -19
  162. data/lib/pulp_python_client/models/package_upload.rb +0 -283
  163. data/lib/pulp_python_client/models/python_bander_remote.rb +0 -257
  164. data/lib/pulp_python_client/models/python_python_package_content.rb +0 -534
  165. data/spec/api_client_spec.rb +0 -188
  166. data/spec/configuration_spec.rb +0 -42
  167. data/spec/models/package_upload_spec.rb +0 -53
  168. data/spec/models/python_bander_remote_spec.rb +0 -53
  169. data/spec/models/python_python_package_content_spec.rb +0 -203
@@ -1,283 +0,0 @@
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 PulpPythonClient
16
- # A Serializer for Python packages being uploaded to the index.
17
- class PackageUpload
18
- # A Python package release file to upload to the index.
19
- attr_accessor :content
20
-
21
- # Defaults to `file_upload`, don't change it or request will fail!
22
- attr_accessor :action
23
-
24
- # SHA256 of package to validate upload integrity.
25
- attr_accessor :sha256_digest
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'content' => :'content',
31
- :'action' => :'action',
32
- :'sha256_digest' => :'sha256_digest'
33
- }
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.openapi_types
38
- {
39
- :'content' => :'File',
40
- :'action' => :'String',
41
- :'sha256_digest' => :'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 `PulpPythonClient::PackageUpload` 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 `PulpPythonClient::PackageUpload`. 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?(:'content')
67
- self.content = attributes[:'content']
68
- end
69
-
70
- if attributes.key?(:'action')
71
- self.action = attributes[:'action']
72
- else
73
- self.action = 'file_upload'
74
- end
75
-
76
- if attributes.key?(:'sha256_digest')
77
- self.sha256_digest = attributes[:'sha256_digest']
78
- end
79
- end
80
-
81
- # Show invalid properties with the reasons. Usually used together with valid?
82
- # @return Array for valid properties with the reasons
83
- def list_invalid_properties
84
- invalid_properties = Array.new
85
- if @content.nil?
86
- invalid_properties.push('invalid value for "content", content cannot be nil.')
87
- end
88
-
89
- if !@action.nil? && @action.to_s.length < 1
90
- invalid_properties.push('invalid value for "action", the character length must be great than or equal to 1.')
91
- end
92
-
93
- if @sha256_digest.nil?
94
- invalid_properties.push('invalid value for "sha256_digest", sha256_digest cannot be nil.')
95
- end
96
-
97
- if @sha256_digest.to_s.length > 64
98
- invalid_properties.push('invalid value for "sha256_digest", the character length must be smaller than or equal to 64.')
99
- end
100
-
101
- if @sha256_digest.to_s.length < 64
102
- invalid_properties.push('invalid value for "sha256_digest", the character length must be great than or equal to 64.')
103
- end
104
-
105
- invalid_properties
106
- end
107
-
108
- # Check to see if the all the properties in the model are valid
109
- # @return true if the model is valid
110
- def valid?
111
- return false if @content.nil?
112
- return false if !@action.nil? && @action.to_s.length < 1
113
- return false if @sha256_digest.nil?
114
- return false if @sha256_digest.to_s.length > 64
115
- return false if @sha256_digest.to_s.length < 64
116
- true
117
- end
118
-
119
- # Custom attribute writer method with validation
120
- # @param [Object] action Value to be assigned
121
- def action=(action)
122
- if !action.nil? && action.to_s.length < 1
123
- fail ArgumentError, 'invalid value for "action", the character length must be great than or equal to 1.'
124
- end
125
-
126
- @action = action
127
- end
128
-
129
- # Custom attribute writer method with validation
130
- # @param [Object] sha256_digest Value to be assigned
131
- def sha256_digest=(sha256_digest)
132
- if sha256_digest.nil?
133
- fail ArgumentError, 'sha256_digest cannot be nil'
134
- end
135
-
136
- if sha256_digest.to_s.length > 64
137
- fail ArgumentError, 'invalid value for "sha256_digest", the character length must be smaller than or equal to 64.'
138
- end
139
-
140
- if sha256_digest.to_s.length < 64
141
- fail ArgumentError, 'invalid value for "sha256_digest", the character length must be great than or equal to 64.'
142
- end
143
-
144
- @sha256_digest = sha256_digest
145
- end
146
-
147
- # Checks equality by comparing each attribute.
148
- # @param [Object] Object to be compared
149
- def ==(o)
150
- return true if self.equal?(o)
151
- self.class == o.class &&
152
- content == o.content &&
153
- action == o.action &&
154
- sha256_digest == o.sha256_digest
155
- end
156
-
157
- # @see the `==` method
158
- # @param [Object] Object to be compared
159
- def eql?(o)
160
- self == o
161
- end
162
-
163
- # Calculates hash code according to all attributes.
164
- # @return [Integer] Hash code
165
- def hash
166
- [content, action, sha256_digest].hash
167
- end
168
-
169
- # Builds the object from hash
170
- # @param [Hash] attributes Model attributes in the form of hash
171
- # @return [Object] Returns the model itself
172
- def self.build_from_hash(attributes)
173
- new.build_from_hash(attributes)
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 build_from_hash(attributes)
180
- return nil unless attributes.is_a?(Hash)
181
- self.class.openapi_types.each_pair do |key, type|
182
- if type =~ /\AArray<(.*)>/i
183
- # check to ensure the input is an array given that the attribute
184
- # is documented as an array but the input is not
185
- if attributes[self.class.attribute_map[key]].is_a?(Array)
186
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
187
- end
188
- elsif !attributes[self.class.attribute_map[key]].nil?
189
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
190
- end # or else data not found in attributes(hash), not an issue as the data can be optional
191
- end
192
-
193
- self
194
- end
195
-
196
- # Deserializes the data based on type
197
- # @param string type Data type
198
- # @param string value Value to be deserialized
199
- # @return [Object] Deserialized data
200
- def _deserialize(type, value)
201
- case type.to_sym
202
- when :DateTime
203
- DateTime.parse(value)
204
- when :Date
205
- Date.parse(value)
206
- when :String
207
- value.to_s
208
- when :Integer
209
- value.to_i
210
- when :Float
211
- value.to_f
212
- when :Boolean
213
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
- true
215
- else
216
- false
217
- end
218
- when :Object
219
- # generic object (usually a Hash), return directly
220
- value
221
- when /\AArray<(?<inner_type>.+)>\z/
222
- inner_type = Regexp.last_match[:inner_type]
223
- value.map { |v| _deserialize(inner_type, v) }
224
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
- k_type = Regexp.last_match[:k_type]
226
- v_type = Regexp.last_match[:v_type]
227
- {}.tap do |hash|
228
- value.each do |k, v|
229
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
- end
231
- end
232
- else # model
233
- PulpPythonClient.const_get(type).build_from_hash(value)
234
- end
235
- end
236
-
237
- # Returns the string representation of the object
238
- # @return [String] String presentation of the object
239
- def to_s
240
- to_hash.to_s
241
- end
242
-
243
- # to_body is an alias to to_hash (backward compatibility)
244
- # @return [Hash] Returns the object in the form of hash
245
- def to_body
246
- to_hash
247
- end
248
-
249
- # Returns the object in the form of hash
250
- # @return [Hash] Returns the object in the form of hash
251
- def to_hash
252
- hash = {}
253
- self.class.attribute_map.each_pair do |attr, param|
254
- value = self.send(attr)
255
- if value.nil?
256
- is_nullable = self.class.openapi_nullable.include?(attr)
257
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
- end
259
-
260
- hash[param] = _to_hash(value)
261
- end
262
- hash
263
- end
264
-
265
- # Outputs non-array value in the form of hash
266
- # For object, use to_hash. Otherwise, just return the value
267
- # @param [Object] value Any valid value
268
- # @return [Hash] Returns the value in the form of hash
269
- def _to_hash(value)
270
- if value.is_a?(Array)
271
- value.compact.map { |v| _to_hash(v) }
272
- elsif value.is_a?(Hash)
273
- {}.tap do |hash|
274
- value.each { |k, v| hash[k] = _to_hash(v) }
275
- end
276
- elsif value.respond_to? :to_hash
277
- value.to_hash
278
- else
279
- value
280
- end
281
- end
282
- end
283
- end
@@ -1,257 +0,0 @@
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 PulpPythonClient
16
- # A Serializer for the initial step of creating a Python Remote from a Bandersnatch config file
17
- class PythonBanderRemote
18
- # A Bandersnatch config that may be used to construct a Python Remote.
19
- attr_accessor :config
20
-
21
- # A unique name for this remote
22
- attr_accessor :name
23
-
24
- # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'on_demand' is the default. * `immediate` - When syncing, download all metadata and content now. * `on_demand` - When syncing, download metadata, but do not download content now. Instead, download content as clients request it, and save it in Pulp to be served for future client requests. * `streamed` - When syncing, download metadata, but do not download content now. Instead,download content as clients request it, but never save it in Pulp. This causes future requests for that same content to have to be downloaded again.
25
- attr_accessor :policy
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'config' => :'config',
31
- :'name' => :'name',
32
- :'policy' => :'policy'
33
- }
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.openapi_types
38
- {
39
- :'config' => :'File',
40
- :'name' => :'String',
41
- :'policy' => :'PolicyEnum'
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 `PulpPythonClient::PythonBanderRemote` 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 `PulpPythonClient::PythonBanderRemote`. 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?(:'config')
67
- self.config = attributes[:'config']
68
- end
69
-
70
- if attributes.key?(:'name')
71
- self.name = attributes[:'name']
72
- end
73
-
74
- if attributes.key?(:'policy')
75
- self.policy = attributes[:'policy']
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 @config.nil?
84
- invalid_properties.push('invalid value for "config", config cannot be nil.')
85
- end
86
-
87
- if @name.nil?
88
- invalid_properties.push('invalid value for "name", name cannot be nil.')
89
- end
90
-
91
- if @name.to_s.length < 1
92
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
93
- end
94
-
95
- invalid_properties
96
- end
97
-
98
- # Check to see if the all the properties in the model are valid
99
- # @return true if the model is valid
100
- def valid?
101
- return false if @config.nil?
102
- return false if @name.nil?
103
- return false if @name.to_s.length < 1
104
- true
105
- end
106
-
107
- # Custom attribute writer method with validation
108
- # @param [Object] name Value to be assigned
109
- def name=(name)
110
- if name.nil?
111
- fail ArgumentError, 'name cannot be nil'
112
- end
113
-
114
- if name.to_s.length < 1
115
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
116
- end
117
-
118
- @name = name
119
- end
120
-
121
- # Checks equality by comparing each attribute.
122
- # @param [Object] Object to be compared
123
- def ==(o)
124
- return true if self.equal?(o)
125
- self.class == o.class &&
126
- config == o.config &&
127
- name == o.name &&
128
- policy == o.policy
129
- end
130
-
131
- # @see the `==` method
132
- # @param [Object] Object to be compared
133
- def eql?(o)
134
- self == o
135
- end
136
-
137
- # Calculates hash code according to all attributes.
138
- # @return [Integer] Hash code
139
- def hash
140
- [config, name, policy].hash
141
- end
142
-
143
- # Builds the object from hash
144
- # @param [Hash] attributes Model attributes in the form of hash
145
- # @return [Object] Returns the model itself
146
- def self.build_from_hash(attributes)
147
- new.build_from_hash(attributes)
148
- end
149
-
150
- # Builds the object from hash
151
- # @param [Hash] attributes Model attributes in the form of hash
152
- # @return [Object] Returns the model itself
153
- def build_from_hash(attributes)
154
- return nil unless attributes.is_a?(Hash)
155
- self.class.openapi_types.each_pair do |key, type|
156
- if type =~ /\AArray<(.*)>/i
157
- # check to ensure the input is an array given that the attribute
158
- # is documented as an array but the input is not
159
- if attributes[self.class.attribute_map[key]].is_a?(Array)
160
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
- end
162
- elsif !attributes[self.class.attribute_map[key]].nil?
163
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
- end # or else data not found in attributes(hash), not an issue as the data can be optional
165
- end
166
-
167
- self
168
- end
169
-
170
- # Deserializes the data based on type
171
- # @param string type Data type
172
- # @param string value Value to be deserialized
173
- # @return [Object] Deserialized data
174
- def _deserialize(type, value)
175
- case type.to_sym
176
- when :DateTime
177
- DateTime.parse(value)
178
- when :Date
179
- Date.parse(value)
180
- when :String
181
- value.to_s
182
- when :Integer
183
- value.to_i
184
- when :Float
185
- value.to_f
186
- when :Boolean
187
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
- true
189
- else
190
- false
191
- end
192
- when :Object
193
- # generic object (usually a Hash), return directly
194
- value
195
- when /\AArray<(?<inner_type>.+)>\z/
196
- inner_type = Regexp.last_match[:inner_type]
197
- value.map { |v| _deserialize(inner_type, v) }
198
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
- k_type = Regexp.last_match[:k_type]
200
- v_type = Regexp.last_match[:v_type]
201
- {}.tap do |hash|
202
- value.each do |k, v|
203
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
- end
205
- end
206
- else # model
207
- PulpPythonClient.const_get(type).build_from_hash(value)
208
- end
209
- end
210
-
211
- # Returns the string representation of the object
212
- # @return [String] String presentation of the object
213
- def to_s
214
- to_hash.to_s
215
- end
216
-
217
- # to_body is an alias to to_hash (backward compatibility)
218
- # @return [Hash] Returns the object in the form of hash
219
- def to_body
220
- to_hash
221
- end
222
-
223
- # Returns the object in the form of hash
224
- # @return [Hash] Returns the object in the form of hash
225
- def to_hash
226
- hash = {}
227
- self.class.attribute_map.each_pair do |attr, param|
228
- value = self.send(attr)
229
- if value.nil?
230
- is_nullable = self.class.openapi_nullable.include?(attr)
231
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
- end
233
-
234
- hash[param] = _to_hash(value)
235
- end
236
- hash
237
- end
238
-
239
- # Outputs non-array value in the form of hash
240
- # For object, use to_hash. Otherwise, just return the value
241
- # @param [Object] value Any valid value
242
- # @return [Hash] Returns the value in the form of hash
243
- def _to_hash(value)
244
- if value.is_a?(Array)
245
- value.compact.map { |v| _to_hash(v) }
246
- elsif value.is_a?(Hash)
247
- {}.tap do |hash|
248
- value.each { |k, v| hash[k] = _to_hash(v) }
249
- end
250
- elsif value.respond_to? :to_hash
251
- value.to_hash
252
- else
253
- value
254
- end
255
- end
256
- end
257
- end