pulpcore_client 3.21.32 → 3.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +147 -143
  3. data/docs/AccessPoliciesApi.md +28 -28
  4. data/docs/ArtifactDistributionResponse.md +29 -0
  5. data/docs/ArtifactsApi.md +21 -21
  6. data/docs/ContentApi.md +6 -6
  7. data/docs/ContentSettingsResponse.md +19 -0
  8. data/docs/ContentguardsApi.md +8 -8
  9. data/docs/ContentguardsContentRedirectApi.md +53 -53
  10. data/docs/ContentguardsRbacApi.md +53 -53
  11. data/docs/DistributionResponse.md +1 -1
  12. data/docs/DistributionsApi.md +11 -11
  13. data/docs/DistributionsArtifactsApi.md +154 -0
  14. data/docs/ExportersFilesystemApi.md +33 -33
  15. data/docs/ExportersFilesystemExportsApi.md +21 -21
  16. data/docs/ExportersPulpApi.md +33 -33
  17. data/docs/ExportersPulpExportsApi.md +21 -21
  18. data/docs/FilesystemExport.md +1 -3
  19. data/docs/GroupsApi.md +51 -51
  20. data/docs/GroupsRolesApi.md +21 -21
  21. data/docs/GroupsUsersApi.md +16 -16
  22. data/docs/ImportersPulpApi.md +33 -33
  23. data/docs/ImportersPulpImportCheckApi.md +1 -1
  24. data/docs/ImportersPulpImportsApi.md +21 -21
  25. data/docs/OrphansApi.md +6 -6
  26. data/docs/OrphansCleanupApi.md +6 -6
  27. data/docs/PaginatedArtifactDistributionResponseList.md +23 -0
  28. data/docs/PublicationsApi.md +8 -8
  29. data/docs/RemoteResponse.md +4 -2
  30. data/docs/RemoteResponseHiddenFields.md +19 -0
  31. data/docs/RemotesApi.md +10 -10
  32. data/docs/RepairApi.md +6 -6
  33. data/docs/RepositoriesApi.md +9 -9
  34. data/docs/RepositoriesReclaimSpaceApi.md +6 -6
  35. data/docs/RepositoryResponse.md +1 -1
  36. data/docs/RepositoryVersionsApi.md +10 -10
  37. data/docs/RolesApi.md +31 -31
  38. data/docs/SigningServicesApi.md +15 -13
  39. data/docs/StatusApi.md +1 -1
  40. data/docs/StatusResponse.md +3 -1
  41. data/docs/TaskGroupsApi.md +11 -13
  42. data/docs/TaskSchedulesApi.md +35 -35
  43. data/docs/TasksApi.md +128 -114
  44. data/docs/UploadsApi.md +61 -51
  45. data/docs/UserResponse.md +3 -1
  46. data/docs/UsersApi.md +31 -31
  47. data/docs/UsersRolesApi.md +21 -21
  48. data/docs/WorkersApi.md +15 -15
  49. data/lib/pulpcore_client/api/access_policies_api.rb +34 -34
  50. data/lib/pulpcore_client/api/artifacts_api.rb +30 -30
  51. data/lib/pulpcore_client/api/content_api.rb +5 -5
  52. data/lib/pulpcore_client/api/contentguards_api.rb +8 -8
  53. data/lib/pulpcore_client/api/contentguards_content_redirect_api.rb +66 -66
  54. data/lib/pulpcore_client/api/contentguards_rbac_api.rb +66 -66
  55. data/lib/pulpcore_client/api/distributions_api.rb +12 -12
  56. data/lib/pulpcore_client/api/distributions_artifacts_api.rb +198 -0
  57. data/lib/pulpcore_client/api/exporters_filesystem_api.rb +40 -40
  58. data/lib/pulpcore_client/api/exporters_filesystem_exports_api.rb +25 -25
  59. data/lib/pulpcore_client/api/exporters_pulp_api.rb +40 -40
  60. data/lib/pulpcore_client/api/exporters_pulp_exports_api.rb +25 -25
  61. data/lib/pulpcore_client/api/groups_api.rb +64 -64
  62. data/lib/pulpcore_client/api/groups_roles_api.rb +25 -25
  63. data/lib/pulpcore_client/api/groups_users_api.rb +19 -19
  64. data/lib/pulpcore_client/api/importers_pulp_api.rb +40 -40
  65. data/lib/pulpcore_client/api/importers_pulp_imports_api.rb +25 -25
  66. data/lib/pulpcore_client/api/orphans_api.rb +5 -5
  67. data/lib/pulpcore_client/api/orphans_cleanup_api.rb +6 -6
  68. data/lib/pulpcore_client/api/publications_api.rb +8 -8
  69. data/lib/pulpcore_client/api/remotes_api.rb +10 -10
  70. data/lib/pulpcore_client/api/repair_api.rb +6 -6
  71. data/lib/pulpcore_client/api/repositories_api.rb +8 -8
  72. data/lib/pulpcore_client/api/repositories_reclaim_space_api.rb +6 -6
  73. data/lib/pulpcore_client/api/repository_versions_api.rb +10 -10
  74. data/lib/pulpcore_client/api/roles_api.rb +38 -38
  75. data/lib/pulpcore_client/api/signing_services_api.rb +20 -13
  76. data/lib/pulpcore_client/api/task_groups_api.rb +11 -18
  77. data/lib/pulpcore_client/api/task_schedules_api.rb +42 -42
  78. data/lib/pulpcore_client/api/tasks_api.rb +159 -138
  79. data/lib/pulpcore_client/api/uploads_api.rb +84 -65
  80. data/lib/pulpcore_client/api/users_api.rb +38 -38
  81. data/lib/pulpcore_client/api/users_roles_api.rb +25 -25
  82. data/lib/pulpcore_client/api/workers_api.rb +16 -16
  83. data/lib/pulpcore_client/configuration.rb +3 -3
  84. data/lib/pulpcore_client/models/artifact_distribution_response.rb +279 -0
  85. data/lib/pulpcore_client/models/content_settings_response.rb +228 -0
  86. data/lib/pulpcore_client/models/distribution_response.rb +4 -2
  87. data/lib/pulpcore_client/models/filesystem_export.rb +4 -14
  88. data/lib/pulpcore_client/models/group_role.rb +19 -0
  89. data/lib/pulpcore_client/models/paginated_artifact_distribution_response_list.rb +237 -0
  90. data/lib/pulpcore_client/models/remote_response.rb +41 -27
  91. data/lib/pulpcore_client/models/remote_response_hidden_fields.rb +215 -0
  92. data/lib/pulpcore_client/models/repository_response.rb +4 -2
  93. data/lib/pulpcore_client/models/status_response.rb +19 -4
  94. data/lib/pulpcore_client/models/user_response.rb +16 -4
  95. data/lib/pulpcore_client/models/user_role.rb +19 -0
  96. data/lib/pulpcore_client/version.rb +1 -1
  97. data/lib/pulpcore_client.rb +5 -2
  98. data/spec/api/access_policies_api_spec.rb +11 -11
  99. data/spec/api/artifacts_api_spec.rb +8 -8
  100. data/spec/api/content_api_spec.rb +2 -2
  101. data/spec/api/contentguards_api_spec.rb +3 -3
  102. data/spec/api/contentguards_content_redirect_api_spec.rb +21 -21
  103. data/spec/api/contentguards_rbac_api_spec.rb +21 -21
  104. data/spec/api/distributions_api_spec.rb +5 -5
  105. data/spec/api/distributions_artifacts_api_spec.rb +76 -0
  106. data/spec/api/exporters_filesystem_api_spec.rb +13 -13
  107. data/spec/api/exporters_filesystem_exports_api_spec.rb +8 -8
  108. data/spec/api/exporters_pulp_api_spec.rb +13 -13
  109. data/spec/api/exporters_pulp_exports_api_spec.rb +8 -8
  110. data/spec/api/groups_api_spec.rb +20 -20
  111. data/spec/api/groups_roles_api_spec.rb +8 -8
  112. data/spec/api/groups_users_api_spec.rb +6 -6
  113. data/spec/api/importers_pulp_api_spec.rb +13 -13
  114. data/spec/api/importers_pulp_imports_api_spec.rb +8 -8
  115. data/spec/api/orphans_api_spec.rb +2 -2
  116. data/spec/api/orphans_cleanup_api_spec.rb +2 -2
  117. data/spec/api/publications_api_spec.rb +3 -3
  118. data/spec/api/remotes_api_spec.rb +4 -4
  119. data/spec/api/repair_api_spec.rb +2 -2
  120. data/spec/api/repositories_api_spec.rb +3 -3
  121. data/spec/api/repositories_reclaim_space_api_spec.rb +2 -2
  122. data/spec/api/repository_versions_api_spec.rb +4 -4
  123. data/spec/api/roles_api_spec.rb +12 -12
  124. data/spec/api/signing_services_api_spec.rb +6 -5
  125. data/spec/api/task_groups_api_spec.rb +4 -5
  126. data/spec/api/task_schedules_api_spec.rb +14 -14
  127. data/spec/api/tasks_api_spec.rb +45 -38
  128. data/spec/api/uploads_api_spec.rb +25 -20
  129. data/spec/api/users_api_spec.rb +12 -12
  130. data/spec/api/users_roles_api_spec.rb +8 -8
  131. data/spec/api/workers_api_spec.rb +6 -6
  132. data/spec/configuration_spec.rb +3 -3
  133. data/spec/models/artifact_distribution_response_spec.rb +77 -0
  134. data/spec/models/content_settings_response_spec.rb +47 -0
  135. data/spec/models/filesystem_export_spec.rb +0 -6
  136. data/spec/models/paginated_artifact_distribution_response_list_spec.rb +59 -0
  137. data/spec/models/remote_response_hidden_fields_spec.rb +47 -0
  138. data/spec/models/remote_response_spec.rb +6 -0
  139. data/spec/models/status_response_spec.rb +6 -0
  140. data/spec/models/user_response_spec.rb +6 -0
  141. metadata +162 -150
  142. data/docs/DocsApiJsonApi.md +0 -61
  143. data/docs/DocsApiYamlApi.md +0 -61
  144. data/lib/pulpcore_client/api/docs_api_json_api.rb +0 -89
  145. data/lib/pulpcore_client/api/docs_api_yaml_api.rb +0 -89
  146. data/spec/api/docs_api_json_api_spec.rb +0 -48
  147. data/spec/api/docs_api_yaml_api_spec.rb +0 -48
@@ -0,0 +1,228 @@
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 PulpcoreClient
16
+ # Serializer for information about content-app-settings for the pulp instance
17
+ class ContentSettingsResponse
18
+ # The CONTENT_ORIGIN setting for this Pulp instance
19
+ attr_accessor :content_origin
20
+
21
+ # The CONTENT_PATH_PREFIX setting for this Pulp instance
22
+ attr_accessor :content_path_prefix
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'content_origin' => :'content_origin',
28
+ :'content_path_prefix' => :'content_path_prefix'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'content_origin' => :'String',
36
+ :'content_path_prefix' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::ContentSettingsResponse` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::ContentSettingsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'content_origin')
62
+ self.content_origin = attributes[:'content_origin']
63
+ end
64
+
65
+ if attributes.key?(:'content_path_prefix')
66
+ self.content_path_prefix = attributes[:'content_path_prefix']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @content_origin.nil?
75
+ invalid_properties.push('invalid value for "content_origin", content_origin cannot be nil.')
76
+ end
77
+
78
+ if @content_path_prefix.nil?
79
+ invalid_properties.push('invalid value for "content_path_prefix", content_path_prefix cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @content_origin.nil?
89
+ return false if @content_path_prefix.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ content_origin == o.content_origin &&
99
+ content_path_prefix == o.content_path_prefix
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [content_origin, content_path_prefix].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ PulpcoreClient.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -59,7 +59,7 @@ module PulpcoreClient
59
59
  :'base_path' => :'String',
60
60
  :'base_url' => :'String',
61
61
  :'content_guard' => :'String',
62
- :'pulp_labels' => :'Object',
62
+ :'pulp_labels' => :'Hash<String, String>',
63
63
  :'name' => :'String',
64
64
  :'repository' => :'String'
65
65
  }
@@ -109,7 +109,9 @@ module PulpcoreClient
109
109
  end
110
110
 
111
111
  if attributes.key?(:'pulp_labels')
112
- self.pulp_labels = attributes[:'pulp_labels']
112
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
113
+ self.pulp_labels = value
114
+ end
113
115
  end
114
116
 
115
117
  if attributes.key?(:'name')
@@ -24,16 +24,12 @@ module PulpcoreClient
24
24
  # A URI of the repository version export.
25
25
  attr_accessor :repository_version
26
26
 
27
- # The URI of the last-exported-repo-version.
28
- attr_accessor :start_repository_version
29
-
30
27
  # Attribute mapping from ruby-style variable name to JSON key.
31
28
  def self.attribute_map
32
29
  {
33
30
  :'task' => :'task',
34
31
  :'publication' => :'publication',
35
- :'repository_version' => :'repository_version',
36
- :'start_repository_version' => :'start_repository_version'
32
+ :'repository_version' => :'repository_version'
37
33
  }
38
34
  end
39
35
 
@@ -42,8 +38,7 @@ module PulpcoreClient
42
38
  {
43
39
  :'task' => :'String',
44
40
  :'publication' => :'String',
45
- :'repository_version' => :'String',
46
- :'start_repository_version' => :'String'
41
+ :'repository_version' => :'String'
47
42
  }
48
43
  end
49
44
 
@@ -80,10 +75,6 @@ module PulpcoreClient
80
75
  if attributes.key?(:'repository_version')
81
76
  self.repository_version = attributes[:'repository_version']
82
77
  end
83
-
84
- if attributes.key?(:'start_repository_version')
85
- self.start_repository_version = attributes[:'start_repository_version']
86
- end
87
78
  end
88
79
 
89
80
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -106,8 +97,7 @@ module PulpcoreClient
106
97
  self.class == o.class &&
107
98
  task == o.task &&
108
99
  publication == o.publication &&
109
- repository_version == o.repository_version &&
110
- start_repository_version == o.start_repository_version
100
+ repository_version == o.repository_version
111
101
  end
112
102
 
113
103
  # @see the `==` method
@@ -119,7 +109,7 @@ module PulpcoreClient
119
109
  # Calculates hash code according to all attributes.
120
110
  # @return [Integer] Hash code
121
111
  def hash
122
- [task, publication, repository_version, start_repository_version].hash
112
+ [task, publication, repository_version].hash
123
113
  end
124
114
 
125
115
  # Builds the object from hash
@@ -75,6 +75,10 @@ module PulpcoreClient
75
75
  invalid_properties.push('invalid value for "role", role cannot be nil.')
76
76
  end
77
77
 
78
+ if @role.to_s.length < 1
79
+ invalid_properties.push('invalid value for "role", the character length must be great than or equal to 1.')
80
+ end
81
+
78
82
  if @content_object.to_s.length < 1
79
83
  invalid_properties.push('invalid value for "content_object", the character length must be great than or equal to 1.')
80
84
  end
@@ -86,10 +90,25 @@ module PulpcoreClient
86
90
  # @return true if the model is valid
87
91
  def valid?
88
92
  return false if @role.nil?
93
+ return false if @role.to_s.length < 1
89
94
  return false if @content_object.to_s.length < 1
90
95
  true
91
96
  end
92
97
 
98
+ # Custom attribute writer method with validation
99
+ # @param [Object] role Value to be assigned
100
+ def role=(role)
101
+ if role.nil?
102
+ fail ArgumentError, 'role cannot be nil'
103
+ end
104
+
105
+ if role.to_s.length < 1
106
+ fail ArgumentError, 'invalid value for "role", the character length must be great than or equal to 1.'
107
+ end
108
+
109
+ @role = role
110
+ end
111
+
93
112
  # Custom attribute writer method with validation
94
113
  # @param [Object] content_object Value to be assigned
95
114
  def content_object=(content_object)
@@ -0,0 +1,237 @@
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 PulpcoreClient
16
+ class PaginatedArtifactDistributionResponseList
17
+ attr_accessor :count
18
+
19
+ attr_accessor :_next
20
+
21
+ attr_accessor :previous
22
+
23
+ attr_accessor :results
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'count' => :'count',
29
+ :'_next' => :'next',
30
+ :'previous' => :'previous',
31
+ :'results' => :'results'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'count' => :'Integer',
39
+ :'_next' => :'String',
40
+ :'previous' => :'String',
41
+ :'results' => :'Array<ArtifactDistributionResponse>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'_next',
49
+ :'previous',
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 `PulpcoreClient::PaginatedArtifactDistributionResponseList` 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 `PulpcoreClient::PaginatedArtifactDistributionResponseList`. 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?(:'count')
69
+ self.count = attributes[:'count']
70
+ end
71
+
72
+ if attributes.key?(:'_next')
73
+ self._next = attributes[:'_next']
74
+ end
75
+
76
+ if attributes.key?(:'previous')
77
+ self.previous = attributes[:'previous']
78
+ end
79
+
80
+ if attributes.key?(:'results')
81
+ if (value = attributes[:'results']).is_a?(Array)
82
+ self.results = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ count == o.count &&
106
+ _next == o._next &&
107
+ previous == o.previous &&
108
+ results == o.results
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [count, _next, previous, results].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ PulpcoreClient.const_get(type).build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end