pulp_ansible_client 0.17.3 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/docs/AnsibleCollectionVersion.md +4 -4
  4. data/docs/AnsibleCollectionVersionResponse.md +3 -3
  5. data/docs/AnsibleCollectionVersionSignature.md +3 -3
  6. data/docs/AnsibleGitRemote.md +30 -30
  7. data/docs/AnsibleGitRemoteResponse.md +26 -26
  8. data/docs/AnsibleRole.md +2 -0
  9. data/docs/AnsibleRoleResponse.md +4 -4
  10. data/docs/CollectionNamespaceResponse.md +1 -1
  11. data/docs/CollectionResponse.md +5 -3
  12. data/docs/CollectionVersionResponse.md +1 -1
  13. data/docs/CollectionVersionSignatureResponse.md +23 -0
  14. data/docs/ContentCollectionVersionsApi.md +6 -6
  15. data/docs/DistributionsAnsibleApi.md +2 -2
  16. data/docs/PatchedCollection.md +17 -0
  17. data/docs/PatchedansibleGitRemote.md +30 -30
  18. data/docs/PulpAnsibleApiV3CollectionsApi.md +4 -4
  19. data/docs/PulpAnsibleApiV3CollectionsVersionsApi.md +2 -2
  20. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexApi.md +4 -4
  21. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexVersionsApi.md +2 -2
  22. data/docs/PulpAnsibleDefaultApiV3CollectionsApi.md +4 -4
  23. data/docs/PulpAnsibleDefaultApiV3CollectionsVersionsApi.md +2 -2
  24. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexApi.md +4 -4
  25. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexVersionsApi.md +2 -2
  26. data/docs/RepositoriesAnsibleApi.md +4 -0
  27. data/docs/TaskResponse.md +2 -0
  28. data/docs/UnpaginatedCollectionVersionResponse.md +1 -1
  29. data/lib/pulp_ansible_client/api/content_collection_versions_api.rb +9 -9
  30. data/lib/pulp_ansible_client/api/distributions_ansible_api.rb +3 -3
  31. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_collections_api.rb +9 -9
  32. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_collections_versions_api.rb +3 -3
  33. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_api.rb +9 -9
  34. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_versions_api.rb +3 -3
  35. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_collections_api.rb +9 -9
  36. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_collections_versions_api.rb +3 -3
  37. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_api.rb +9 -9
  38. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_versions_api.rb +3 -3
  39. data/lib/pulp_ansible_client/api/repositories_ansible_api.rb +6 -0
  40. data/lib/pulp_ansible_client/models/ansible_collection_version.rb +15 -15
  41. data/lib/pulp_ansible_client/models/ansible_collection_version_response.rb +11 -11
  42. data/lib/pulp_ansible_client/models/ansible_collection_version_signature.rb +11 -11
  43. data/lib/pulp_ansible_client/models/ansible_git_remote.rb +245 -245
  44. data/lib/pulp_ansible_client/models/ansible_git_remote_response.rb +154 -154
  45. data/lib/pulp_ansible_client/models/ansible_role.rb +11 -1
  46. data/lib/pulp_ansible_client/models/ansible_role_response.rb +14 -14
  47. data/lib/pulp_ansible_client/models/collection_namespace_response.rb +1 -0
  48. data/lib/pulp_ansible_client/models/collection_response.rb +19 -6
  49. data/lib/pulp_ansible_client/models/collection_version_response.rb +9 -2
  50. data/lib/pulp_ansible_client/models/collection_version_signature_response.rb +259 -0
  51. data/lib/pulp_ansible_client/models/patched_collection.rb +207 -0
  52. data/lib/pulp_ansible_client/models/patchedansible_git_remote.rb +241 -241
  53. data/lib/pulp_ansible_client/models/task_response.rb +11 -1
  54. data/lib/pulp_ansible_client/models/unpaginated_collection_version_response.rb +9 -2
  55. data/lib/pulp_ansible_client/version.rb +1 -1
  56. data/lib/pulp_ansible_client.rb +2 -0
  57. data/spec/api/content_collection_versions_api_spec.rb +3 -3
  58. data/spec/api/distributions_ansible_api_spec.rb +1 -1
  59. data/spec/api/pulp_ansible_api_v3_collections_api_spec.rb +1 -1
  60. data/spec/api/pulp_ansible_api_v3_collections_versions_api_spec.rb +1 -1
  61. data/spec/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_api_spec.rb +1 -1
  62. data/spec/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_versions_api_spec.rb +1 -1
  63. data/spec/api/pulp_ansible_default_api_v3_collections_api_spec.rb +1 -1
  64. data/spec/api/pulp_ansible_default_api_v3_collections_versions_api_spec.rb +1 -1
  65. data/spec/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_api_spec.rb +1 -1
  66. data/spec/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_versions_api_spec.rb +1 -1
  67. data/spec/api/repositories_ansible_api_spec.rb +2 -0
  68. data/spec/models/ansible_collection_version_response_spec.rb +3 -3
  69. data/spec/models/ansible_collection_version_signature_spec.rb +2 -2
  70. data/spec/models/ansible_collection_version_spec.rb +2 -2
  71. data/spec/models/ansible_git_remote_response_spec.rb +18 -18
  72. data/spec/models/ansible_git_remote_spec.rb +20 -20
  73. data/spec/models/ansible_role_response_spec.rb +2 -2
  74. data/spec/models/ansible_role_spec.rb +6 -0
  75. data/spec/models/collection_response_spec.rb +6 -0
  76. data/spec/models/collection_version_signature_response_spec.rb +59 -0
  77. data/spec/models/patched_collection_spec.rb +41 -0
  78. data/spec/models/patchedansible_git_remote_spec.rb +20 -20
  79. data/spec/models/task_response_spec.rb +6 -0
  80. metadata +138 -130
@@ -22,7 +22,6 @@ module PulpAnsibleClient
22
22
 
23
23
  attr_accessor :name
24
24
 
25
- # Get deprecated.
26
25
  attr_accessor :deprecated
27
26
 
28
27
  # Get a link to a collection versions list.
@@ -34,9 +33,11 @@ module PulpAnsibleClient
34
33
  # Get the timestamp of the lowest version CollectionVersion's created timestamp.
35
34
  attr_accessor :created_at
36
35
 
37
- # Get the timestamp of the highest version CollectionVersion's created timestamp.
36
+ # Get the timestamp of the latest version CollectionVersion's created timestamp.
38
37
  attr_accessor :updated_at
39
38
 
39
+ attr_accessor :download_count
40
+
40
41
  # Attribute mapping from ruby-style variable name to JSON key.
41
42
  def self.attribute_map
42
43
  {
@@ -47,7 +48,8 @@ module PulpAnsibleClient
47
48
  :'versions_url' => :'versions_url',
48
49
  :'highest_version' => :'highest_version',
49
50
  :'created_at' => :'created_at',
50
- :'updated_at' => :'updated_at'
51
+ :'updated_at' => :'updated_at',
52
+ :'download_count' => :'download_count'
51
53
  }
52
54
  end
53
55
 
@@ -61,7 +63,8 @@ module PulpAnsibleClient
61
63
  :'versions_url' => :'String',
62
64
  :'highest_version' => :'Object',
63
65
  :'created_at' => :'DateTime',
64
- :'updated_at' => :'DateTime'
66
+ :'updated_at' => :'DateTime',
67
+ :'download_count' => :'String'
65
68
  }
66
69
  end
67
70
 
@@ -117,18 +120,27 @@ module PulpAnsibleClient
117
120
  if attributes.key?(:'updated_at')
118
121
  self.updated_at = attributes[:'updated_at']
119
122
  end
123
+
124
+ if attributes.key?(:'download_count')
125
+ self.download_count = attributes[:'download_count']
126
+ end
120
127
  end
121
128
 
122
129
  # Show invalid properties with the reasons. Usually used together with valid?
123
130
  # @return Array for valid properties with the reasons
124
131
  def list_invalid_properties
125
132
  invalid_properties = Array.new
133
+ if @deprecated.nil?
134
+ invalid_properties.push('invalid value for "deprecated", deprecated cannot be nil.')
135
+ end
136
+
126
137
  invalid_properties
127
138
  end
128
139
 
129
140
  # Check to see if the all the properties in the model are valid
130
141
  # @return true if the model is valid
131
142
  def valid?
143
+ return false if @deprecated.nil?
132
144
  true
133
145
  end
134
146
 
@@ -144,7 +156,8 @@ module PulpAnsibleClient
144
156
  versions_url == o.versions_url &&
145
157
  highest_version == o.highest_version &&
146
158
  created_at == o.created_at &&
147
- updated_at == o.updated_at
159
+ updated_at == o.updated_at &&
160
+ download_count == o.download_count
148
161
  end
149
162
 
150
163
  # @see the `==` method
@@ -156,7 +169,7 @@ module PulpAnsibleClient
156
169
  # Calculates hash code according to all attributes.
157
170
  # @return [Integer] Hash code
158
171
  def hash
159
- [href, namespace, name, deprecated, versions_url, highest_version, created_at, updated_at].hash
172
+ [href, namespace, name, deprecated, versions_url, highest_version, created_at, updated_at, download_count].hash
160
173
  end
161
174
 
162
175
  # Builds the object from hash
@@ -93,7 +93,7 @@ module PulpAnsibleClient
93
93
  :'download_url' => :'String',
94
94
  :'name' => :'String',
95
95
  :'namespace' => :'CollectionNamespaceResponse',
96
- :'signatures' => :'String',
96
+ :'signatures' => :'Array<CollectionVersionSignatureResponse>',
97
97
  :'metadata' => :'CollectionMetadataResponse',
98
98
  :'git_url' => :'String',
99
99
  :'git_commit_sha' => :'String',
@@ -171,7 +171,9 @@ module PulpAnsibleClient
171
171
  end
172
172
 
173
173
  if attributes.key?(:'signatures')
174
- self.signatures = attributes[:'signatures']
174
+ if (value = attributes[:'signatures']).is_a?(Array)
175
+ self.signatures = value
176
+ end
175
177
  end
176
178
 
177
179
  if attributes.key?(:'metadata')
@@ -211,6 +213,10 @@ module PulpAnsibleClient
211
213
  invalid_properties.push('invalid value for "requires_ansible", the character length must be smaller than or equal to 255.')
212
214
  end
213
215
 
216
+ if @signatures.nil?
217
+ invalid_properties.push('invalid value for "signatures", signatures cannot be nil.')
218
+ end
219
+
214
220
  invalid_properties
215
221
  end
216
222
 
@@ -220,6 +226,7 @@ module PulpAnsibleClient
220
226
  return false if @created_at.nil?
221
227
  return false if @updated_at.nil?
222
228
  return false if !@requires_ansible.nil? && @requires_ansible.to_s.length > 255
229
+ return false if @signatures.nil?
223
230
  true
224
231
  end
225
232
 
@@ -0,0 +1,259 @@
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 PulpAnsibleClient
16
+ # A serializer for the signatures on a Collection Version.
17
+ class CollectionVersionSignatureResponse
18
+ attr_accessor :signature
19
+
20
+ attr_accessor :pubkey_fingerprint
21
+
22
+ attr_accessor :signing_service
23
+
24
+ attr_accessor :pulp_created
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'signature' => :'signature',
30
+ :'pubkey_fingerprint' => :'pubkey_fingerprint',
31
+ :'signing_service' => :'signing_service',
32
+ :'pulp_created' => :'pulp_created'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'signature' => :'String',
40
+ :'pubkey_fingerprint' => :'String',
41
+ :'signing_service' => :'String',
42
+ :'pulp_created' => :'DateTime'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ :'signing_service',
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::CollectionVersionSignatureResponse` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::CollectionVersionSignatureResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'signature')
69
+ self.signature = attributes[:'signature']
70
+ end
71
+
72
+ if attributes.key?(:'pubkey_fingerprint')
73
+ self.pubkey_fingerprint = attributes[:'pubkey_fingerprint']
74
+ end
75
+
76
+ if attributes.key?(:'signing_service')
77
+ self.signing_service = attributes[:'signing_service']
78
+ end
79
+
80
+ if attributes.key?(:'pulp_created')
81
+ self.pulp_created = attributes[:'pulp_created']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @pubkey_fingerprint.nil?
90
+ invalid_properties.push('invalid value for "pubkey_fingerprint", pubkey_fingerprint cannot be nil.')
91
+ end
92
+
93
+ if @pubkey_fingerprint.to_s.length > 64
94
+ invalid_properties.push('invalid value for "pubkey_fingerprint", the character length must be smaller than or equal to 64.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @pubkey_fingerprint.nil?
104
+ return false if @pubkey_fingerprint.to_s.length > 64
105
+ true
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] pubkey_fingerprint Value to be assigned
110
+ def pubkey_fingerprint=(pubkey_fingerprint)
111
+ if pubkey_fingerprint.nil?
112
+ fail ArgumentError, 'pubkey_fingerprint cannot be nil'
113
+ end
114
+
115
+ if pubkey_fingerprint.to_s.length > 64
116
+ fail ArgumentError, 'invalid value for "pubkey_fingerprint", the character length must be smaller than or equal to 64.'
117
+ end
118
+
119
+ @pubkey_fingerprint = pubkey_fingerprint
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ signature == o.signature &&
128
+ pubkey_fingerprint == o.pubkey_fingerprint &&
129
+ signing_service == o.signing_service &&
130
+ pulp_created == o.pulp_created
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [signature, pubkey_fingerprint, signing_service, pulp_created].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end
@@ -0,0 +1,207 @@
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 PulpAnsibleClient
16
+ # A serializer for a Collection.
17
+ class PatchedCollection
18
+ attr_accessor :deprecated
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'deprecated' => :'deprecated'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'deprecated' => :'Boolean'
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 `PulpAnsibleClient::PatchedCollection` 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 `PulpAnsibleClient::PatchedCollection`. 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?(:'deprecated')
56
+ self.deprecated = attributes[:'deprecated']
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
+ invalid_properties
65
+ end
66
+
67
+ # Check to see if the all the properties in the model are valid
68
+ # @return true if the model is valid
69
+ def valid?
70
+ true
71
+ end
72
+
73
+ # Checks equality by comparing each attribute.
74
+ # @param [Object] Object to be compared
75
+ def ==(o)
76
+ return true if self.equal?(o)
77
+ self.class == o.class &&
78
+ deprecated == o.deprecated
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Integer] Hash code
89
+ def hash
90
+ [deprecated].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def self.build_from_hash(attributes)
97
+ new.build_from_hash(attributes)
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.openapi_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :Boolean
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
158
+ end
159
+ end
160
+
161
+ # Returns the string representation of the object
162
+ # @return [String] String presentation of the object
163
+ def to_s
164
+ to_hash.to_s
165
+ end
166
+
167
+ # to_body is an alias to to_hash (backward compatibility)
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_body
170
+ to_hash
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end