pulp_deb_client 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -16
  3. data/docs/AcsDebApi.md +886 -0
  4. data/docs/DebAptAlternateContentSource.md +24 -0
  5. data/docs/DebAptAlternateContentSourceResponse.md +32 -0
  6. data/docs/DebAptRepository.md +2 -0
  7. data/docs/DebAptRepositoryResponse.md +2 -0
  8. data/docs/DistributionsAptApi.md +10 -10
  9. data/docs/PaginateddebAptAlternateContentSourceResponseList.md +24 -0
  10. data/docs/PatcheddebAptAlternateContentSource.md +24 -0
  11. data/docs/PatcheddebAptRepository.md +2 -0
  12. data/docs/RemotesAptApi.md +10 -10
  13. data/docs/RepositoriesAptApi.md +10 -10
  14. data/docs/TaskGroupOperationResponse.md +18 -0
  15. data/lib/pulp_deb_client/api/acs_deb_api.rb +865 -0
  16. data/lib/pulp_deb_client/api/distributions_apt_api.rb +10 -10
  17. data/lib/pulp_deb_client/api/remotes_apt_api.rb +10 -10
  18. data/lib/pulp_deb_client/api/repositories_apt_api.rb +10 -10
  19. data/lib/pulp_deb_client/models/deb_apt_alternate_content_source.rb +282 -0
  20. data/lib/pulp_deb_client/models/deb_apt_alternate_content_source_response.rb +302 -0
  21. data/lib/pulp_deb_client/models/deb_apt_repository.rb +13 -1
  22. data/lib/pulp_deb_client/models/deb_apt_repository_response.rb +13 -1
  23. data/lib/pulp_deb_client/models/paginateddeb_apt_alternate_content_source_response_list.rb +257 -0
  24. data/lib/pulp_deb_client/models/patcheddeb_apt_alternate_content_source.rb +268 -0
  25. data/lib/pulp_deb_client/models/patcheddeb_apt_repository.rb +13 -1
  26. data/lib/pulp_deb_client/models/task_group_operation_response.rb +223 -0
  27. data/lib/pulp_deb_client/version.rb +1 -1
  28. data/lib/pulp_deb_client.rb +6 -0
  29. data/spec/api/acs_deb_api_spec.rb +204 -0
  30. data/spec/api/distributions_apt_api_spec.rb +4 -4
  31. data/spec/api/remotes_apt_api_spec.rb +4 -4
  32. data/spec/api/repositories_apt_api_spec.rb +4 -4
  33. data/spec/models/deb_apt_alternate_content_source_response_spec.rb +78 -0
  34. data/spec/models/deb_apt_alternate_content_source_spec.rb +54 -0
  35. data/spec/models/deb_apt_repository_response_spec.rb +6 -0
  36. data/spec/models/deb_apt_repository_spec.rb +6 -0
  37. data/spec/models/paginateddeb_apt_alternate_content_source_response_list_spec.rb +54 -0
  38. data/spec/models/patcheddeb_apt_alternate_content_source_spec.rb +54 -0
  39. data/spec/models/patcheddeb_apt_repository_spec.rb +6 -0
  40. data/spec/models/task_group_operation_response_spec.rb +36 -0
  41. metadata +97 -73
@@ -0,0 +1,302 @@
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
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpDebClient
17
+ # Serializer for APT alternate content source.
18
+ class DebAptAlternateContentSourceResponse
19
+ attr_accessor :pulp_href
20
+
21
+ # The Pulp Resource Name (PRN).
22
+ attr_accessor :prn
23
+
24
+ # Timestamp of creation.
25
+ attr_accessor :pulp_created
26
+
27
+ # Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.
28
+ attr_accessor :pulp_last_updated
29
+
30
+ # Name of Alternate Content Source.
31
+ attr_accessor :name
32
+
33
+ # Date of last refresh of AlternateContentSource.
34
+ attr_accessor :last_refreshed
35
+
36
+ # List of paths that will be appended to the Remote url when searching for content.
37
+ attr_accessor :paths
38
+
39
+ # The remote to provide alternate content source.
40
+ attr_accessor :remote
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'pulp_href' => :'pulp_href',
46
+ :'prn' => :'prn',
47
+ :'pulp_created' => :'pulp_created',
48
+ :'pulp_last_updated' => :'pulp_last_updated',
49
+ :'name' => :'name',
50
+ :'last_refreshed' => :'last_refreshed',
51
+ :'paths' => :'paths',
52
+ :'remote' => :'remote'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'pulp_href' => :'String',
65
+ :'prn' => :'String',
66
+ :'pulp_created' => :'Time',
67
+ :'pulp_last_updated' => :'Time',
68
+ :'name' => :'String',
69
+ :'last_refreshed' => :'Time',
70
+ :'paths' => :'Array<String>',
71
+ :'remote' => :'String'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ :'last_refreshed',
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::DebAptAlternateContentSourceResponse` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::DebAptAlternateContentSourceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'pulp_href')
98
+ self.pulp_href = attributes[:'pulp_href']
99
+ end
100
+
101
+ if attributes.key?(:'prn')
102
+ self.prn = attributes[:'prn']
103
+ end
104
+
105
+ if attributes.key?(:'pulp_created')
106
+ self.pulp_created = attributes[:'pulp_created']
107
+ end
108
+
109
+ if attributes.key?(:'pulp_last_updated')
110
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
111
+ end
112
+
113
+ if attributes.key?(:'name')
114
+ self.name = attributes[:'name']
115
+ else
116
+ self.name = nil
117
+ end
118
+
119
+ if attributes.key?(:'last_refreshed')
120
+ self.last_refreshed = attributes[:'last_refreshed']
121
+ end
122
+
123
+ if attributes.key?(:'paths')
124
+ if (value = attributes[:'paths']).is_a?(Array)
125
+ self.paths = value
126
+ end
127
+ end
128
+
129
+ if attributes.key?(:'remote')
130
+ self.remote = attributes[:'remote']
131
+ else
132
+ self.remote = nil
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
140
+ invalid_properties = Array.new
141
+ if @name.nil?
142
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
143
+ end
144
+
145
+ if @remote.nil?
146
+ invalid_properties.push('invalid value for "remote", remote cannot be nil.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @name.nil?
157
+ return false if @remote.nil?
158
+ true
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ pulp_href == o.pulp_href &&
167
+ prn == o.prn &&
168
+ pulp_created == o.pulp_created &&
169
+ pulp_last_updated == o.pulp_last_updated &&
170
+ name == o.name &&
171
+ last_refreshed == o.last_refreshed &&
172
+ paths == o.paths &&
173
+ remote == o.remote
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [pulp_href, prn, pulp_created, pulp_last_updated, name, last_refreshed, paths, remote].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ transformed_hash = {}
195
+ openapi_types.each_pair do |key, type|
196
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = nil
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[attribute_map[key]].is_a?(Array)
202
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
203
+ end
204
+ elsif !attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
206
+ end
207
+ end
208
+ new(transformed_hash)
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def self._deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = PulpDebClient.const_get(type)
250
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -30,6 +30,9 @@ module PulpDebClient
30
30
  # An optional remote to use by default when syncing.
31
31
  attr_accessor :remote
32
32
 
33
+ # Whether to automatically create publications for new repository versions, and update any distributions pointing to this repository. Will create a standard structured APT publication.
34
+ attr_accessor :autopublish
35
+
33
36
  # Previously, pulp_deb only synced the Release file fields codename and suite, now version, origin, label, and description are also synced. Setting this setting to False will make Pulp revert to the old behaviour of using it's own internal values for the new fields during publish. This is primarily intended to avoid a sudden change in behaviour for existing Pulp repositories, since many Release file field changes need to be accepted by hosts consuming the published repository. The default for new repositories is True.
34
37
  attr_accessor :publish_upstream_release_fields
35
38
 
@@ -47,6 +50,7 @@ module PulpDebClient
47
50
  :'description' => :'description',
48
51
  :'retain_repo_versions' => :'retain_repo_versions',
49
52
  :'remote' => :'remote',
53
+ :'autopublish' => :'autopublish',
50
54
  :'publish_upstream_release_fields' => :'publish_upstream_release_fields',
51
55
  :'signing_service' => :'signing_service',
52
56
  :'signing_service_release_overrides' => :'signing_service_release_overrides'
@@ -66,6 +70,7 @@ module PulpDebClient
66
70
  :'description' => :'String',
67
71
  :'retain_repo_versions' => :'Integer',
68
72
  :'remote' => :'String',
73
+ :'autopublish' => :'Boolean',
69
74
  :'publish_upstream_release_fields' => :'Boolean',
70
75
  :'signing_service' => :'String',
71
76
  :'signing_service_release_overrides' => :'Hash<String, String>'
@@ -121,6 +126,12 @@ module PulpDebClient
121
126
  self.remote = attributes[:'remote']
122
127
  end
123
128
 
129
+ if attributes.key?(:'autopublish')
130
+ self.autopublish = attributes[:'autopublish']
131
+ else
132
+ self.autopublish = false
133
+ end
134
+
124
135
  if attributes.key?(:'publish_upstream_release_fields')
125
136
  self.publish_upstream_release_fields = attributes[:'publish_upstream_release_fields']
126
137
  end
@@ -200,6 +211,7 @@ module PulpDebClient
200
211
  description == o.description &&
201
212
  retain_repo_versions == o.retain_repo_versions &&
202
213
  remote == o.remote &&
214
+ autopublish == o.autopublish &&
203
215
  publish_upstream_release_fields == o.publish_upstream_release_fields &&
204
216
  signing_service == o.signing_service &&
205
217
  signing_service_release_overrides == o.signing_service_release_overrides
@@ -214,7 +226,7 @@ module PulpDebClient
214
226
  # Calculates hash code according to all attributes.
215
227
  # @return [Integer] Hash code
216
228
  def hash
217
- [pulp_labels, name, description, retain_repo_versions, remote, publish_upstream_release_fields, signing_service, signing_service_release_overrides].hash
229
+ [pulp_labels, name, description, retain_repo_versions, remote, autopublish, publish_upstream_release_fields, signing_service, signing_service_release_overrides].hash
218
230
  end
219
231
 
220
232
  # Builds the object from hash
@@ -45,6 +45,9 @@ module PulpDebClient
45
45
  # An optional remote to use by default when syncing.
46
46
  attr_accessor :remote
47
47
 
48
+ # Whether to automatically create publications for new repository versions, and update any distributions pointing to this repository. Will create a standard structured APT publication.
49
+ attr_accessor :autopublish
50
+
48
51
  # Previously, pulp_deb only synced the Release file fields codename and suite, now version, origin, label, and description are also synced. Setting this setting to False will make Pulp revert to the old behaviour of using it's own internal values for the new fields during publish. This is primarily intended to avoid a sudden change in behaviour for existing Pulp repositories, since many Release file field changes need to be accepted by hosts consuming the published repository. The default for new repositories is True.
49
52
  attr_accessor :publish_upstream_release_fields
50
53
 
@@ -68,6 +71,7 @@ module PulpDebClient
68
71
  :'description' => :'description',
69
72
  :'retain_repo_versions' => :'retain_repo_versions',
70
73
  :'remote' => :'remote',
74
+ :'autopublish' => :'autopublish',
71
75
  :'publish_upstream_release_fields' => :'publish_upstream_release_fields',
72
76
  :'signing_service' => :'signing_service',
73
77
  :'signing_service_release_overrides' => :'signing_service_release_overrides'
@@ -93,6 +97,7 @@ module PulpDebClient
93
97
  :'description' => :'String',
94
98
  :'retain_repo_versions' => :'Integer',
95
99
  :'remote' => :'String',
100
+ :'autopublish' => :'Boolean',
96
101
  :'publish_upstream_release_fields' => :'Boolean',
97
102
  :'signing_service' => :'String',
98
103
  :'signing_service_release_overrides' => :'Hash<String, String>'
@@ -172,6 +177,12 @@ module PulpDebClient
172
177
  self.remote = attributes[:'remote']
173
178
  end
174
179
 
180
+ if attributes.key?(:'autopublish')
181
+ self.autopublish = attributes[:'autopublish']
182
+ else
183
+ self.autopublish = false
184
+ end
185
+
175
186
  if attributes.key?(:'publish_upstream_release_fields')
176
187
  self.publish_upstream_release_fields = attributes[:'publish_upstream_release_fields']
177
188
  end
@@ -223,6 +234,7 @@ module PulpDebClient
223
234
  description == o.description &&
224
235
  retain_repo_versions == o.retain_repo_versions &&
225
236
  remote == o.remote &&
237
+ autopublish == o.autopublish &&
226
238
  publish_upstream_release_fields == o.publish_upstream_release_fields &&
227
239
  signing_service == o.signing_service &&
228
240
  signing_service_release_overrides == o.signing_service_release_overrides
@@ -237,7 +249,7 @@ module PulpDebClient
237
249
  # Calculates hash code according to all attributes.
238
250
  # @return [Integer] Hash code
239
251
  def hash
240
- [pulp_href, prn, pulp_created, pulp_last_updated, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, remote, publish_upstream_release_fields, signing_service, signing_service_release_overrides].hash
252
+ [pulp_href, prn, pulp_created, pulp_last_updated, versions_href, pulp_labels, latest_version_href, name, description, retain_repo_versions, remote, autopublish, publish_upstream_release_fields, signing_service, signing_service_release_overrides].hash
241
253
  end
242
254
 
243
255
  # Builds the object from hash
@@ -0,0 +1,257 @@
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
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpDebClient
17
+ class PaginateddebAptAlternateContentSourceResponseList
18
+ attr_accessor :count
19
+
20
+ attr_accessor :_next
21
+
22
+ attr_accessor :previous
23
+
24
+ attr_accessor :results
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'count' => :'count',
30
+ :'_next' => :'next',
31
+ :'previous' => :'previous',
32
+ :'results' => :'results'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'count' => :'Integer',
45
+ :'_next' => :'String',
46
+ :'previous' => :'String',
47
+ :'results' => :'Array<DebAptAlternateContentSourceResponse>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::PaginateddebAptAlternateContentSourceResponseList` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::PaginateddebAptAlternateContentSourceResponseList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'count')
73
+ self.count = attributes[:'count']
74
+ else
75
+ self.count = nil
76
+ end
77
+
78
+ if attributes.key?(:'_next')
79
+ self._next = attributes[:'_next']
80
+ end
81
+
82
+ if attributes.key?(:'previous')
83
+ self.previous = attributes[:'previous']
84
+ end
85
+
86
+ if attributes.key?(:'results')
87
+ if (value = attributes[:'results']).is_a?(Array)
88
+ self.results = value
89
+ end
90
+ else
91
+ self.results = nil
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ if @count.nil?
101
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
102
+ end
103
+
104
+ if @results.nil?
105
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @count.nil?
116
+ return false if @results.nil?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ count == o.count &&
126
+ _next == o._next &&
127
+ previous == o.previous &&
128
+ results == o.results
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
+ [count, _next, previous, results].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
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = PulpDebClient.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end