pulp_ansible_client 0.2.0b12 → 0.2.0b13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -11
  3. data/docs/AnsibleAnsibleDistributionRead.md +31 -0
  4. data/docs/AnsibleAnsibleRemote.md +7 -3
  5. data/docs/AnsibleAnsibleRemoteRead.md +43 -0
  6. data/docs/AnsibleAnsibleRepositoryRead.md +27 -0
  7. data/docs/{AnsibleCollection.md → AnsibleCollectionRead.md} +2 -2
  8. data/docs/AnsibleCollectionRemote.md +7 -3
  9. data/docs/AnsibleCollectionRemoteRead.md +45 -0
  10. data/docs/AnsibleCollectionVersion.md +4 -4
  11. data/docs/AnsibleCollectionVersionRead.md +67 -0
  12. data/docs/AnsibleCollectionsApi.md +1 -1
  13. data/docs/AnsibleRole.md +4 -4
  14. data/docs/AnsibleRoleRead.md +27 -0
  15. data/docs/{CollectionImportDetail.md → CollectionImportDetailRead.md} +2 -2
  16. data/docs/CollectionRead.md +31 -0
  17. data/docs/CollectionVersionRead.md +37 -0
  18. data/docs/ContentCollectionVersionsApi.md +5 -5
  19. data/docs/ContentRolesApi.md +5 -5
  20. data/docs/DistributionsAnsibleApi.md +3 -3
  21. data/docs/GalaxyCollectionRead.md +23 -0
  22. data/docs/{GalaxyCollectionVersion.md → GalaxyCollectionVersionRead.md} +2 -2
  23. data/docs/{GalaxyRole.md → GalaxyRoleRead.md} +2 -2
  24. data/docs/{GalaxyRoleVersion.md → GalaxyRoleVersionRead.md} +2 -2
  25. data/docs/InlineResponse200.md +1 -1
  26. data/docs/InlineResponse2001.md +1 -1
  27. data/docs/InlineResponse20010.md +1 -1
  28. data/docs/InlineResponse20011.md +1 -1
  29. data/docs/InlineResponse20012.md +1 -1
  30. data/docs/InlineResponse20013.md +1 -1
  31. data/docs/InlineResponse2002.md +1 -1
  32. data/docs/InlineResponse2003.md +1 -1
  33. data/docs/InlineResponse2004.md +1 -1
  34. data/docs/InlineResponse2005.md +1 -1
  35. data/docs/InlineResponse2006.md +1 -1
  36. data/docs/InlineResponse2007.md +1 -1
  37. data/docs/InlineResponse2008.md +1 -1
  38. data/docs/InlineResponse2009.md +1 -1
  39. data/docs/PulpAnsibleApiApi.md +1 -1
  40. data/docs/PulpAnsibleGalaxyApiCollectionsApi.md +5 -5
  41. data/docs/PulpAnsibleGalaxyApiRolesApi.md +1 -1
  42. data/docs/PulpAnsibleGalaxyApiV1VersionsApi.md +1 -1
  43. data/docs/PulpAnsibleGalaxyApiV2VersionsApi.md +1 -1
  44. data/docs/PulpAnsibleGalaxyApiV3CollectionsApi.md +3 -3
  45. data/docs/PulpAnsibleTagsApi.md +1 -1
  46. data/docs/RemotesAnsibleApi.md +5 -5
  47. data/docs/RemotesCollectionApi.md +5 -5
  48. data/docs/RepositoriesAnsibleApi.md +10 -10
  49. data/docs/RepositoriesAnsibleVersionsApi.md +3 -3
  50. data/docs/RepositoryVersionRead.md +25 -0
  51. data/docs/{Tag.md → TagRead.md} +2 -2
  52. data/lib/pulp_ansible_client/api/content_collection_versions_api.rb +6 -6
  53. data/lib/pulp_ansible_client/api/content_roles_api.rb +6 -6
  54. data/lib/pulp_ansible_client/api/distributions_ansible_api.rb +3 -3
  55. data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_collections_api.rb +6 -6
  56. data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_v3_collections_api.rb +3 -3
  57. data/lib/pulp_ansible_client/api/remotes_ansible_api.rb +6 -6
  58. data/lib/pulp_ansible_client/api/remotes_collection_api.rb +6 -6
  59. data/lib/pulp_ansible_client/api/repositories_ansible_api.rb +15 -15
  60. data/lib/pulp_ansible_client/api/repositories_ansible_versions_api.rb +3 -3
  61. data/lib/pulp_ansible_client/configuration.rb +2 -2
  62. data/lib/pulp_ansible_client/models/ansible_ansible_distribution_read.rb +327 -0
  63. data/lib/pulp_ansible_client/models/ansible_ansible_remote.rb +56 -4
  64. data/lib/pulp_ansible_client/models/ansible_ansible_remote_read.rb +531 -0
  65. data/lib/pulp_ansible_client/models/ansible_ansible_repository_read.rb +294 -0
  66. data/lib/pulp_ansible_client/models/{ansible_collection.rb → ansible_collection_read.rb} +3 -3
  67. data/lib/pulp_ansible_client/models/ansible_collection_remote.rb +56 -4
  68. data/lib/pulp_ansible_client/models/ansible_collection_remote_read.rb +557 -0
  69. data/lib/pulp_ansible_client/models/ansible_collection_version.rb +35 -35
  70. data/lib/pulp_ansible_client/models/ansible_collection_version_read.rb +816 -0
  71. data/lib/pulp_ansible_client/models/ansible_role.rb +15 -15
  72. data/lib/pulp_ansible_client/models/ansible_role_read.rb +330 -0
  73. data/lib/pulp_ansible_client/models/{collection_import_detail.rb → collection_import_detail_read.rb} +3 -3
  74. data/lib/pulp_ansible_client/models/collection_read.rb +314 -0
  75. data/lib/pulp_ansible_client/models/collection_version_read.rb +370 -0
  76. data/lib/pulp_ansible_client/models/galaxy_collection_read.rb +281 -0
  77. data/lib/pulp_ansible_client/models/{galaxy_collection_version.rb → galaxy_collection_version_read.rb} +3 -3
  78. data/lib/pulp_ansible_client/models/{galaxy_role.rb → galaxy_role_read.rb} +3 -3
  79. data/lib/pulp_ansible_client/models/{galaxy_role_version.rb → galaxy_role_version_read.rb} +3 -3
  80. data/lib/pulp_ansible_client/models/inline_response200.rb +1 -1
  81. data/lib/pulp_ansible_client/models/inline_response2001.rb +1 -1
  82. data/lib/pulp_ansible_client/models/inline_response20010.rb +1 -1
  83. data/lib/pulp_ansible_client/models/inline_response20011.rb +1 -1
  84. data/lib/pulp_ansible_client/models/inline_response20012.rb +1 -1
  85. data/lib/pulp_ansible_client/models/inline_response20013.rb +1 -1
  86. data/lib/pulp_ansible_client/models/inline_response2002.rb +1 -1
  87. data/lib/pulp_ansible_client/models/inline_response2003.rb +1 -1
  88. data/lib/pulp_ansible_client/models/inline_response2004.rb +1 -1
  89. data/lib/pulp_ansible_client/models/inline_response2005.rb +1 -1
  90. data/lib/pulp_ansible_client/models/inline_response2006.rb +1 -1
  91. data/lib/pulp_ansible_client/models/inline_response2007.rb +1 -1
  92. data/lib/pulp_ansible_client/models/inline_response2008.rb +1 -1
  93. data/lib/pulp_ansible_client/models/inline_response2009.rb +1 -1
  94. data/lib/pulp_ansible_client/models/repository_version_read.rb +244 -0
  95. data/lib/pulp_ansible_client/models/{tag.rb → tag_read.rb} +3 -3
  96. data/lib/pulp_ansible_client/version.rb +1 -1
  97. data/lib/pulp_ansible_client.rb +16 -6
  98. data/spec/api/content_collection_versions_api_spec.rb +2 -2
  99. data/spec/api/content_roles_api_spec.rb +2 -2
  100. data/spec/api/distributions_ansible_api_spec.rb +1 -1
  101. data/spec/api/pulp_ansible_galaxy_api_collections_api_spec.rb +2 -2
  102. data/spec/api/pulp_ansible_galaxy_api_v3_collections_api_spec.rb +1 -1
  103. data/spec/api/remotes_ansible_api_spec.rb +2 -2
  104. data/spec/api/remotes_collection_api_spec.rb +2 -2
  105. data/spec/api/repositories_ansible_api_spec.rb +6 -6
  106. data/spec/api/repositories_ansible_versions_api_spec.rb +1 -1
  107. data/spec/configuration_spec.rb +3 -3
  108. data/spec/models/ansible_ansible_distribution_read_spec.rb +83 -0
  109. data/spec/models/ansible_ansible_remote_read_spec.rb +123 -0
  110. data/spec/models/ansible_ansible_remote_spec.rb +12 -0
  111. data/spec/models/ansible_ansible_repository_read_spec.rb +71 -0
  112. data/spec/models/{ansible_collection_spec.rb → ansible_collection_read_spec.rb} +6 -6
  113. data/spec/models/ansible_collection_remote_read_spec.rb +129 -0
  114. data/spec/models/ansible_collection_remote_spec.rb +12 -0
  115. data/spec/models/ansible_collection_version_read_spec.rb +191 -0
  116. data/spec/models/ansible_collection_version_spec.rb +2 -2
  117. data/spec/models/ansible_role_read_spec.rb +71 -0
  118. data/spec/models/ansible_role_spec.rb +2 -2
  119. data/spec/models/{collection_import_detail_spec.rb → collection_import_detail_read_spec.rb} +6 -6
  120. data/spec/models/collection_read_spec.rb +83 -0
  121. data/spec/models/collection_version_read_spec.rb +105 -0
  122. data/spec/models/galaxy_collection_read_spec.rb +59 -0
  123. data/spec/models/{galaxy_collection_version_spec.rb → galaxy_collection_version_read_spec.rb} +6 -6
  124. data/spec/models/{galaxy_role_spec.rb → galaxy_role_read_spec.rb} +6 -6
  125. data/spec/models/{galaxy_role_version_spec.rb → galaxy_role_version_read_spec.rb} +6 -6
  126. data/spec/models/repository_version_read_spec.rb +65 -0
  127. data/spec/models/{tag_spec.rb → tag_read_spec.rb} +6 -6
  128. metadata +66 -26
@@ -0,0 +1,314 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ class CollectionRead
17
+ attr_accessor :href
18
+
19
+ attr_accessor :created_at
20
+
21
+ attr_accessor :updated_at
22
+
23
+ attr_accessor :namespace
24
+
25
+ attr_accessor :name
26
+
27
+ attr_accessor :deprecated
28
+
29
+ attr_accessor :versions_url
30
+
31
+ attr_accessor :highest_version
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'href' => :'href',
37
+ :'created_at' => :'created_at',
38
+ :'updated_at' => :'updated_at',
39
+ :'namespace' => :'namespace',
40
+ :'name' => :'name',
41
+ :'deprecated' => :'deprecated',
42
+ :'versions_url' => :'versions_url',
43
+ :'highest_version' => :'highest_version'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'href' => :'String',
51
+ :'created_at' => :'DateTime',
52
+ :'updated_at' => :'DateTime',
53
+ :'namespace' => :'String',
54
+ :'name' => :'String',
55
+ :'deprecated' => :'Boolean',
56
+ :'versions_url' => :'String',
57
+ :'highest_version' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::CollectionRead` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::CollectionRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'href')
83
+ self.href = attributes[:'href']
84
+ end
85
+
86
+ if attributes.key?(:'created_at')
87
+ self.created_at = attributes[:'created_at']
88
+ end
89
+
90
+ if attributes.key?(:'updated_at')
91
+ self.updated_at = attributes[:'updated_at']
92
+ end
93
+
94
+ if attributes.key?(:'namespace')
95
+ self.namespace = attributes[:'namespace']
96
+ end
97
+
98
+ if attributes.key?(:'name')
99
+ self.name = attributes[:'name']
100
+ end
101
+
102
+ if attributes.key?(:'deprecated')
103
+ self.deprecated = attributes[:'deprecated']
104
+ end
105
+
106
+ if attributes.key?(:'versions_url')
107
+ self.versions_url = attributes[:'versions_url']
108
+ end
109
+
110
+ if attributes.key?(:'highest_version')
111
+ self.highest_version = attributes[:'highest_version']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @created_at.nil?
120
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
121
+ end
122
+
123
+ if @updated_at.nil?
124
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
125
+ end
126
+
127
+ if !@namespace.nil? && @namespace.to_s.length < 1
128
+ invalid_properties.push('invalid value for "namespace", the character length must be great than or equal to 1.')
129
+ end
130
+
131
+ if !@name.nil? && @name.to_s.length < 1
132
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
133
+ end
134
+
135
+ if @deprecated.nil?
136
+ invalid_properties.push('invalid value for "deprecated", deprecated cannot be nil.')
137
+ end
138
+
139
+ invalid_properties
140
+ end
141
+
142
+ # Check to see if the all the properties in the model are valid
143
+ # @return true if the model is valid
144
+ def valid?
145
+ return false if @created_at.nil?
146
+ return false if @updated_at.nil?
147
+ return false if !@namespace.nil? && @namespace.to_s.length < 1
148
+ return false if !@name.nil? && @name.to_s.length < 1
149
+ return false if @deprecated.nil?
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] namespace Value to be assigned
155
+ def namespace=(namespace)
156
+ if !namespace.nil? && namespace.to_s.length < 1
157
+ fail ArgumentError, 'invalid value for "namespace", the character length must be great than or equal to 1.'
158
+ end
159
+
160
+ @namespace = namespace
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] name Value to be assigned
165
+ def name=(name)
166
+ if !name.nil? && name.to_s.length < 1
167
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
168
+ end
169
+
170
+ @name = name
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ href == o.href &&
179
+ created_at == o.created_at &&
180
+ updated_at == o.updated_at &&
181
+ namespace == o.namespace &&
182
+ name == o.name &&
183
+ deprecated == o.deprecated &&
184
+ versions_url == o.versions_url &&
185
+ highest_version == o.highest_version
186
+ end
187
+
188
+ # @see the `==` method
189
+ # @param [Object] Object to be compared
190
+ def eql?(o)
191
+ self == o
192
+ end
193
+
194
+ # Calculates hash code according to all attributes.
195
+ # @return [Integer] Hash code
196
+ def hash
197
+ [href, created_at, updated_at, namespace, name, deprecated, versions_url, highest_version].hash
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def self.build_from_hash(attributes)
204
+ new.build_from_hash(attributes)
205
+ end
206
+
207
+ # Builds the object from hash
208
+ # @param [Hash] attributes Model attributes in the form of hash
209
+ # @return [Object] Returns the model itself
210
+ def build_from_hash(attributes)
211
+ return nil unless attributes.is_a?(Hash)
212
+ self.class.openapi_types.each_pair do |key, type|
213
+ if type =~ /\AArray<(.*)>/i
214
+ # check to ensure the input is an array given that the attribute
215
+ # is documented as an array but the input is not
216
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
217
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
218
+ end
219
+ elsif !attributes[self.class.attribute_map[key]].nil?
220
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
221
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
222
+ end
223
+
224
+ self
225
+ end
226
+
227
+ # Deserializes the data based on type
228
+ # @param string type Data type
229
+ # @param string value Value to be deserialized
230
+ # @return [Object] Deserialized data
231
+ def _deserialize(type, value)
232
+ case type.to_sym
233
+ when :DateTime
234
+ DateTime.parse(value)
235
+ when :Date
236
+ Date.parse(value)
237
+ when :String
238
+ value.to_s
239
+ when :Integer
240
+ value.to_i
241
+ when :Float
242
+ value.to_f
243
+ when :Boolean
244
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
245
+ true
246
+ else
247
+ false
248
+ end
249
+ when :Object
250
+ # generic object (usually a Hash), return directly
251
+ value
252
+ when /\AArray<(?<inner_type>.+)>\z/
253
+ inner_type = Regexp.last_match[:inner_type]
254
+ value.map { |v| _deserialize(inner_type, v) }
255
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
256
+ k_type = Regexp.last_match[:k_type]
257
+ v_type = Regexp.last_match[:v_type]
258
+ {}.tap do |hash|
259
+ value.each do |k, v|
260
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
261
+ end
262
+ end
263
+ else # model
264
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
265
+ end
266
+ end
267
+
268
+ # Returns the string representation of the object
269
+ # @return [String] String presentation of the object
270
+ def to_s
271
+ to_hash.to_s
272
+ end
273
+
274
+ # to_body is an alias to to_hash (backward compatibility)
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_body
277
+ to_hash
278
+ end
279
+
280
+ # Returns the object in the form of hash
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_hash
283
+ hash = {}
284
+ self.class.attribute_map.each_pair do |attr, param|
285
+ value = self.send(attr)
286
+ if value.nil?
287
+ is_nullable = self.class.openapi_nullable.include?(attr)
288
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
289
+ end
290
+
291
+ hash[param] = _to_hash(value)
292
+ end
293
+ hash
294
+ end
295
+
296
+ # Outputs non-array value in the form of hash
297
+ # For object, use to_hash. Otherwise, just return the value
298
+ # @param [Object] value Any valid value
299
+ # @return [Hash] Returns the value in the form of hash
300
+ def _to_hash(value)
301
+ if value.is_a?(Array)
302
+ value.compact.map { |v| _to_hash(v) }
303
+ elsif value.is_a?(Hash)
304
+ {}.tap do |hash|
305
+ value.each { |k, v| hash[k] = _to_hash(v) }
306
+ end
307
+ elsif value.respond_to? :to_hash
308
+ value.to_hash
309
+ else
310
+ value
311
+ end
312
+ end
313
+ end
314
+ end
@@ -0,0 +1,370 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ class CollectionVersionRead
17
+ attr_accessor :version
18
+
19
+ attr_accessor :certification
20
+
21
+ attr_accessor :href
22
+
23
+ attr_accessor :created_at
24
+
25
+ attr_accessor :updated_at
26
+
27
+ attr_accessor :artifact
28
+
29
+ attr_accessor :collection
30
+
31
+ attr_accessor :download_url
32
+
33
+ attr_accessor :name
34
+
35
+ attr_accessor :namespace
36
+
37
+ attr_accessor :metadata
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'version' => :'version',
65
+ :'certification' => :'certification',
66
+ :'href' => :'href',
67
+ :'created_at' => :'created_at',
68
+ :'updated_at' => :'updated_at',
69
+ :'artifact' => :'artifact',
70
+ :'collection' => :'collection',
71
+ :'download_url' => :'download_url',
72
+ :'name' => :'name',
73
+ :'namespace' => :'namespace',
74
+ :'metadata' => :'metadata'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'version' => :'String',
82
+ :'certification' => :'String',
83
+ :'href' => :'String',
84
+ :'created_at' => :'DateTime',
85
+ :'updated_at' => :'DateTime',
86
+ :'artifact' => :'String',
87
+ :'collection' => :'CollectionRef',
88
+ :'download_url' => :'String',
89
+ :'name' => :'String',
90
+ :'namespace' => :'CollectionNamespace',
91
+ :'metadata' => :'CollectionMetadata'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::CollectionVersionRead` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::CollectionVersionRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'version')
117
+ self.version = attributes[:'version']
118
+ end
119
+
120
+ if attributes.key?(:'certification')
121
+ self.certification = attributes[:'certification']
122
+ end
123
+
124
+ if attributes.key?(:'href')
125
+ self.href = attributes[:'href']
126
+ end
127
+
128
+ if attributes.key?(:'created_at')
129
+ self.created_at = attributes[:'created_at']
130
+ end
131
+
132
+ if attributes.key?(:'updated_at')
133
+ self.updated_at = attributes[:'updated_at']
134
+ end
135
+
136
+ if attributes.key?(:'artifact')
137
+ self.artifact = attributes[:'artifact']
138
+ end
139
+
140
+ if attributes.key?(:'collection')
141
+ self.collection = attributes[:'collection']
142
+ end
143
+
144
+ if attributes.key?(:'download_url')
145
+ self.download_url = attributes[:'download_url']
146
+ end
147
+
148
+ if attributes.key?(:'name')
149
+ self.name = attributes[:'name']
150
+ end
151
+
152
+ if attributes.key?(:'namespace')
153
+ self.namespace = attributes[:'namespace']
154
+ end
155
+
156
+ if attributes.key?(:'metadata')
157
+ self.metadata = attributes[:'metadata']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ if !@version.nil? && @version.to_s.length < 1
166
+ invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
167
+ end
168
+
169
+ if @created_at.nil?
170
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
171
+ end
172
+
173
+ if @updated_at.nil?
174
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
175
+ end
176
+
177
+ if !@name.nil? && @name.to_s.length < 1
178
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
179
+ end
180
+
181
+ invalid_properties
182
+ end
183
+
184
+ # Check to see if the all the properties in the model are valid
185
+ # @return true if the model is valid
186
+ def valid?
187
+ return false if !@version.nil? && @version.to_s.length < 1
188
+ certification_validator = EnumAttributeValidator.new('String', ["certified", "not_certified", "needs_review"])
189
+ return false unless certification_validator.valid?(@certification)
190
+ return false if @created_at.nil?
191
+ return false if @updated_at.nil?
192
+ return false if !@name.nil? && @name.to_s.length < 1
193
+ true
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] version Value to be assigned
198
+ def version=(version)
199
+ if !version.nil? && version.to_s.length < 1
200
+ fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
201
+ end
202
+
203
+ @version = version
204
+ end
205
+
206
+ # Custom attribute writer method checking allowed values (enum).
207
+ # @param [Object] certification Object to be assigned
208
+ def certification=(certification)
209
+ validator = EnumAttributeValidator.new('String', ["certified", "not_certified", "needs_review"])
210
+ unless validator.valid?(certification)
211
+ fail ArgumentError, "invalid value for \"certification\", must be one of #{validator.allowable_values}."
212
+ end
213
+ @certification = certification
214
+ end
215
+
216
+ # Custom attribute writer method with validation
217
+ # @param [Object] name Value to be assigned
218
+ def name=(name)
219
+ if !name.nil? && name.to_s.length < 1
220
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
221
+ end
222
+
223
+ @name = name
224
+ end
225
+
226
+ # Checks equality by comparing each attribute.
227
+ # @param [Object] Object to be compared
228
+ def ==(o)
229
+ return true if self.equal?(o)
230
+ self.class == o.class &&
231
+ version == o.version &&
232
+ certification == o.certification &&
233
+ href == o.href &&
234
+ created_at == o.created_at &&
235
+ updated_at == o.updated_at &&
236
+ artifact == o.artifact &&
237
+ collection == o.collection &&
238
+ download_url == o.download_url &&
239
+ name == o.name &&
240
+ namespace == o.namespace &&
241
+ metadata == o.metadata
242
+ end
243
+
244
+ # @see the `==` method
245
+ # @param [Object] Object to be compared
246
+ def eql?(o)
247
+ self == o
248
+ end
249
+
250
+ # Calculates hash code according to all attributes.
251
+ # @return [Integer] Hash code
252
+ def hash
253
+ [version, certification, href, created_at, updated_at, artifact, collection, download_url, name, namespace, metadata].hash
254
+ end
255
+
256
+ # Builds the object from hash
257
+ # @param [Hash] attributes Model attributes in the form of hash
258
+ # @return [Object] Returns the model itself
259
+ def self.build_from_hash(attributes)
260
+ new.build_from_hash(attributes)
261
+ end
262
+
263
+ # Builds the object from hash
264
+ # @param [Hash] attributes Model attributes in the form of hash
265
+ # @return [Object] Returns the model itself
266
+ def build_from_hash(attributes)
267
+ return nil unless attributes.is_a?(Hash)
268
+ self.class.openapi_types.each_pair do |key, type|
269
+ if type =~ /\AArray<(.*)>/i
270
+ # check to ensure the input is an array given that the attribute
271
+ # is documented as an array but the input is not
272
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
273
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
274
+ end
275
+ elsif !attributes[self.class.attribute_map[key]].nil?
276
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
277
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
278
+ end
279
+
280
+ self
281
+ end
282
+
283
+ # Deserializes the data based on type
284
+ # @param string type Data type
285
+ # @param string value Value to be deserialized
286
+ # @return [Object] Deserialized data
287
+ def _deserialize(type, value)
288
+ case type.to_sym
289
+ when :DateTime
290
+ DateTime.parse(value)
291
+ when :Date
292
+ Date.parse(value)
293
+ when :String
294
+ value.to_s
295
+ when :Integer
296
+ value.to_i
297
+ when :Float
298
+ value.to_f
299
+ when :Boolean
300
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
301
+ true
302
+ else
303
+ false
304
+ end
305
+ when :Object
306
+ # generic object (usually a Hash), return directly
307
+ value
308
+ when /\AArray<(?<inner_type>.+)>\z/
309
+ inner_type = Regexp.last_match[:inner_type]
310
+ value.map { |v| _deserialize(inner_type, v) }
311
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
312
+ k_type = Regexp.last_match[:k_type]
313
+ v_type = Regexp.last_match[:v_type]
314
+ {}.tap do |hash|
315
+ value.each do |k, v|
316
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
317
+ end
318
+ end
319
+ else # model
320
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
321
+ end
322
+ end
323
+
324
+ # Returns the string representation of the object
325
+ # @return [String] String presentation of the object
326
+ def to_s
327
+ to_hash.to_s
328
+ end
329
+
330
+ # to_body is an alias to to_hash (backward compatibility)
331
+ # @return [Hash] Returns the object in the form of hash
332
+ def to_body
333
+ to_hash
334
+ end
335
+
336
+ # Returns the object in the form of hash
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_hash
339
+ hash = {}
340
+ self.class.attribute_map.each_pair do |attr, param|
341
+ value = self.send(attr)
342
+ if value.nil?
343
+ is_nullable = self.class.openapi_nullable.include?(attr)
344
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
345
+ end
346
+
347
+ hash[param] = _to_hash(value)
348
+ end
349
+ hash
350
+ end
351
+
352
+ # Outputs non-array value in the form of hash
353
+ # For object, use to_hash. Otherwise, just return the value
354
+ # @param [Object] value Any valid value
355
+ # @return [Hash] Returns the value in the form of hash
356
+ def _to_hash(value)
357
+ if value.is_a?(Array)
358
+ value.compact.map { |v| _to_hash(v) }
359
+ elsif value.is_a?(Hash)
360
+ {}.tap do |hash|
361
+ value.each { |k, v| hash[k] = _to_hash(v) }
362
+ end
363
+ elsif value.respond_to? :to_hash
364
+ value.to_hash
365
+ else
366
+ value
367
+ end
368
+ end
369
+ end
370
+ end