pulpcore_client 3.0.0rc7 → 3.0.0rc8

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -22
  3. data/docs/ArtifactsApi.md +4 -4
  4. data/docs/InlineResponse2001.md +1 -1
  5. data/docs/InlineResponse2002.md +1 -1
  6. data/docs/InlineResponse2003.md +1 -1
  7. data/docs/Status.md +3 -1
  8. data/docs/Storage.md +21 -0
  9. data/docs/TasksApi.md +2 -2
  10. data/docs/UploadsApi.md +2 -2
  11. data/docs/WorkersApi.md +2 -2
  12. data/lib/pulpcore_client/api/artifacts_api.rb +11 -7
  13. data/lib/pulpcore_client/api/orphans_api.rb +1 -1
  14. data/lib/pulpcore_client/api/status_api.rb +1 -1
  15. data/lib/pulpcore_client/api/tasks_api.rb +4 -4
  16. data/lib/pulpcore_client/api/uploads_api.rb +4 -4
  17. data/lib/pulpcore_client/api/workers_api.rb +4 -4
  18. data/lib/pulpcore_client/api_client.rb +1 -1
  19. data/lib/pulpcore_client/api_error.rb +1 -1
  20. data/lib/pulpcore_client/configuration.rb +1 -1
  21. data/lib/pulpcore_client/models/artifact.rb +18 -2
  22. data/lib/pulpcore_client/models/async_operation_response.rb +12 -2
  23. data/lib/pulpcore_client/models/content_app_status.rb +12 -2
  24. data/lib/pulpcore_client/models/database_connection.rb +12 -2
  25. data/lib/pulpcore_client/models/inline_response200.rb +14 -2
  26. data/lib/pulpcore_client/models/inline_response2001.rb +15 -3
  27. data/lib/pulpcore_client/models/inline_response2002.rb +15 -3
  28. data/lib/pulpcore_client/models/inline_response2003.rb +15 -3
  29. data/lib/pulpcore_client/models/progress_report.rb +13 -2
  30. data/lib/pulpcore_client/models/redis_connection.rb +12 -2
  31. data/lib/pulpcore_client/models/status.rb +25 -6
  32. data/lib/pulpcore_client/models/{inline_response2004.rb → storage.rb} +106 -41
  33. data/lib/pulpcore_client/models/task.rb +12 -2
  34. data/lib/pulpcore_client/models/task_cancel.rb +12 -2
  35. data/lib/pulpcore_client/models/upload.rb +12 -2
  36. data/lib/pulpcore_client/models/upload_chunk.rb +13 -2
  37. data/lib/pulpcore_client/models/upload_commit.rb +12 -2
  38. data/lib/pulpcore_client/models/upload_detail.rb +12 -2
  39. data/lib/pulpcore_client/models/version.rb +12 -2
  40. data/lib/pulpcore_client/models/worker.rb +12 -2
  41. data/lib/pulpcore_client/version.rb +2 -2
  42. data/lib/pulpcore_client.rb +2 -9
  43. data/pulpcore_client.gemspec +1 -1
  44. data/spec/api/artifacts_api_spec.rb +2 -2
  45. data/spec/api/orphans_api_spec.rb +1 -1
  46. data/spec/api/status_api_spec.rb +1 -1
  47. data/spec/api/tasks_api_spec.rb +2 -2
  48. data/spec/api/uploads_api_spec.rb +2 -2
  49. data/spec/api/workers_api_spec.rb +2 -2
  50. data/spec/api_client_spec.rb +1 -1
  51. data/spec/configuration_spec.rb +1 -1
  52. data/spec/models/artifact_spec.rb +1 -1
  53. data/spec/models/async_operation_response_spec.rb +1 -1
  54. data/spec/models/content_app_status_spec.rb +1 -1
  55. data/spec/models/database_connection_spec.rb +1 -1
  56. data/spec/models/inline_response2001_spec.rb +1 -1
  57. data/spec/models/inline_response2002_spec.rb +1 -1
  58. data/spec/models/inline_response2003_spec.rb +1 -1
  59. data/spec/models/inline_response200_spec.rb +1 -1
  60. data/spec/models/progress_report_spec.rb +1 -1
  61. data/spec/models/redis_connection_spec.rb +1 -1
  62. data/spec/models/status_spec.rb +7 -1
  63. data/spec/models/{content_summary_spec.rb → storage_spec.rb} +10 -10
  64. data/spec/models/task_cancel_spec.rb +1 -1
  65. data/spec/models/task_spec.rb +1 -1
  66. data/spec/models/upload_chunk_spec.rb +1 -1
  67. data/spec/models/upload_commit_spec.rb +1 -1
  68. data/spec/models/upload_detail_spec.rb +1 -1
  69. data/spec/models/upload_spec.rb +1 -1
  70. data/spec/models/version_spec.rb +1 -1
  71. data/spec/models/worker_spec.rb +1 -1
  72. data/spec/spec_helper.rb +1 -1
  73. metadata +6 -34
  74. data/docs/ContentSummary.md +0 -21
  75. data/docs/InlineResponse2004.md +0 -23
  76. data/docs/InlineResponse2005.md +0 -23
  77. data/docs/RepositoriesApi.md +0 -346
  78. data/docs/RepositoriesVersionsApi.md +0 -266
  79. data/docs/Repository.md +0 -29
  80. data/docs/RepositoryVersion.md +0 -25
  81. data/docs/RepositoryVersionCreate.md +0 -21
  82. data/lib/pulpcore_client/api/repositories_api.rb +0 -422
  83. data/lib/pulpcore_client/api/repositories_versions_api.rb +0 -334
  84. data/lib/pulpcore_client/models/content_summary.rb +0 -236
  85. data/lib/pulpcore_client/models/inline_response2005.rb +0 -235
  86. data/lib/pulpcore_client/models/repository.rb +0 -293
  87. data/lib/pulpcore_client/models/repository_version.rb +0 -234
  88. data/lib/pulpcore_client/models/repository_version_create.rb +0 -221
  89. data/spec/api/repositories_api_spec.rb +0 -112
  90. data/spec/api/repositories_versions_api_spec.rb +0 -102
  91. data/spec/models/inline_response2004_spec.rb +0 -59
  92. data/spec/models/inline_response2005_spec.rb +0 -59
  93. data/spec/models/repository_spec.rb +0 -77
  94. data/spec/models/repository_version_create_spec.rb +0 -53
  95. data/spec/models/repository_version_spec.rb +0 -65
@@ -1,334 +0,0 @@
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.0-SNAPSHOT
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module PulpcoreClient
16
- class RepositoriesVersionsApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Create a repository version
23
- # Trigger an asynchronous task to create a new repository version.
24
- # @param repository_href [String] URI of Repository. e.g.: /pulp/api/v3/repositories/1/
25
- # @param data [RepositoryVersionCreate]
26
- # @param [Hash] opts the optional parameters
27
- # @return [AsyncOperationResponse]
28
- def create(repository_href, data, opts = {})
29
- data, _status_code, _headers = create_with_http_info(repository_href, data, opts)
30
- data
31
- end
32
-
33
- # Create a repository version
34
- # Trigger an asynchronous task to create a new repository version.
35
- # @param repository_href [String] URI of Repository. e.g.: /pulp/api/v3/repositories/1/
36
- # @param data [RepositoryVersionCreate]
37
- # @param [Hash] opts the optional parameters
38
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
39
- def create_with_http_info(repository_href, data, opts = {})
40
- if @api_client.config.debugging
41
- @api_client.config.logger.debug 'Calling API: RepositoriesVersionsApi.create ...'
42
- end
43
- # verify the required parameter 'repository_href' is set
44
- if @api_client.config.client_side_validation && repository_href.nil?
45
- fail ArgumentError, "Missing the required parameter 'repository_href' when calling RepositoriesVersionsApi.create"
46
- end
47
- # verify the required parameter 'data' is set
48
- if @api_client.config.client_side_validation && data.nil?
49
- fail ArgumentError, "Missing the required parameter 'data' when calling RepositoriesVersionsApi.create"
50
- end
51
- # resource path
52
- local_var_path = '{repository_href}versions/'.sub('{' + 'repository_href' + '}', CGI.escape(repository_href.to_s).gsub('%2F', '/'))
53
-
54
- # query parameters
55
- query_params = opts[:query_params] || {}
56
-
57
- # header parameters
58
- header_params = opts[:header_params] || {}
59
- # HTTP header 'Accept' (if needed)
60
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
- # HTTP header 'Content-Type'
62
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
63
-
64
- # form parameters
65
- form_params = opts[:form_params] || {}
66
-
67
- # http body (model)
68
- post_body = opts[:body] || @api_client.object_to_http_body(data)
69
-
70
- # return_type
71
- return_type = opts[:return_type] || 'AsyncOperationResponse'
72
-
73
- # auth_names
74
- auth_names = opts[:auth_names] || ['Basic']
75
-
76
- new_options = opts.merge(
77
- :header_params => header_params,
78
- :query_params => query_params,
79
- :form_params => form_params,
80
- :body => post_body,
81
- :auth_names => auth_names,
82
- :return_type => return_type
83
- )
84
-
85
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
86
- if @api_client.config.debugging
87
- @api_client.config.logger.debug "API called: RepositoriesVersionsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
- end
89
- return data, status_code, headers
90
- end
91
-
92
- # Delete a repository version
93
- # Trigger an asynchronous task to delete a repositroy version.
94
- # @param repository_version_href [String] URI of Repository Version. e.g.: /pulp/api/v3/repositories/1/versions/1/
95
- # @param [Hash] opts the optional parameters
96
- # @return [AsyncOperationResponse]
97
- def delete(repository_version_href, opts = {})
98
- data, _status_code, _headers = delete_with_http_info(repository_version_href, opts)
99
- data
100
- end
101
-
102
- # Delete a repository version
103
- # Trigger an asynchronous task to delete a repositroy version.
104
- # @param repository_version_href [String] URI of Repository Version. e.g.: /pulp/api/v3/repositories/1/versions/1/
105
- # @param [Hash] opts the optional parameters
106
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
107
- def delete_with_http_info(repository_version_href, opts = {})
108
- if @api_client.config.debugging
109
- @api_client.config.logger.debug 'Calling API: RepositoriesVersionsApi.delete ...'
110
- end
111
- # verify the required parameter 'repository_version_href' is set
112
- if @api_client.config.client_side_validation && repository_version_href.nil?
113
- fail ArgumentError, "Missing the required parameter 'repository_version_href' when calling RepositoriesVersionsApi.delete"
114
- end
115
- # resource path
116
- local_var_path = '{repository_version_href}'.sub('{' + 'repository_version_href' + '}', CGI.escape(repository_version_href.to_s).gsub('%2F', '/'))
117
-
118
- # query parameters
119
- query_params = opts[:query_params] || {}
120
-
121
- # header parameters
122
- header_params = opts[:header_params] || {}
123
- # HTTP header 'Accept' (if needed)
124
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
-
126
- # form parameters
127
- form_params = opts[:form_params] || {}
128
-
129
- # http body (model)
130
- post_body = opts[:body]
131
-
132
- # return_type
133
- return_type = opts[:return_type] || 'AsyncOperationResponse'
134
-
135
- # auth_names
136
- auth_names = opts[:auth_names] || ['Basic']
137
-
138
- new_options = opts.merge(
139
- :header_params => header_params,
140
- :query_params => query_params,
141
- :form_params => form_params,
142
- :body => post_body,
143
- :auth_names => auth_names,
144
- :return_type => return_type
145
- )
146
-
147
- data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
148
- if @api_client.config.debugging
149
- @api_client.config.logger.debug "API called: RepositoriesVersionsApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
150
- end
151
- return data, status_code, headers
152
- end
153
-
154
- # List repository versions
155
- # @param repository_href [String] URI of Repository. e.g.: /pulp/api/v3/repositories/1/
156
- # @param [Hash] opts the optional parameters
157
- # @option opts [String] :ordering Which field to use when ordering the results.
158
- # @option opts [Float] :number
159
- # @option opts [Float] :number__lt Filter results where number is less than value
160
- # @option opts [Float] :number__lte Filter results where number is less than or equal to value
161
- # @option opts [Float] :number__gt Filter results where number is greater than value
162
- # @option opts [Float] :number__gte Filter results where number is greater than or equal to value
163
- # @option opts [Float] :number__range Filter results where number is between two comma separated values
164
- # @option opts [String] :pulp_created__lt Filter results where pulp_created is less than value
165
- # @option opts [String] :pulp_created__lte Filter results where pulp_created is less than or equal to value
166
- # @option opts [String] :pulp_created__gt Filter results where pulp_created is greater than value
167
- # @option opts [String] :pulp_created__gte Filter results where pulp_created is greater than or equal to value
168
- # @option opts [String] :pulp_created__range Filter results where pulp_created is between two comma separated values
169
- # @option opts [String] :content Content Unit referenced by HREF
170
- # @option opts [String] :pulp_created ISO 8601 formatted dates are supported
171
- # @option opts [Integer] :limit Number of results to return per page.
172
- # @option opts [Integer] :offset The initial index from which to return the results.
173
- # @option opts [String] :fields A list of fields to include in the response.
174
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
175
- # @return [InlineResponse2002]
176
- def list(repository_href, opts = {})
177
- data, _status_code, _headers = list_with_http_info(repository_href, opts)
178
- data
179
- end
180
-
181
- # List repository versions
182
- # @param repository_href [String] URI of Repository. e.g.: /pulp/api/v3/repositories/1/
183
- # @param [Hash] opts the optional parameters
184
- # @option opts [String] :ordering Which field to use when ordering the results.
185
- # @option opts [Float] :number
186
- # @option opts [Float] :number__lt Filter results where number is less than value
187
- # @option opts [Float] :number__lte Filter results where number is less than or equal to value
188
- # @option opts [Float] :number__gt Filter results where number is greater than value
189
- # @option opts [Float] :number__gte Filter results where number is greater than or equal to value
190
- # @option opts [Float] :number__range Filter results where number is between two comma separated values
191
- # @option opts [String] :pulp_created__lt Filter results where pulp_created is less than value
192
- # @option opts [String] :pulp_created__lte Filter results where pulp_created is less than or equal to value
193
- # @option opts [String] :pulp_created__gt Filter results where pulp_created is greater than value
194
- # @option opts [String] :pulp_created__gte Filter results where pulp_created is greater than or equal to value
195
- # @option opts [String] :pulp_created__range Filter results where pulp_created is between two comma separated values
196
- # @option opts [String] :content Content Unit referenced by HREF
197
- # @option opts [String] :pulp_created ISO 8601 formatted dates are supported
198
- # @option opts [Integer] :limit Number of results to return per page.
199
- # @option opts [Integer] :offset The initial index from which to return the results.
200
- # @option opts [String] :fields A list of fields to include in the response.
201
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
202
- # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
203
- def list_with_http_info(repository_href, opts = {})
204
- if @api_client.config.debugging
205
- @api_client.config.logger.debug 'Calling API: RepositoriesVersionsApi.list ...'
206
- end
207
- # verify the required parameter 'repository_href' is set
208
- if @api_client.config.client_side_validation && repository_href.nil?
209
- fail ArgumentError, "Missing the required parameter 'repository_href' when calling RepositoriesVersionsApi.list"
210
- end
211
- # resource path
212
- local_var_path = '{repository_href}versions/'.sub('{' + 'repository_href' + '}', CGI.escape(repository_href.to_s).gsub('%2F', '/'))
213
-
214
- # query parameters
215
- query_params = opts[:query_params] || {}
216
- query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].nil?
217
- query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
218
- query_params[:'number__lt'] = opts[:'number__lt'] if !opts[:'number__lt'].nil?
219
- query_params[:'number__lte'] = opts[:'number__lte'] if !opts[:'number__lte'].nil?
220
- query_params[:'number__gt'] = opts[:'number__gt'] if !opts[:'number__gt'].nil?
221
- query_params[:'number__gte'] = opts[:'number__gte'] if !opts[:'number__gte'].nil?
222
- query_params[:'number__range'] = opts[:'number__range'] if !opts[:'number__range'].nil?
223
- query_params[:'pulp_created__lt'] = opts[:'pulp_created__lt'] if !opts[:'pulp_created__lt'].nil?
224
- query_params[:'pulp_created__lte'] = opts[:'pulp_created__lte'] if !opts[:'pulp_created__lte'].nil?
225
- query_params[:'pulp_created__gt'] = opts[:'pulp_created__gt'] if !opts[:'pulp_created__gt'].nil?
226
- query_params[:'pulp_created__gte'] = opts[:'pulp_created__gte'] if !opts[:'pulp_created__gte'].nil?
227
- query_params[:'pulp_created__range'] = opts[:'pulp_created__range'] if !opts[:'pulp_created__range'].nil?
228
- query_params[:'content'] = opts[:'content'] if !opts[:'content'].nil?
229
- query_params[:'pulp_created'] = opts[:'pulp_created'] if !opts[:'pulp_created'].nil?
230
- query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
231
- query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
232
- query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
233
- query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?
234
-
235
- # header parameters
236
- header_params = opts[:header_params] || {}
237
- # HTTP header 'Accept' (if needed)
238
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
239
-
240
- # form parameters
241
- form_params = opts[:form_params] || {}
242
-
243
- # http body (model)
244
- post_body = opts[:body]
245
-
246
- # return_type
247
- return_type = opts[:return_type] || 'InlineResponse2002'
248
-
249
- # auth_names
250
- auth_names = opts[:auth_names] || ['Basic']
251
-
252
- new_options = opts.merge(
253
- :header_params => header_params,
254
- :query_params => query_params,
255
- :form_params => form_params,
256
- :body => post_body,
257
- :auth_names => auth_names,
258
- :return_type => return_type
259
- )
260
-
261
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
262
- if @api_client.config.debugging
263
- @api_client.config.logger.debug "API called: RepositoriesVersionsApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
264
- end
265
- return data, status_code, headers
266
- end
267
-
268
- # Inspect a repository version
269
- # @param repository_version_href [String] URI of Repository Version. e.g.: /pulp/api/v3/repositories/1/versions/1/
270
- # @param [Hash] opts the optional parameters
271
- # @option opts [String] :fields A list of fields to include in the response.
272
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
273
- # @return [RepositoryVersion]
274
- def read(repository_version_href, opts = {})
275
- data, _status_code, _headers = read_with_http_info(repository_version_href, opts)
276
- data
277
- end
278
-
279
- # Inspect a repository version
280
- # @param repository_version_href [String] URI of Repository Version. e.g.: /pulp/api/v3/repositories/1/versions/1/
281
- # @param [Hash] opts the optional parameters
282
- # @option opts [String] :fields A list of fields to include in the response.
283
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
284
- # @return [Array<(RepositoryVersion, Integer, Hash)>] RepositoryVersion data, response status code and response headers
285
- def read_with_http_info(repository_version_href, opts = {})
286
- if @api_client.config.debugging
287
- @api_client.config.logger.debug 'Calling API: RepositoriesVersionsApi.read ...'
288
- end
289
- # verify the required parameter 'repository_version_href' is set
290
- if @api_client.config.client_side_validation && repository_version_href.nil?
291
- fail ArgumentError, "Missing the required parameter 'repository_version_href' when calling RepositoriesVersionsApi.read"
292
- end
293
- # resource path
294
- local_var_path = '{repository_version_href}'.sub('{' + 'repository_version_href' + '}', CGI.escape(repository_version_href.to_s).gsub('%2F', '/'))
295
-
296
- # query parameters
297
- query_params = opts[:query_params] || {}
298
- query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
299
- query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?
300
-
301
- # header parameters
302
- header_params = opts[:header_params] || {}
303
- # HTTP header 'Accept' (if needed)
304
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
305
-
306
- # form parameters
307
- form_params = opts[:form_params] || {}
308
-
309
- # http body (model)
310
- post_body = opts[:body]
311
-
312
- # return_type
313
- return_type = opts[:return_type] || 'RepositoryVersion'
314
-
315
- # auth_names
316
- auth_names = opts[:auth_names] || ['Basic']
317
-
318
- new_options = opts.merge(
319
- :header_params => header_params,
320
- :query_params => query_params,
321
- :form_params => form_params,
322
- :body => post_body,
323
- :auth_names => auth_names,
324
- :return_type => return_type
325
- )
326
-
327
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
328
- if @api_client.config.debugging
329
- @api_client.config.logger.debug "API called: RepositoriesVersionsApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
330
- end
331
- return data, status_code, headers
332
- end
333
- end
334
- end
@@ -1,236 +0,0 @@
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.0-SNAPSHOT
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module PulpcoreClient
16
- # Various count summaries of the content in the version and the HREF to view them.
17
- class ContentSummary
18
- attr_accessor :added
19
-
20
- attr_accessor :removed
21
-
22
- attr_accessor :present
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'added' => :'added',
28
- :'removed' => :'removed',
29
- :'present' => :'present'
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.openapi_types
35
- {
36
- :'added' => :'Hash<String, Hash<String, String>>',
37
- :'removed' => :'Hash<String, Hash<String, String>>',
38
- :'present' => :'Hash<String, Hash<String, String>>'
39
- }
40
- end
41
-
42
- # Initializes the object
43
- # @param [Hash] attributes Model attributes in the form of hash
44
- def initialize(attributes = {})
45
- if (!attributes.is_a?(Hash))
46
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::ContentSummary` initialize method"
47
- end
48
-
49
- # check to see if the attribute exists and convert string to symbol for hash key
50
- attributes = attributes.each_with_object({}) { |(k, v), h|
51
- if (!self.class.attribute_map.key?(k.to_sym))
52
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::ContentSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
- end
54
- h[k.to_sym] = v
55
- }
56
-
57
- if attributes.key?(:'added')
58
- if (value = attributes[:'added']).is_a?(Hash)
59
- self.added = value
60
- end
61
- end
62
-
63
- if attributes.key?(:'removed')
64
- if (value = attributes[:'removed']).is_a?(Hash)
65
- self.removed = value
66
- end
67
- end
68
-
69
- if attributes.key?(:'present')
70
- if (value = attributes[:'present']).is_a?(Hash)
71
- self.present = value
72
- end
73
- end
74
- end
75
-
76
- # Show invalid properties with the reasons. Usually used together with valid?
77
- # @return Array for valid properties with the reasons
78
- def list_invalid_properties
79
- invalid_properties = Array.new
80
- if @added.nil?
81
- invalid_properties.push('invalid value for "added", added cannot be nil.')
82
- end
83
-
84
- if @removed.nil?
85
- invalid_properties.push('invalid value for "removed", removed cannot be nil.')
86
- end
87
-
88
- if @present.nil?
89
- invalid_properties.push('invalid value for "present", present cannot be nil.')
90
- end
91
-
92
- invalid_properties
93
- end
94
-
95
- # Check to see if the all the properties in the model are valid
96
- # @return true if the model is valid
97
- def valid?
98
- return false if @added.nil?
99
- return false if @removed.nil?
100
- return false if @present.nil?
101
- true
102
- end
103
-
104
- # Checks equality by comparing each attribute.
105
- # @param [Object] Object to be compared
106
- def ==(o)
107
- return true if self.equal?(o)
108
- self.class == o.class &&
109
- added == o.added &&
110
- removed == o.removed &&
111
- present == o.present
112
- end
113
-
114
- # @see the `==` method
115
- # @param [Object] Object to be compared
116
- def eql?(o)
117
- self == o
118
- end
119
-
120
- # Calculates hash code according to all attributes.
121
- # @return [Integer] Hash code
122
- def hash
123
- [added, removed, present].hash
124
- end
125
-
126
- # Builds the object from hash
127
- # @param [Hash] attributes Model attributes in the form of hash
128
- # @return [Object] Returns the model itself
129
- def self.build_from_hash(attributes)
130
- new.build_from_hash(attributes)
131
- end
132
-
133
- # Builds the object from hash
134
- # @param [Hash] attributes Model attributes in the form of hash
135
- # @return [Object] Returns the model itself
136
- def build_from_hash(attributes)
137
- return nil unless attributes.is_a?(Hash)
138
- self.class.openapi_types.each_pair do |key, type|
139
- if type =~ /\AArray<(.*)>/i
140
- # check to ensure the input is an array given that the attribute
141
- # is documented as an array but the input is not
142
- if attributes[self.class.attribute_map[key]].is_a?(Array)
143
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
- end
145
- elsif !attributes[self.class.attribute_map[key]].nil?
146
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
- end # or else data not found in attributes(hash), not an issue as the data can be optional
148
- end
149
-
150
- self
151
- end
152
-
153
- # Deserializes the data based on type
154
- # @param string type Data type
155
- # @param string value Value to be deserialized
156
- # @return [Object] Deserialized data
157
- def _deserialize(type, value)
158
- case type.to_sym
159
- when :DateTime
160
- DateTime.parse(value)
161
- when :Date
162
- Date.parse(value)
163
- when :String
164
- value.to_s
165
- when :Integer
166
- value.to_i
167
- when :Float
168
- value.to_f
169
- when :Boolean
170
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
- true
172
- else
173
- false
174
- end
175
- when :Object
176
- # generic object (usually a Hash), return directly
177
- value
178
- when /\AArray<(?<inner_type>.+)>\z/
179
- inner_type = Regexp.last_match[:inner_type]
180
- value.map { |v| _deserialize(inner_type, v) }
181
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
- k_type = Regexp.last_match[:k_type]
183
- v_type = Regexp.last_match[:v_type]
184
- {}.tap do |hash|
185
- value.each do |k, v|
186
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
- end
188
- end
189
- else # model
190
- PulpcoreClient.const_get(type).build_from_hash(value)
191
- end
192
- end
193
-
194
- # Returns the string representation of the object
195
- # @return [String] String presentation of the object
196
- def to_s
197
- to_hash.to_s
198
- end
199
-
200
- # to_body is an alias to to_hash (backward compatibility)
201
- # @return [Hash] Returns the object in the form of hash
202
- def to_body
203
- to_hash
204
- end
205
-
206
- # Returns the object in the form of hash
207
- # @return [Hash] Returns the object in the form of hash
208
- def to_hash
209
- hash = {}
210
- self.class.attribute_map.each_pair do |attr, param|
211
- value = self.send(attr)
212
- next if value.nil?
213
- hash[param] = _to_hash(value)
214
- end
215
- hash
216
- end
217
-
218
- # Outputs non-array value in the form of hash
219
- # For object, use to_hash. Otherwise, just return the value
220
- # @param [Object] value Any valid value
221
- # @return [Hash] Returns the value in the form of hash
222
- def _to_hash(value)
223
- if value.is_a?(Array)
224
- value.compact.map { |v| _to_hash(v) }
225
- elsif value.is_a?(Hash)
226
- {}.tap do |hash|
227
- value.each { |k, v| hash[k] = _to_hash(v) }
228
- end
229
- elsif value.respond_to? :to_hash
230
- value.to_hash
231
- else
232
- value
233
- end
234
- end
235
- end
236
- end