pulpcore_client 3.0.0rc4 → 3.0.0rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -4
  3. data/docs/ArtifactsApi.md +12 -6
  4. data/docs/ContentSummary.md +21 -0
  5. data/docs/InlineResponse200.md +3 -3
  6. data/docs/InlineResponse2001.md +3 -3
  7. data/docs/InlineResponse2002.md +3 -3
  8. data/docs/InlineResponse2003.md +3 -3
  9. data/docs/InlineResponse2004.md +3 -3
  10. data/docs/InlineResponse2005.md +3 -3
  11. data/docs/RepositoriesApi.md +9 -3
  12. data/docs/RepositoriesVersionsApi.md +12 -6
  13. data/docs/RepositoryVersion.md +1 -1
  14. data/docs/StatusApi.md +9 -3
  15. data/docs/Task.md +4 -2
  16. data/docs/TasksApi.md +16 -6
  17. data/docs/UploadsApi.md +13 -7
  18. data/docs/WorkersApi.md +12 -6
  19. data/git_push.sh +10 -7
  20. data/lib/pulpcore_client/api/artifacts_api.rb +15 -9
  21. data/lib/pulpcore_client/api/orphans_api.rb +1 -1
  22. data/lib/pulpcore_client/api/repositories_api.rb +11 -5
  23. data/lib/pulpcore_client/api/repositories_versions_api.rb +17 -11
  24. data/lib/pulpcore_client/api/status_api.rb +4 -1
  25. data/lib/pulpcore_client/api/tasks_api.rb +22 -10
  26. data/lib/pulpcore_client/api/uploads_api.rb +19 -13
  27. data/lib/pulpcore_client/api/workers_api.rb +14 -8
  28. data/lib/pulpcore_client/api_client.rb +65 -64
  29. data/lib/pulpcore_client/api_error.rb +1 -1
  30. data/lib/pulpcore_client/configuration.rb +12 -17
  31. data/lib/pulpcore_client/models/artifact.rb +1 -1
  32. data/lib/pulpcore_client/models/async_operation_response.rb +1 -1
  33. data/lib/pulpcore_client/models/content_app_status.rb +1 -1
  34. data/lib/pulpcore_client/models/content_summary.rb +236 -0
  35. data/lib/pulpcore_client/models/database_connection.rb +1 -1
  36. data/lib/pulpcore_client/models/inline_response200.rb +11 -11
  37. data/lib/pulpcore_client/models/inline_response2001.rb +11 -11
  38. data/lib/pulpcore_client/models/inline_response2002.rb +11 -11
  39. data/lib/pulpcore_client/models/inline_response2003.rb +11 -11
  40. data/lib/pulpcore_client/models/inline_response2004.rb +11 -11
  41. data/lib/pulpcore_client/models/inline_response2005.rb +11 -11
  42. data/lib/pulpcore_client/models/progress_report.rb +1 -1
  43. data/lib/pulpcore_client/models/redis_connection.rb +1 -1
  44. data/lib/pulpcore_client/models/repository.rb +1 -1
  45. data/lib/pulpcore_client/models/repository_version.rb +2 -3
  46. data/lib/pulpcore_client/models/repository_version_create.rb +1 -1
  47. data/lib/pulpcore_client/models/status.rb +1 -1
  48. data/lib/pulpcore_client/models/task.rb +20 -7
  49. data/lib/pulpcore_client/models/task_cancel.rb +1 -1
  50. data/lib/pulpcore_client/models/upload.rb +1 -1
  51. data/lib/pulpcore_client/models/upload_chunk_detail.rb +1 -1
  52. data/lib/pulpcore_client/models/upload_commit.rb +1 -1
  53. data/lib/pulpcore_client/models/upload_detail.rb +1 -1
  54. data/lib/pulpcore_client/models/version.rb +1 -1
  55. data/lib/pulpcore_client/models/worker.rb +1 -1
  56. data/lib/pulpcore_client/version.rb +2 -2
  57. data/lib/pulpcore_client.rb +2 -1
  58. data/pulpcore_client.gemspec +1 -3
  59. data/spec/api/artifacts_api_spec.rb +5 -3
  60. data/spec/api/orphans_api_spec.rb +1 -1
  61. data/spec/api/repositories_api_spec.rb +3 -1
  62. data/spec/api/repositories_versions_api_spec.rb +5 -3
  63. data/spec/api/status_api_spec.rb +2 -1
  64. data/spec/api/tasks_api_spec.rb +7 -3
  65. data/spec/api/uploads_api_spec.rb +6 -4
  66. data/spec/api/workers_api_spec.rb +5 -3
  67. data/spec/api_client_spec.rb +1 -39
  68. data/spec/configuration_spec.rb +1 -1
  69. data/spec/models/artifact_spec.rb +1 -1
  70. data/spec/models/async_operation_response_spec.rb +1 -1
  71. data/spec/models/content_app_status_spec.rb +1 -1
  72. data/spec/models/content_summary_spec.rb +53 -0
  73. data/spec/models/database_connection_spec.rb +1 -1
  74. data/spec/models/inline_response2001_spec.rb +4 -4
  75. data/spec/models/inline_response2002_spec.rb +4 -4
  76. data/spec/models/inline_response2003_spec.rb +4 -4
  77. data/spec/models/inline_response2004_spec.rb +4 -4
  78. data/spec/models/inline_response2005_spec.rb +4 -4
  79. data/spec/models/inline_response200_spec.rb +4 -4
  80. data/spec/models/progress_report_spec.rb +1 -1
  81. data/spec/models/redis_connection_spec.rb +1 -1
  82. data/spec/models/repository_spec.rb +1 -1
  83. data/spec/models/repository_version_create_spec.rb +1 -1
  84. data/spec/models/repository_version_spec.rb +1 -1
  85. data/spec/models/status_spec.rb +1 -1
  86. data/spec/models/task_cancel_spec.rb +1 -1
  87. data/spec/models/task_spec.rb +7 -1
  88. data/spec/models/upload_chunk_detail_spec.rb +1 -1
  89. data/spec/models/upload_commit_spec.rb +1 -1
  90. data/spec/models/upload_detail_spec.rb +1 -1
  91. data/spec/models/upload_spec.rb +1 -1
  92. data/spec/models/version_spec.rb +1 -1
  93. data/spec/models/worker_spec.rb +1 -1
  94. data/spec/spec_helper.rb +1 -1
  95. metadata +6 -42
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
@@ -31,8 +31,9 @@ module PulpcoreClient
31
31
  # @option opts [String] :online
32
32
  # @option opts [String] :missing
33
33
  # @option opts [String] :last_heartbeat ISO 8601 formatted dates are supported
34
- # @option opts [Integer] :page A page number within the paginated result set.
35
- # @option opts [Integer] :page_size Number of results to return per page.
34
+ # @option opts [Integer] :limit Number of results to return per page.
35
+ # @option opts [Integer] :offset The initial index from which to return the results.
36
+ # @option opts [String] :fields A list of fields to include in the response.
36
37
  # @return [InlineResponse2005]
37
38
  def list(opts = {})
38
39
  data, _status_code, _headers = list_with_http_info(opts)
@@ -51,8 +52,9 @@ module PulpcoreClient
51
52
  # @option opts [String] :online
52
53
  # @option opts [String] :missing
53
54
  # @option opts [String] :last_heartbeat ISO 8601 formatted dates are supported
54
- # @option opts [Integer] :page A page number within the paginated result set.
55
- # @option opts [Integer] :page_size Number of results to return per page.
55
+ # @option opts [Integer] :limit Number of results to return per page.
56
+ # @option opts [Integer] :offset The initial index from which to return the results.
57
+ # @option opts [String] :fields A list of fields to include in the response.
56
58
  # @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers
57
59
  def list_with_http_info(opts = {})
58
60
  if @api_client.config.debugging
@@ -73,8 +75,9 @@ module PulpcoreClient
73
75
  query_params[:'online'] = opts[:'online'] if !opts[:'online'].nil?
74
76
  query_params[:'missing'] = opts[:'missing'] if !opts[:'missing'].nil?
75
77
  query_params[:'last_heartbeat'] = opts[:'last_heartbeat'] if !opts[:'last_heartbeat'].nil?
76
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
77
- query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
78
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
79
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
80
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
78
81
 
79
82
  # header parameters
80
83
  header_params = opts[:header_params] || {}
@@ -112,6 +115,7 @@ module PulpcoreClient
112
115
  # Inspect a worker
113
116
  # @param worker_href [String] URI of Worker. e.g.: /pulp/api/v3/workers/1/
114
117
  # @param [Hash] opts the optional parameters
118
+ # @option opts [String] :fields A list of fields to include in the response.
115
119
  # @return [Worker]
116
120
  def read(worker_href, opts = {})
117
121
  data, _status_code, _headers = read_with_http_info(worker_href, opts)
@@ -121,6 +125,7 @@ module PulpcoreClient
121
125
  # Inspect a worker
122
126
  # @param worker_href [String] URI of Worker. e.g.: /pulp/api/v3/workers/1/
123
127
  # @param [Hash] opts the optional parameters
128
+ # @option opts [String] :fields A list of fields to include in the response.
124
129
  # @return [Array<(Worker, Integer, Hash)>] Worker data, response status code and response headers
125
130
  def read_with_http_info(worker_href, opts = {})
126
131
  if @api_client.config.debugging
@@ -131,10 +136,11 @@ module PulpcoreClient
131
136
  fail ArgumentError, "Missing the required parameter 'worker_href' when calling WorkersApi.read"
132
137
  end
133
138
  # resource path
134
- local_var_path = '{worker_href}'.sub('{' + 'worker_href' + '}', CGI.escape(worker_href.to_s)).gsub('%2F', '/')
139
+ local_var_path = '{worker_href}'.sub('{' + 'worker_href' + '}', CGI.escape(worker_href.to_s).gsub('%2F', '/'))
135
140
 
136
141
  # query parameters
137
142
  query_params = opts[:query_params] || {}
143
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
138
144
 
139
145
  # header parameters
140
146
  header_params = opts[:header_params] || {}
@@ -6,15 +6,15 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
- require 'faraday'
15
14
  require 'json'
16
15
  require 'logger'
17
16
  require 'tempfile'
17
+ require 'faraday'
18
18
 
19
19
  module PulpcoreClient
20
20
  class ApiClient
@@ -46,37 +46,46 @@ module PulpcoreClient
46
46
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
47
47
  # the data deserialized from response body (could be nil), response status code and response headers.
48
48
  def call_api(http_method, path, opts = {})
49
- connection = Faraday.new(:url => config.base_url) do |conn|
49
+ ssl_options = {
50
+ :ca_file => @config.ssl_ca_file,
51
+ :verify => @config.ssl_verify,
52
+ :verify_mode => @config.ssl_verify_mode,
53
+ :client_cert => @config.ssl_client_cert,
54
+ :client_key => @config.ssl_client_key
55
+ }
56
+
57
+ connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
50
58
  conn.basic_auth(config.username, config.password)
51
59
  if opts[:header_params]["Content-Type"] == "multipart/form-data"
52
- conn.request :multipart
53
- conn.request :url_encoded
60
+ conn.request :multipart
61
+ conn.request :url_encoded
54
62
  end
55
63
  conn.adapter(Faraday.default_adapter)
56
64
  end
65
+
57
66
  begin
58
- response = connection.public_send(http_method.to_sym.downcase) do |req|
59
- build_request(http_method, path, req, opts)
60
- end
67
+ response = connection.public_send(http_method.to_sym.downcase) do |req|
68
+ build_request(http_method, path, req, opts)
69
+ end
61
70
 
62
- if @config.debugging
63
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
64
- end
71
+ if @config.debugging
72
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
73
+ end
65
74
 
66
- unless response.success?
67
- if response.status == 0
68
- # Errors from libcurl will be made visible here
69
- fail ApiError.new(:code => 0,
70
- :message => response.return_message)
71
- else
72
- fail ApiError.new(:code => response.status,
73
- :response_headers => response.headers,
74
- :response_body => response.body),
75
- response.reason_phrase
76
- end
75
+ unless response.success?
76
+ if response.status == 0
77
+ # Errors from libcurl will be made visible here
78
+ fail ApiError.new(:code => 0,
79
+ :message => response.return_message)
80
+ else
81
+ fail ApiError.new(:code => response.status,
82
+ :response_headers => response.headers,
83
+ :response_body => response.body),
84
+ response.reason_phrase
77
85
  end
86
+ end
78
87
  rescue Faraday::TimeoutError
79
- fail ApiError.new('Connection timed out')
88
+ fail ApiError.new('Connection timed out')
80
89
  end
81
90
 
82
91
  if opts[:return_type]
@@ -106,25 +115,15 @@ module PulpcoreClient
106
115
 
107
116
  update_params_for_auth! header_params, query_params, opts[:auth_names]
108
117
 
109
- # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
110
- _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
111
-
112
118
  req_opts = {
113
119
  :method => http_method,
114
120
  :headers => header_params,
115
121
  :params => query_params,
116
122
  :params_encoding => @config.params_encoding,
117
123
  :timeout => @config.timeout,
118
- :ssl_verifypeer => @config.verify_ssl,
119
- :ssl_verifyhost => _verify_ssl_host,
120
- :sslcert => @config.cert_file,
121
- :sslkey => @config.key_file,
122
124
  :verbose => @config.debugging
123
125
  }
124
126
 
125
- # set custom cert, if provided
126
- req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
127
-
128
127
  if [:post, :patch, :put, :delete].include?(http_method)
129
128
  req_body = build_request_body(header_params, form_params, opts[:body])
130
129
  req_opts.update :body => req_body
@@ -134,12 +133,44 @@ module PulpcoreClient
134
133
  end
135
134
  request.headers = header_params
136
135
  request.body = req_body
136
+ request.url url
137
137
  request.params = query_params
138
- request.url path
139
138
  download_file(request) if opts[:return_type] == 'File'
140
139
  request
141
140
  end
142
141
 
142
+ # Builds the HTTP request body
143
+ #
144
+ # @param [Hash] header_params Header parameters
145
+ # @param [Hash] form_params Query parameters
146
+ # @param [Object] body HTTP body (JSON/XML)
147
+ # @return [String] HTTP body data in the form of string
148
+ def build_request_body(header_params, form_params, body)
149
+ # http form
150
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
151
+ data = URI.encode_www_form(form_params)
152
+ elsif header_params['Content-Type'] == 'multipart/form-data'
153
+ data = {}
154
+ form_params.each do |key, value|
155
+ case value
156
+ when ::File, ::Tempfile
157
+ # TODO hardcode to application/octet-stream, need better way to detect content type
158
+ data[key] = Faraday::UploadIO.new(value.path, 'application/octet-stream', value.path)
159
+ when ::Array, nil
160
+ # let Faraday handle Array and nil parameters
161
+ data[key] = value
162
+ else
163
+ data[key] = value.to_s
164
+ end
165
+ end
166
+ elsif body
167
+ data = body.is_a?(String) ? body : body.to_json
168
+ else
169
+ data = nil
170
+ end
171
+ data
172
+ end
173
+
143
174
  # Check if the given MIME is a JSON MIME.
144
175
  # JSON MIME examples:
145
176
  # application/json
@@ -277,36 +308,6 @@ module PulpcoreClient
277
308
  @config.base_url + path
278
309
  end
279
310
 
280
- # Builds the HTTP request body
281
- #
282
- # @param [Hash] header_params Header parameters
283
- # @param [Hash] form_params Query parameters
284
- # @param [Object] body HTTP body (JSON/XML)
285
- # @return [String] HTTP body data in the form of string
286
- def build_request_body(header_params, form_params, body)
287
- # http form
288
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
289
- header_params['Content-Type'] == 'multipart/form-data'
290
- data = {}
291
- form_params.each do |key, value|
292
- case value
293
- when ::File, ::Tempfile
294
- data[key] = Faraday::UploadIO.new(value.path, '')
295
- when ::Array, nil
296
- # let Faraday handle Array and nil parameters
297
- data[key] = value
298
- else
299
- data[key] = value.to_s
300
- end
301
- end
302
- elsif body
303
- data = body.is_a?(String) ? body : body.to_json
304
- else
305
- data = nil
306
- end
307
- data
308
- end
309
-
310
311
  # Update hearder and query params based on authentication settings.
311
312
  #
312
313
  # @param [Hash] header_params Header parameters
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
@@ -86,33 +86,28 @@ module PulpcoreClient
86
86
  # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
87
87
  #
88
88
  # @return [true, false]
89
- attr_accessor :verify_ssl
89
+ attr_accessor :ssl_verify
90
90
 
91
91
  ### TLS/SSL setting
92
- # Set this to false to skip verifying SSL host name
93
- # Default to true.
92
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
94
93
  #
95
94
  # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
96
95
  #
97
- # @return [true, false]
98
- attr_accessor :verify_ssl_host
96
+ attr_accessor :ssl_verify_mode
99
97
 
100
98
  ### TLS/SSL setting
101
99
  # Set this to customize the certificate file to verify the peer.
102
100
  #
103
101
  # @return [String] the path to the certificate file
104
- #
105
- # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
106
- # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
107
- attr_accessor :ssl_ca_cert
102
+ attr_accessor :ssl_ca_file
108
103
 
109
104
  ### TLS/SSL setting
110
105
  # Client certificate file (for client certificate)
111
- attr_accessor :cert_file
106
+ attr_accessor :ssl_client_cert
112
107
 
113
108
  ### TLS/SSL setting
114
109
  # Client private key file (for client certificate)
115
- attr_accessor :key_file
110
+ attr_accessor :ssl_client_key
116
111
 
117
112
  # Set this to customize parameters encoding of array parameter with multi collectionFormat.
118
113
  # Default to nil.
@@ -133,11 +128,11 @@ module PulpcoreClient
133
128
  @api_key_prefix = {}
134
129
  @timeout = 0
135
130
  @client_side_validation = true
136
- @verify_ssl = true
137
- @verify_ssl_host = true
138
- @params_encoding = nil
139
- @cert_file = nil
140
- @key_file = nil
131
+ @ssl_verify = true
132
+ @ssl_verify_mode = nil
133
+ @ssl_ca_file = nil
134
+ @ssl_client_cert = nil
135
+ @ssl_client_key = nil
141
136
  @debugging = false
142
137
  @inject_format = false
143
138
  @force_ending_format = false
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,236 @@
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.1.2
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
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.2
9
+ OpenAPI Generator version: 4.1.2
10
10
 
11
11
  =end
12
12