pulp_python_client 3.28.2 → 3.30.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.
@@ -0,0 +1,341 @@
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 'cgi'
14
+
15
+ module PulpPythonClient
16
+ class RepositoriesPythonBlocklistEntriesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a python blocklist entry
23
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package `name` (all versions), package `name` + `version`, or exact `filename`. Exactly one of `name` or `filename` must be provided.
24
+ # @param python_python_repository_href [String]
25
+ # @param python_python_blocklist_entry [PythonPythonBlocklistEntry]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
28
+ # @return [PythonPythonBlocklistEntryResponse]
29
+ def create(python_python_repository_href, python_python_blocklist_entry, opts = {})
30
+ data, _status_code, _headers = create_with_http_info(python_python_repository_href, python_python_blocklist_entry, opts)
31
+ data
32
+ end
33
+
34
+ # Create a python blocklist entry
35
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package &#x60;name&#x60; (all versions), package &#x60;name&#x60; + &#x60;version&#x60;, or exact &#x60;filename&#x60;. Exactly one of &#x60;name&#x60; or &#x60;filename&#x60; must be provided.
36
+ # @param python_python_repository_href [String]
37
+ # @param python_python_blocklist_entry [PythonPythonBlocklistEntry]
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
40
+ # @return [Array<(PythonPythonBlocklistEntryResponse, Integer, Hash)>] PythonPythonBlocklistEntryResponse data, response status code and response headers
41
+ def create_with_http_info(python_python_repository_href, python_python_blocklist_entry, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: RepositoriesPythonBlocklistEntriesApi.create ...'
44
+ end
45
+ # verify the required parameter 'python_python_repository_href' is set
46
+ if @api_client.config.client_side_validation && python_python_repository_href.nil?
47
+ fail ArgumentError, "Missing the required parameter 'python_python_repository_href' when calling RepositoriesPythonBlocklistEntriesApi.create"
48
+ end
49
+ # verify the required parameter 'python_python_blocklist_entry' is set
50
+ if @api_client.config.client_side_validation && python_python_blocklist_entry.nil?
51
+ fail ArgumentError, "Missing the required parameter 'python_python_blocklist_entry' when calling RepositoriesPythonBlocklistEntriesApi.create"
52
+ end
53
+ # resource path
54
+ local_var_path = '{python_python_repository_href}blocklist_entries/'.sub('{' + 'python_python_repository_href' + '}', CGI.escape(python_python_repository_href.to_s).gsub('%2F', '/'))
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+
59
+ # header parameters
60
+ header_params = opts[:header_params] || {}
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
63
+ # HTTP header 'Content-Type'
64
+ content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
65
+ if !content_type.nil?
66
+ header_params['Content-Type'] = content_type
67
+ end
68
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(python_python_blocklist_entry)
75
+
76
+ # return_type
77
+ return_type = opts[:debug_return_type] || 'PythonPythonBlocklistEntryResponse'
78
+
79
+ # auth_names
80
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
81
+
82
+ new_options = opts.merge(
83
+ :operation => :"RepositoriesPythonBlocklistEntriesApi.create",
84
+ :header_params => header_params,
85
+ :query_params => query_params,
86
+ :form_params => form_params,
87
+ :body => post_body,
88
+ :auth_names => auth_names,
89
+ :return_type => return_type
90
+ )
91
+
92
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
93
+ if @api_client.config.debugging
94
+ @api_client.config.logger.debug "API called: RepositoriesPythonBlocklistEntriesApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
95
+ end
96
+ return data, status_code, headers
97
+ end
98
+
99
+ # Delete a python blocklist entry
100
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package `name` (all versions), package `name` + `version`, or exact `filename`. Exactly one of `name` or `filename` must be provided.
101
+ # @param python_python_python_blocklist_entry_href [String]
102
+ # @param [Hash] opts the optional parameters
103
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
104
+ # @return [nil]
105
+ def delete(python_python_python_blocklist_entry_href, opts = {})
106
+ delete_with_http_info(python_python_python_blocklist_entry_href, opts)
107
+ nil
108
+ end
109
+
110
+ # Delete a python blocklist entry
111
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package &#x60;name&#x60; (all versions), package &#x60;name&#x60; + &#x60;version&#x60;, or exact &#x60;filename&#x60;. Exactly one of &#x60;name&#x60; or &#x60;filename&#x60; must be provided.
112
+ # @param python_python_python_blocklist_entry_href [String]
113
+ # @param [Hash] opts the optional parameters
114
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
115
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
116
+ def delete_with_http_info(python_python_python_blocklist_entry_href, opts = {})
117
+ if @api_client.config.debugging
118
+ @api_client.config.logger.debug 'Calling API: RepositoriesPythonBlocklistEntriesApi.delete ...'
119
+ end
120
+ # verify the required parameter 'python_python_python_blocklist_entry_href' is set
121
+ if @api_client.config.client_side_validation && python_python_python_blocklist_entry_href.nil?
122
+ fail ArgumentError, "Missing the required parameter 'python_python_python_blocklist_entry_href' when calling RepositoriesPythonBlocklistEntriesApi.delete"
123
+ end
124
+ # resource path
125
+ local_var_path = '{python_python_python_blocklist_entry_href}'.sub('{' + 'python_python_python_blocklist_entry_href' + '}', CGI.escape(python_python_python_blocklist_entry_href.to_s).gsub('%2F', '/'))
126
+
127
+ # query parameters
128
+ query_params = opts[:query_params] || {}
129
+
130
+ # header parameters
131
+ header_params = opts[:header_params] || {}
132
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
133
+
134
+ # form parameters
135
+ form_params = opts[:form_params] || {}
136
+
137
+ # http body (model)
138
+ post_body = opts[:debug_body]
139
+
140
+ # return_type
141
+ return_type = opts[:debug_return_type]
142
+
143
+ # auth_names
144
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
145
+
146
+ new_options = opts.merge(
147
+ :operation => :"RepositoriesPythonBlocklistEntriesApi.delete",
148
+ :header_params => header_params,
149
+ :query_params => query_params,
150
+ :form_params => form_params,
151
+ :body => post_body,
152
+ :auth_names => auth_names,
153
+ :return_type => return_type
154
+ )
155
+
156
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug "API called: RepositoriesPythonBlocklistEntriesApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
159
+ end
160
+ return data, status_code, headers
161
+ end
162
+
163
+ # List python blocklist entrys
164
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package `name` (all versions), package `name` + `version`, or exact `filename`. Exactly one of `name` or `filename` must be provided.
165
+ # @param python_python_repository_href [String]
166
+ # @param [Hash] opts the optional parameters
167
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
168
+ # @option opts [String] :filename Filter results where filename matches value
169
+ # @option opts [Integer] :limit Number of results to return per page.
170
+ # @option opts [String] :name Filter results where name matches value
171
+ # @option opts [Integer] :offset The initial index from which to return the results.
172
+ # @option opts [Array<String>] :ordering Ordering * &#x60;pulp_id&#x60; - Pulp id * &#x60;-pulp_id&#x60; - Pulp id (descending) * &#x60;pulp_created&#x60; - Pulp created * &#x60;-pulp_created&#x60; - Pulp created (descending) * &#x60;pulp_last_updated&#x60; - Pulp last updated * &#x60;-pulp_last_updated&#x60; - Pulp last updated (descending) * &#x60;name&#x60; - Name * &#x60;-name&#x60; - Name (descending) * &#x60;version&#x60; - Version * &#x60;-version&#x60; - Version (descending) * &#x60;filename&#x60; - Filename * &#x60;-filename&#x60; - Filename (descending) * &#x60;added_by&#x60; - Added by * &#x60;-added_by&#x60; - Added by (descending) * &#x60;pk&#x60; - Pk * &#x60;-pk&#x60; - Pk (descending)
173
+ # @option opts [Array<String>] :prn__in Multiple values may be separated by commas.
174
+ # @option opts [Array<String>] :pulp_href__in Multiple values may be separated by commas.
175
+ # @option opts [Array<String>] :pulp_id__in Multiple values may be separated by commas.
176
+ # @option opts [String] :q Filter results by using NOT, AND and OR operations on other filters
177
+ # @option opts [String] :version Filter results where version matches value
178
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
179
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
180
+ # @return [PaginatedpythonPythonBlocklistEntryResponseList]
181
+ def list(python_python_repository_href, opts = {})
182
+ data, _status_code, _headers = list_with_http_info(python_python_repository_href, opts)
183
+ data
184
+ end
185
+
186
+ # List python blocklist entrys
187
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package &#x60;name&#x60; (all versions), package &#x60;name&#x60; + &#x60;version&#x60;, or exact &#x60;filename&#x60;. Exactly one of &#x60;name&#x60; or &#x60;filename&#x60; must be provided.
188
+ # @param python_python_repository_href [String]
189
+ # @param [Hash] opts the optional parameters
190
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
191
+ # @option opts [String] :filename Filter results where filename matches value
192
+ # @option opts [Integer] :limit Number of results to return per page.
193
+ # @option opts [String] :name Filter results where name matches value
194
+ # @option opts [Integer] :offset The initial index from which to return the results.
195
+ # @option opts [Array<String>] :ordering Ordering * &#x60;pulp_id&#x60; - Pulp id * &#x60;-pulp_id&#x60; - Pulp id (descending) * &#x60;pulp_created&#x60; - Pulp created * &#x60;-pulp_created&#x60; - Pulp created (descending) * &#x60;pulp_last_updated&#x60; - Pulp last updated * &#x60;-pulp_last_updated&#x60; - Pulp last updated (descending) * &#x60;name&#x60; - Name * &#x60;-name&#x60; - Name (descending) * &#x60;version&#x60; - Version * &#x60;-version&#x60; - Version (descending) * &#x60;filename&#x60; - Filename * &#x60;-filename&#x60; - Filename (descending) * &#x60;added_by&#x60; - Added by * &#x60;-added_by&#x60; - Added by (descending) * &#x60;pk&#x60; - Pk * &#x60;-pk&#x60; - Pk (descending)
196
+ # @option opts [Array<String>] :prn__in Multiple values may be separated by commas.
197
+ # @option opts [Array<String>] :pulp_href__in Multiple values may be separated by commas.
198
+ # @option opts [Array<String>] :pulp_id__in Multiple values may be separated by commas.
199
+ # @option opts [String] :q Filter results by using NOT, AND and OR operations on other filters
200
+ # @option opts [String] :version Filter results where version matches value
201
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
202
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
203
+ # @return [Array<(PaginatedpythonPythonBlocklistEntryResponseList, Integer, Hash)>] PaginatedpythonPythonBlocklistEntryResponseList data, response status code and response headers
204
+ def list_with_http_info(python_python_repository_href, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: RepositoriesPythonBlocklistEntriesApi.list ...'
207
+ end
208
+ # verify the required parameter 'python_python_repository_href' is set
209
+ if @api_client.config.client_side_validation && python_python_repository_href.nil?
210
+ fail ArgumentError, "Missing the required parameter 'python_python_repository_href' when calling RepositoriesPythonBlocklistEntriesApi.list"
211
+ end
212
+ allowable_values = ["-added_by", "-filename", "-name", "-pk", "-pulp_created", "-pulp_id", "-pulp_last_updated", "-version", "added_by", "filename", "name", "pk", "pulp_created", "pulp_id", "pulp_last_updated", "version"]
213
+ if @api_client.config.client_side_validation && opts[:'ordering'] && !opts[:'ordering'].all? { |item| allowable_values.include?(item) }
214
+ fail ArgumentError, "invalid value for \"ordering\", must include one of #{allowable_values}"
215
+ end
216
+ # resource path
217
+ local_var_path = '{python_python_repository_href}blocklist_entries/'.sub('{' + 'python_python_repository_href' + '}', CGI.escape(python_python_repository_href.to_s).gsub('%2F', '/'))
218
+
219
+ # query parameters
220
+ query_params = opts[:query_params] || {}
221
+ query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil?
222
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
223
+ query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
224
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
225
+ query_params[:'ordering'] = @api_client.build_collection_param(opts[:'ordering'], :csv) if !opts[:'ordering'].nil?
226
+ query_params[:'prn__in'] = @api_client.build_collection_param(opts[:'prn__in'], :csv) if !opts[:'prn__in'].nil?
227
+ query_params[:'pulp_href__in'] = @api_client.build_collection_param(opts[:'pulp_href__in'], :csv) if !opts[:'pulp_href__in'].nil?
228
+ query_params[:'pulp_id__in'] = @api_client.build_collection_param(opts[:'pulp_id__in'], :csv) if !opts[:'pulp_id__in'].nil?
229
+ query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
230
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
231
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
232
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
233
+
234
+ # header parameters
235
+ header_params = opts[:header_params] || {}
236
+ # HTTP header 'Accept' (if needed)
237
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
238
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
239
+
240
+ # form parameters
241
+ form_params = opts[:form_params] || {}
242
+
243
+ # http body (model)
244
+ post_body = opts[:debug_body]
245
+
246
+ # return_type
247
+ return_type = opts[:debug_return_type] || 'PaginatedpythonPythonBlocklistEntryResponseList'
248
+
249
+ # auth_names
250
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
251
+
252
+ new_options = opts.merge(
253
+ :operation => :"RepositoriesPythonBlocklistEntriesApi.list",
254
+ :header_params => header_params,
255
+ :query_params => query_params,
256
+ :form_params => form_params,
257
+ :body => post_body,
258
+ :auth_names => auth_names,
259
+ :return_type => return_type
260
+ )
261
+
262
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug "API called: RepositoriesPythonBlocklistEntriesApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
265
+ end
266
+ return data, status_code, headers
267
+ end
268
+
269
+ # Inspect a python blocklist entry
270
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package `name` (all versions), package `name` + `version`, or exact `filename`. Exactly one of `name` or `filename` must be provided.
271
+ # @param python_python_python_blocklist_entry_href [String]
272
+ # @param [Hash] opts the optional parameters
273
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
274
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
275
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
276
+ # @return [PythonPythonBlocklistEntryResponse]
277
+ def read(python_python_python_blocklist_entry_href, opts = {})
278
+ data, _status_code, _headers = read_with_http_info(python_python_python_blocklist_entry_href, opts)
279
+ data
280
+ end
281
+
282
+ # Inspect a python blocklist entry
283
+ # ViewSet for managing blocklist entries on a PythonRepository. Blocklist entries prevent packages from being added to the repository. Entries can match by package &#x60;name&#x60; (all versions), package &#x60;name&#x60; + &#x60;version&#x60;, or exact &#x60;filename&#x60;. Exactly one of &#x60;name&#x60; or &#x60;filename&#x60; must be provided.
284
+ # @param python_python_python_blocklist_entry_href [String]
285
+ # @param [Hash] opts the optional parameters
286
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
287
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
288
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
289
+ # @return [Array<(PythonPythonBlocklistEntryResponse, Integer, Hash)>] PythonPythonBlocklistEntryResponse data, response status code and response headers
290
+ def read_with_http_info(python_python_python_blocklist_entry_href, opts = {})
291
+ if @api_client.config.debugging
292
+ @api_client.config.logger.debug 'Calling API: RepositoriesPythonBlocklistEntriesApi.read ...'
293
+ end
294
+ # verify the required parameter 'python_python_python_blocklist_entry_href' is set
295
+ if @api_client.config.client_side_validation && python_python_python_blocklist_entry_href.nil?
296
+ fail ArgumentError, "Missing the required parameter 'python_python_python_blocklist_entry_href' when calling RepositoriesPythonBlocklistEntriesApi.read"
297
+ end
298
+ # resource path
299
+ local_var_path = '{python_python_python_blocklist_entry_href}'.sub('{' + 'python_python_python_blocklist_entry_href' + '}', CGI.escape(python_python_python_blocklist_entry_href.to_s).gsub('%2F', '/'))
300
+
301
+ # query parameters
302
+ query_params = opts[:query_params] || {}
303
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
304
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
305
+
306
+ # header parameters
307
+ header_params = opts[:header_params] || {}
308
+ # HTTP header 'Accept' (if needed)
309
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
310
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
311
+
312
+ # form parameters
313
+ form_params = opts[:form_params] || {}
314
+
315
+ # http body (model)
316
+ post_body = opts[:debug_body]
317
+
318
+ # return_type
319
+ return_type = opts[:debug_return_type] || 'PythonPythonBlocklistEntryResponse'
320
+
321
+ # auth_names
322
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
323
+
324
+ new_options = opts.merge(
325
+ :operation => :"RepositoriesPythonBlocklistEntriesApi.read",
326
+ :header_params => header_params,
327
+ :query_params => query_params,
328
+ :form_params => form_params,
329
+ :body => post_body,
330
+ :auth_names => auth_names,
331
+ :return_type => return_type
332
+ )
333
+
334
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
335
+ if @api_client.config.debugging
336
+ @api_client.config.logger.debug "API called: RepositoriesPythonBlocklistEntriesApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
337
+ end
338
+ return data, status_code, headers
339
+ end
340
+ end
341
+ end
@@ -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 PulpPythonClient
17
+ class PaginatedpythonPythonBlocklistEntryResponseList
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<PythonPythonBlocklistEntryResponse>'
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 `PulpPythonClient::PaginatedpythonPythonBlocklistEntryResponseList` 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 `PulpPythonClient::PaginatedpythonPythonBlocklistEntryResponseList`. 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 = PulpPythonClient.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