pulp_cookbook_client 0.1.0b9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +162 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContentCookbooksApi.md +208 -0
  7. data/docs/ContentSummary.md +21 -0
  8. data/docs/ContentSummaryResponse.md +21 -0
  9. data/docs/CookbookCookbookDistribution.md +27 -0
  10. data/docs/CookbookCookbookDistributionResponse.md +33 -0
  11. data/docs/CookbookCookbookPackageContent.md +25 -0
  12. data/docs/CookbookCookbookPackageContentResponse.md +29 -0
  13. data/docs/CookbookCookbookPublication.md +19 -0
  14. data/docs/CookbookCookbookPublicationResponse.md +25 -0
  15. data/docs/CookbookCookbookRemote.md +59 -0
  16. data/docs/CookbookCookbookRemoteResponse.md +55 -0
  17. data/docs/CookbookCookbookRepository.md +25 -0
  18. data/docs/CookbookCookbookRepositoryResponse.md +33 -0
  19. data/docs/DistributionsCookbookApi.md +372 -0
  20. data/docs/PaginatedRepositoryVersionResponseList.md +23 -0
  21. data/docs/PaginatedcookbookCookbookDistributionResponseList.md +23 -0
  22. data/docs/PaginatedcookbookCookbookPackageContentResponseList.md +23 -0
  23. data/docs/PaginatedcookbookCookbookPublicationResponseList.md +23 -0
  24. data/docs/PaginatedcookbookCookbookRemoteResponseList.md +23 -0
  25. data/docs/PaginatedcookbookCookbookRepositoryResponseList.md +23 -0
  26. data/docs/PatchedcookbookCookbookDistribution.md +27 -0
  27. data/docs/PatchedcookbookCookbookRemote.md +59 -0
  28. data/docs/PatchedcookbookCookbookRepository.md +25 -0
  29. data/docs/PolicyEnum.md +16 -0
  30. data/docs/PublicationsCookbookApi.md +257 -0
  31. data/docs/RemotesCookbookApi.md +376 -0
  32. data/docs/RepositoriesCookbookApi.md +475 -0
  33. data/docs/RepositoriesCookbookVersionsApi.md +271 -0
  34. data/docs/RepositoryAddRemoveContent.md +21 -0
  35. data/docs/RepositorySyncURL.md +19 -0
  36. data/docs/RepositoryVersion.md +17 -0
  37. data/docs/RepositoryVersionResponse.md +27 -0
  38. data/git_push.sh +58 -0
  39. data/lib/pulp_cookbook_client/api/content_cookbooks_api.rb +264 -0
  40. data/lib/pulp_cookbook_client/api/distributions_cookbook_api.rb +457 -0
  41. data/lib/pulp_cookbook_client/api/publications_cookbook_api.rb +312 -0
  42. data/lib/pulp_cookbook_client/api/remotes_cookbook_api.rb +463 -0
  43. data/lib/pulp_cookbook_client/api/repositories_cookbook_api.rb +583 -0
  44. data/lib/pulp_cookbook_client/api/repositories_cookbook_versions_api.rb +339 -0
  45. data/lib/pulp_cookbook_client/api_client.rb +406 -0
  46. data/lib/pulp_cookbook_client/api_error.rb +57 -0
  47. data/lib/pulp_cookbook_client/configuration.rb +250 -0
  48. data/lib/pulp_cookbook_client/models/async_operation_response.rb +213 -0
  49. data/lib/pulp_cookbook_client/models/content_summary.rb +246 -0
  50. data/lib/pulp_cookbook_client/models/content_summary_response.rb +246 -0
  51. data/lib/pulp_cookbook_client/models/cookbook_cookbook_distribution.rb +308 -0
  52. data/lib/pulp_cookbook_client/models/cookbook_cookbook_distribution_response.rb +299 -0
  53. data/lib/pulp_cookbook_client/models/cookbook_cookbook_package_content.rb +287 -0
  54. data/lib/pulp_cookbook_client/models/cookbook_cookbook_package_content_response.rb +272 -0
  55. data/lib/pulp_cookbook_client/models/cookbook_cookbook_publication.rb +217 -0
  56. data/lib/pulp_cookbook_client/models/cookbook_cookbook_publication_response.rb +248 -0
  57. data/lib/pulp_cookbook_client/models/cookbook_cookbook_remote.rb +677 -0
  58. data/lib/pulp_cookbook_client/models/cookbook_cookbook_remote_response.rb +493 -0
  59. data/lib/pulp_cookbook_client/models/cookbook_cookbook_repository.rb +304 -0
  60. data/lib/pulp_cookbook_client/models/cookbook_cookbook_repository_response.rb +307 -0
  61. data/lib/pulp_cookbook_client/models/paginated_repository_version_response_list.rb +237 -0
  62. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_distribution_response_list.rb +237 -0
  63. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_package_content_response_list.rb +237 -0
  64. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_publication_response_list.rb +237 -0
  65. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_remote_response_list.rb +237 -0
  66. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_repository_response_list.rb +237 -0
  67. data/lib/pulp_cookbook_client/models/patchedcookbook_cookbook_distribution.rb +290 -0
  68. data/lib/pulp_cookbook_client/models/patchedcookbook_cookbook_remote.rb +659 -0
  69. data/lib/pulp_cookbook_client/models/patchedcookbook_cookbook_repository.rb +295 -0
  70. data/lib/pulp_cookbook_client/models/policy_enum.rb +37 -0
  71. data/lib/pulp_cookbook_client/models/repository_add_remove_content.rb +232 -0
  72. data/lib/pulp_cookbook_client/models/repository_sync_url.rb +220 -0
  73. data/lib/pulp_cookbook_client/models/repository_version.rb +208 -0
  74. data/lib/pulp_cookbook_client/models/repository_version_response.rb +255 -0
  75. data/lib/pulp_cookbook_client/version.rb +15 -0
  76. data/lib/pulp_cookbook_client.rb +72 -0
  77. data/pulp_cookbook_client.gemspec +39 -0
  78. data/spec/api/content_cookbooks_api_spec.rb +87 -0
  79. data/spec/api/distributions_cookbook_api_spec.rb +125 -0
  80. data/spec/api/publications_cookbook_api_spec.rb +98 -0
  81. data/spec/api/remotes_cookbook_api_spec.rb +127 -0
  82. data/spec/api/repositories_cookbook_api_spec.rb +146 -0
  83. data/spec/api/repositories_cookbook_versions_api_spec.rb +104 -0
  84. data/spec/api_client_spec.rb +188 -0
  85. data/spec/configuration_spec.rb +42 -0
  86. data/spec/models/async_operation_response_spec.rb +41 -0
  87. data/spec/models/content_summary_response_spec.rb +53 -0
  88. data/spec/models/content_summary_spec.rb +53 -0
  89. data/spec/models/cookbook_cookbook_distribution_response_spec.rb +89 -0
  90. data/spec/models/cookbook_cookbook_distribution_spec.rb +71 -0
  91. data/spec/models/cookbook_cookbook_package_content_response_spec.rb +77 -0
  92. data/spec/models/cookbook_cookbook_package_content_spec.rb +65 -0
  93. data/spec/models/cookbook_cookbook_publication_response_spec.rb +65 -0
  94. data/spec/models/cookbook_cookbook_publication_spec.rb +47 -0
  95. data/spec/models/cookbook_cookbook_remote_response_spec.rb +155 -0
  96. data/spec/models/cookbook_cookbook_remote_spec.rb +167 -0
  97. data/spec/models/cookbook_cookbook_repository_response_spec.rb +89 -0
  98. data/spec/models/cookbook_cookbook_repository_spec.rb +65 -0
  99. data/spec/models/paginated_repository_version_response_list_spec.rb +59 -0
  100. data/spec/models/paginatedcookbook_cookbook_distribution_response_list_spec.rb +59 -0
  101. data/spec/models/paginatedcookbook_cookbook_package_content_response_list_spec.rb +59 -0
  102. data/spec/models/paginatedcookbook_cookbook_publication_response_list_spec.rb +59 -0
  103. data/spec/models/paginatedcookbook_cookbook_remote_response_list_spec.rb +59 -0
  104. data/spec/models/paginatedcookbook_cookbook_repository_response_list_spec.rb +59 -0
  105. data/spec/models/patchedcookbook_cookbook_distribution_spec.rb +71 -0
  106. data/spec/models/patchedcookbook_cookbook_remote_spec.rb +167 -0
  107. data/spec/models/patchedcookbook_cookbook_repository_spec.rb +65 -0
  108. data/spec/models/policy_enum_spec.rb +35 -0
  109. data/spec/models/repository_add_remove_content_spec.rb +53 -0
  110. data/spec/models/repository_sync_url_spec.rb +47 -0
  111. data/spec/models/repository_version_response_spec.rb +71 -0
  112. data/spec/models/repository_version_spec.rb +41 -0
  113. data/spec/spec_helper.rb +111 -0
  114. metadata +251 -0
@@ -0,0 +1,304 @@
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 PulpCookbookClient
16
+ # Serializer for Cookbook Repositories.
17
+ class CookbookCookbookRepository
18
+ attr_accessor :pulp_labels
19
+
20
+ # A unique name for this repository.
21
+ attr_accessor :name
22
+
23
+ # An optional description.
24
+ attr_accessor :description
25
+
26
+ # Retain X versions of the repository. Default is null which retains all versions. This is provided as a tech preview in Pulp 3 and may change in the future.
27
+ attr_accessor :retain_repo_versions
28
+
29
+ # An optional remote to use by default when syncing.
30
+ attr_accessor :remote
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'pulp_labels' => :'pulp_labels',
36
+ :'name' => :'name',
37
+ :'description' => :'description',
38
+ :'retain_repo_versions' => :'retain_repo_versions',
39
+ :'remote' => :'remote'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'pulp_labels' => :'Object',
47
+ :'name' => :'String',
48
+ :'description' => :'String',
49
+ :'retain_repo_versions' => :'Integer',
50
+ :'remote' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'description',
58
+ :'retain_repo_versions',
59
+ :'remote'
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpCookbookClient::CookbookCookbookRepository` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpCookbookClient::CookbookCookbookRepository`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'pulp_labels')
79
+ self.pulp_labels = attributes[:'pulp_labels']
80
+ end
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'description')
87
+ self.description = attributes[:'description']
88
+ end
89
+
90
+ if attributes.key?(:'retain_repo_versions')
91
+ self.retain_repo_versions = attributes[:'retain_repo_versions']
92
+ end
93
+
94
+ if attributes.key?(:'remote')
95
+ self.remote = attributes[:'remote']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @name.nil?
104
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
105
+ end
106
+
107
+ if @name.to_s.length < 1
108
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
109
+ end
110
+
111
+ if !@description.nil? && @description.to_s.length < 1
112
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
113
+ end
114
+
115
+ if !@retain_repo_versions.nil? && @retain_repo_versions < 1
116
+ invalid_properties.push('invalid value for "retain_repo_versions", must be greater than or equal to 1.')
117
+ end
118
+
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ return false if @name.nil?
126
+ return false if @name.to_s.length < 1
127
+ return false if !@description.nil? && @description.to_s.length < 1
128
+ return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] name Value to be assigned
134
+ def name=(name)
135
+ if name.nil?
136
+ fail ArgumentError, 'name cannot be nil'
137
+ end
138
+
139
+ if name.to_s.length < 1
140
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
141
+ end
142
+
143
+ @name = name
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] description Value to be assigned
148
+ def description=(description)
149
+ if !description.nil? && description.to_s.length < 1
150
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
151
+ end
152
+
153
+ @description = description
154
+ end
155
+
156
+ # Custom attribute writer method with validation
157
+ # @param [Object] retain_repo_versions Value to be assigned
158
+ def retain_repo_versions=(retain_repo_versions)
159
+ if !retain_repo_versions.nil? && retain_repo_versions < 1
160
+ fail ArgumentError, 'invalid value for "retain_repo_versions", must be greater than or equal to 1.'
161
+ end
162
+
163
+ @retain_repo_versions = retain_repo_versions
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ pulp_labels == o.pulp_labels &&
172
+ name == o.name &&
173
+ description == o.description &&
174
+ retain_repo_versions == o.retain_repo_versions &&
175
+ remote == o.remote
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [pulp_labels, name, description, retain_repo_versions, remote].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ new.build_from_hash(attributes)
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ self.class.openapi_types.each_pair do |key, type|
203
+ if type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
207
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
208
+ end
209
+ elsif !attributes[self.class.attribute_map[key]].nil?
210
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
211
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
212
+ end
213
+
214
+ self
215
+ end
216
+
217
+ # Deserializes the data based on type
218
+ # @param string type Data type
219
+ # @param string value Value to be deserialized
220
+ # @return [Object] Deserialized data
221
+ def _deserialize(type, value)
222
+ case type.to_sym
223
+ when :DateTime
224
+ DateTime.parse(value)
225
+ when :Date
226
+ Date.parse(value)
227
+ when :String
228
+ value.to_s
229
+ when :Integer
230
+ value.to_i
231
+ when :Float
232
+ value.to_f
233
+ when :Boolean
234
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
+ true
236
+ else
237
+ false
238
+ end
239
+ when :Object
240
+ # generic object (usually a Hash), return directly
241
+ value
242
+ when /\AArray<(?<inner_type>.+)>\z/
243
+ inner_type = Regexp.last_match[:inner_type]
244
+ value.map { |v| _deserialize(inner_type, v) }
245
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
+ k_type = Regexp.last_match[:k_type]
247
+ v_type = Regexp.last_match[:v_type]
248
+ {}.tap do |hash|
249
+ value.each do |k, v|
250
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
+ end
252
+ end
253
+ else # model
254
+ PulpCookbookClient.const_get(type).build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ if value.nil?
277
+ is_nullable = self.class.openapi_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value)
291
+ if value.is_a?(Array)
292
+ value.compact.map { |v| _to_hash(v) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash
299
+ else
300
+ value
301
+ end
302
+ end
303
+ end
304
+ end
@@ -0,0 +1,307 @@
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 PulpCookbookClient
16
+ # Serializer for Cookbook Repositories.
17
+ class CookbookCookbookRepositoryResponse
18
+ attr_accessor :pulp_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :pulp_created
22
+
23
+ attr_accessor :versions_href
24
+
25
+ attr_accessor :pulp_labels
26
+
27
+ attr_accessor :latest_version_href
28
+
29
+ # A unique name for this repository.
30
+ attr_accessor :name
31
+
32
+ # An optional description.
33
+ attr_accessor :description
34
+
35
+ # Retain X versions of the repository. Default is null which retains all versions. This is provided as a tech preview in Pulp 3 and may change in the future.
36
+ attr_accessor :retain_repo_versions
37
+
38
+ # An optional remote to use by default when syncing.
39
+ attr_accessor :remote
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'pulp_href' => :'pulp_href',
45
+ :'pulp_created' => :'pulp_created',
46
+ :'versions_href' => :'versions_href',
47
+ :'pulp_labels' => :'pulp_labels',
48
+ :'latest_version_href' => :'latest_version_href',
49
+ :'name' => :'name',
50
+ :'description' => :'description',
51
+ :'retain_repo_versions' => :'retain_repo_versions',
52
+ :'remote' => :'remote'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'pulp_href' => :'String',
60
+ :'pulp_created' => :'DateTime',
61
+ :'versions_href' => :'String',
62
+ :'pulp_labels' => :'Object',
63
+ :'latest_version_href' => :'String',
64
+ :'name' => :'String',
65
+ :'description' => :'String',
66
+ :'retain_repo_versions' => :'Integer',
67
+ :'remote' => :'String'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ :'description',
75
+ :'retain_repo_versions',
76
+ :'remote'
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpCookbookClient::CookbookCookbookRepositoryResponse` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpCookbookClient::CookbookCookbookRepositoryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'pulp_href')
96
+ self.pulp_href = attributes[:'pulp_href']
97
+ end
98
+
99
+ if attributes.key?(:'pulp_created')
100
+ self.pulp_created = attributes[:'pulp_created']
101
+ end
102
+
103
+ if attributes.key?(:'versions_href')
104
+ self.versions_href = attributes[:'versions_href']
105
+ end
106
+
107
+ if attributes.key?(:'pulp_labels')
108
+ self.pulp_labels = attributes[:'pulp_labels']
109
+ end
110
+
111
+ if attributes.key?(:'latest_version_href')
112
+ self.latest_version_href = attributes[:'latest_version_href']
113
+ end
114
+
115
+ if attributes.key?(:'name')
116
+ self.name = attributes[:'name']
117
+ end
118
+
119
+ if attributes.key?(:'description')
120
+ self.description = attributes[:'description']
121
+ end
122
+
123
+ if attributes.key?(:'retain_repo_versions')
124
+ self.retain_repo_versions = attributes[:'retain_repo_versions']
125
+ end
126
+
127
+ if attributes.key?(:'remote')
128
+ self.remote = attributes[:'remote']
129
+ end
130
+ end
131
+
132
+ # Show invalid properties with the reasons. Usually used together with valid?
133
+ # @return Array for valid properties with the reasons
134
+ def list_invalid_properties
135
+ invalid_properties = Array.new
136
+ if @name.nil?
137
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
138
+ end
139
+
140
+ if !@retain_repo_versions.nil? && @retain_repo_versions < 1
141
+ invalid_properties.push('invalid value for "retain_repo_versions", must be greater than or equal to 1.')
142
+ end
143
+
144
+ invalid_properties
145
+ end
146
+
147
+ # Check to see if the all the properties in the model are valid
148
+ # @return true if the model is valid
149
+ def valid?
150
+ return false if @name.nil?
151
+ return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] retain_repo_versions Value to be assigned
157
+ def retain_repo_versions=(retain_repo_versions)
158
+ if !retain_repo_versions.nil? && retain_repo_versions < 1
159
+ fail ArgumentError, 'invalid value for "retain_repo_versions", must be greater than or equal to 1.'
160
+ end
161
+
162
+ @retain_repo_versions = retain_repo_versions
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ pulp_href == o.pulp_href &&
171
+ pulp_created == o.pulp_created &&
172
+ versions_href == o.versions_href &&
173
+ pulp_labels == o.pulp_labels &&
174
+ latest_version_href == o.latest_version_href &&
175
+ name == o.name &&
176
+ description == o.description &&
177
+ retain_repo_versions == o.retain_repo_versions &&
178
+ remote == o.remote
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [pulp_href, pulp_created, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, remote].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ self.class.openapi_types.each_pair do |key, type|
206
+ if type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
210
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
211
+ end
212
+ elsif !attributes[self.class.attribute_map[key]].nil?
213
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
214
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
215
+ end
216
+
217
+ self
218
+ end
219
+
220
+ # Deserializes the data based on type
221
+ # @param string type Data type
222
+ # @param string value Value to be deserialized
223
+ # @return [Object] Deserialized data
224
+ def _deserialize(type, value)
225
+ case type.to_sym
226
+ when :DateTime
227
+ DateTime.parse(value)
228
+ when :Date
229
+ Date.parse(value)
230
+ when :String
231
+ value.to_s
232
+ when :Integer
233
+ value.to_i
234
+ when :Float
235
+ value.to_f
236
+ when :Boolean
237
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
+ true
239
+ else
240
+ false
241
+ end
242
+ when :Object
243
+ # generic object (usually a Hash), return directly
244
+ value
245
+ when /\AArray<(?<inner_type>.+)>\z/
246
+ inner_type = Regexp.last_match[:inner_type]
247
+ value.map { |v| _deserialize(inner_type, v) }
248
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
+ k_type = Regexp.last_match[:k_type]
250
+ v_type = Regexp.last_match[:v_type]
251
+ {}.tap do |hash|
252
+ value.each do |k, v|
253
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
+ end
255
+ end
256
+ else # model
257
+ PulpCookbookClient.const_get(type).build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+ end
307
+ end