pulp_ostree_client 2.4.5 → 2.4.6

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 (175) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -12
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentCommitsApi.md +80 -47
  5. data/docs/ContentConfigsApi.md +79 -46
  6. data/docs/ContentContentApi.md +107 -57
  7. data/docs/ContentObjectsApi.md +80 -47
  8. data/docs/ContentRefsApi.md +90 -57
  9. data/docs/ContentSummariesApi.md +79 -46
  10. data/docs/ContentSummaryResponse.md +12 -11
  11. data/docs/DistributionsOstreeApi.md +385 -182
  12. data/docs/MyPermissionsResponse.md +8 -7
  13. data/docs/NestedRole.md +12 -11
  14. data/docs/NestedRoleResponse.md +12 -11
  15. data/docs/ObjectRolesResponse.md +8 -7
  16. data/docs/OstreeImportAll.md +10 -9
  17. data/docs/OstreeImportCommitsToRef.md +12 -11
  18. data/docs/OstreeOstreeCommitResponse.md +24 -23
  19. data/docs/OstreeOstreeConfigResponse.md +18 -17
  20. data/docs/OstreeOstreeContent.md +14 -13
  21. data/docs/OstreeOstreeContentResponse.md +20 -19
  22. data/docs/OstreeOstreeDistribution.md +20 -19
  23. data/docs/OstreeOstreeDistributionResponse.md +32 -31
  24. data/docs/OstreeOstreeObjectResponse.md +22 -21
  25. data/docs/OstreeOstreeRefResponse.md +24 -23
  26. data/docs/OstreeOstreeRemote.md +54 -53
  27. data/docs/OstreeOstreeRemoteResponse.md +54 -53
  28. data/docs/OstreeOstreeRemoteResponseHiddenFieldsInner.md +20 -0
  29. data/docs/OstreeOstreeRepository.md +18 -17
  30. data/docs/OstreeOstreeRepositoryResponse.md +30 -29
  31. data/docs/OstreeOstreeSummaryResponse.md +18 -17
  32. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  33. data/docs/PaginatedostreeOstreeCommitResponseList.md +14 -13
  34. data/docs/PaginatedostreeOstreeConfigResponseList.md +14 -13
  35. data/docs/PaginatedostreeOstreeContentResponseList.md +14 -13
  36. data/docs/PaginatedostreeOstreeDistributionResponseList.md +14 -13
  37. data/docs/PaginatedostreeOstreeObjectResponseList.md +14 -13
  38. data/docs/PaginatedostreeOstreeRefResponseList.md +14 -13
  39. data/docs/PaginatedostreeOstreeRemoteResponseList.md +14 -13
  40. data/docs/PaginatedostreeOstreeRepositoryResponseList.md +14 -13
  41. data/docs/PaginatedostreeOstreeSummaryResponseList.md +14 -13
  42. data/docs/PatchedostreeOstreeDistribution.md +20 -19
  43. data/docs/PatchedostreeOstreeRemote.md +54 -53
  44. data/docs/PatchedostreeOstreeRepository.md +18 -17
  45. data/docs/PolicyEnum.md +4 -5
  46. data/docs/RemotesOstreeApi.md +389 -184
  47. data/docs/Repair.md +8 -7
  48. data/docs/RepositoriesOstreeApi.md +502 -231
  49. data/docs/RepositoriesOstreeVersionsApi.md +152 -82
  50. data/docs/RepositoryAddRemoveContent.md +12 -11
  51. data/docs/RepositorySyncURL.md +10 -9
  52. data/docs/RepositoryVersionResponse.md +22 -21
  53. data/docs/SetLabel.md +10 -9
  54. data/docs/SetLabelResponse.md +10 -9
  55. data/docs/UnsetLabel.md +8 -7
  56. data/docs/UnsetLabelResponse.md +10 -9
  57. data/lib/pulp_ostree_client/api/content_commits_api.rb +11 -9
  58. data/lib/pulp_ostree_client/api/content_configs_api.rb +11 -9
  59. data/lib/pulp_ostree_client/api/content_content_api.rb +20 -14
  60. data/lib/pulp_ostree_client/api/content_objects_api.rb +11 -9
  61. data/lib/pulp_ostree_client/api/content_refs_api.rb +11 -9
  62. data/lib/pulp_ostree_client/api/content_summaries_api.rb +11 -9
  63. data/lib/pulp_ostree_client/api/distributions_ostree_api.rb +89 -56
  64. data/lib/pulp_ostree_client/api/remotes_ostree_api.rb +104 -68
  65. data/lib/pulp_ostree_client/api/repositories_ostree_api.rb +125 -76
  66. data/lib/pulp_ostree_client/api/repositories_ostree_versions_api.rb +40 -30
  67. data/lib/pulp_ostree_client/api_client.rb +137 -102
  68. data/lib/pulp_ostree_client/api_error.rb +2 -1
  69. data/lib/pulp_ostree_client/configuration.rb +162 -21
  70. data/lib/pulp_ostree_client/models/async_operation_response.rb +32 -22
  71. data/lib/pulp_ostree_client/models/content_summary_response.rb +36 -22
  72. data/lib/pulp_ostree_client/models/my_permissions_response.rb +32 -22
  73. data/lib/pulp_ostree_client/models/nested_role.rb +32 -22
  74. data/lib/pulp_ostree_client/models/nested_role_response.rb +32 -22
  75. data/lib/pulp_ostree_client/models/object_roles_response.rb +32 -22
  76. data/lib/pulp_ostree_client/models/ostree_import_all.rb +34 -22
  77. data/lib/pulp_ostree_client/models/ostree_import_commits_to_ref.rb +36 -22
  78. data/lib/pulp_ostree_client/models/ostree_ostree_commit_response.rb +40 -24
  79. data/lib/pulp_ostree_client/models/ostree_ostree_config_response.rb +36 -24
  80. data/lib/pulp_ostree_client/models/ostree_ostree_content.rb +36 -22
  81. data/lib/pulp_ostree_client/models/ostree_ostree_content_response.rb +38 -24
  82. data/lib/pulp_ostree_client/models/ostree_ostree_distribution.rb +34 -22
  83. data/lib/pulp_ostree_client/models/ostree_ostree_distribution_response.rb +36 -24
  84. data/lib/pulp_ostree_client/models/ostree_ostree_object_response.rb +40 -24
  85. data/lib/pulp_ostree_client/models/ostree_ostree_ref_response.rb +40 -24
  86. data/lib/pulp_ostree_client/models/ostree_ostree_remote.rb +61 -23
  87. data/lib/pulp_ostree_client/models/ostree_ostree_remote_response.rb +64 -26
  88. data/lib/pulp_ostree_client/models/{ostree_ostree_remote_response_hidden_fields.rb → ostree_ostree_remote_response_hidden_fields_inner.rb} +37 -25
  89. data/lib/pulp_ostree_client/models/ostree_ostree_repository.rb +32 -22
  90. data/lib/pulp_ostree_client/models/ostree_ostree_repository_response.rb +34 -24
  91. data/lib/pulp_ostree_client/models/ostree_ostree_summary_response.rb +36 -24
  92. data/lib/pulp_ostree_client/models/paginated_repository_version_response_list.rb +34 -22
  93. data/lib/pulp_ostree_client/models/paginatedostree_ostree_commit_response_list.rb +34 -22
  94. data/lib/pulp_ostree_client/models/paginatedostree_ostree_config_response_list.rb +34 -22
  95. data/lib/pulp_ostree_client/models/paginatedostree_ostree_content_response_list.rb +34 -22
  96. data/lib/pulp_ostree_client/models/paginatedostree_ostree_distribution_response_list.rb +34 -22
  97. data/lib/pulp_ostree_client/models/paginatedostree_ostree_object_response_list.rb +34 -22
  98. data/lib/pulp_ostree_client/models/paginatedostree_ostree_ref_response_list.rb +34 -22
  99. data/lib/pulp_ostree_client/models/paginatedostree_ostree_remote_response_list.rb +34 -22
  100. data/lib/pulp_ostree_client/models/paginatedostree_ostree_repository_response_list.rb +34 -22
  101. data/lib/pulp_ostree_client/models/paginatedostree_ostree_summary_response_list.rb +34 -22
  102. data/lib/pulp_ostree_client/models/patchedostree_ostree_distribution.rb +40 -24
  103. data/lib/pulp_ostree_client/models/patchedostree_ostree_remote.rb +67 -25
  104. data/lib/pulp_ostree_client/models/patchedostree_ostree_repository.rb +35 -23
  105. data/lib/pulp_ostree_client/models/policy_enum.rb +8 -4
  106. data/lib/pulp_ostree_client/models/repair.rb +30 -22
  107. data/lib/pulp_ostree_client/models/repository_add_remove_content.rb +30 -22
  108. data/lib/pulp_ostree_client/models/repository_sync_url.rb +30 -22
  109. data/lib/pulp_ostree_client/models/repository_version_response.rb +32 -24
  110. data/lib/pulp_ostree_client/models/set_label.rb +34 -22
  111. data/lib/pulp_ostree_client/models/set_label_response.rb +34 -22
  112. data/lib/pulp_ostree_client/models/unset_label.rb +32 -22
  113. data/lib/pulp_ostree_client/models/unset_label_response.rb +32 -22
  114. data/lib/pulp_ostree_client/version.rb +2 -2
  115. data/lib/pulp_ostree_client.rb +2 -2
  116. data/pulp_ostree_client.gemspec +9 -6
  117. data/spec/api/content_commits_api_spec.rb +3 -3
  118. data/spec/api/content_configs_api_spec.rb +3 -3
  119. data/spec/api/content_content_api_spec.rb +4 -4
  120. data/spec/api/content_objects_api_spec.rb +3 -3
  121. data/spec/api/content_refs_api_spec.rb +3 -3
  122. data/spec/api/content_summaries_api_spec.rb +3 -3
  123. data/spec/api/distributions_ostree_api_spec.rb +13 -13
  124. data/spec/api/remotes_ostree_api_spec.rb +20 -19
  125. data/spec/api/repositories_ostree_api_spec.rb +17 -17
  126. data/spec/api/repositories_ostree_versions_api_spec.rb +12 -11
  127. data/spec/models/async_operation_response_spec.rb +7 -12
  128. data/spec/models/content_summary_response_spec.rb +9 -14
  129. data/spec/models/my_permissions_response_spec.rb +7 -12
  130. data/spec/models/nested_role_response_spec.rb +9 -14
  131. data/spec/models/nested_role_spec.rb +9 -14
  132. data/spec/models/object_roles_response_spec.rb +7 -12
  133. data/spec/models/ostree_import_all_spec.rb +8 -13
  134. data/spec/models/ostree_import_commits_to_ref_spec.rb +9 -14
  135. data/spec/models/ostree_ostree_commit_response_spec.rb +15 -20
  136. data/spec/models/ostree_ostree_config_response_spec.rb +12 -17
  137. data/spec/models/ostree_ostree_content_response_spec.rb +13 -18
  138. data/spec/models/ostree_ostree_content_spec.rb +10 -15
  139. data/spec/models/ostree_ostree_distribution_response_spec.rb +19 -24
  140. data/spec/models/ostree_ostree_distribution_spec.rb +13 -18
  141. data/spec/models/ostree_ostree_object_response_spec.rb +14 -19
  142. data/spec/models/ostree_ostree_ref_response_spec.rb +15 -20
  143. data/spec/models/{ostree_ostree_remote_response_hidden_fields_spec.rb → ostree_ostree_remote_response_hidden_fields_inner_spec.rb} +11 -16
  144. data/spec/models/ostree_ostree_remote_response_spec.rb +30 -35
  145. data/spec/models/ostree_ostree_remote_spec.rb +30 -35
  146. data/spec/models/ostree_ostree_repository_response_spec.rb +18 -23
  147. data/spec/models/ostree_ostree_repository_spec.rb +12 -17
  148. data/spec/models/ostree_ostree_summary_response_spec.rb +12 -17
  149. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  150. data/spec/models/paginatedostree_ostree_commit_response_list_spec.rb +10 -15
  151. data/spec/models/paginatedostree_ostree_config_response_list_spec.rb +10 -15
  152. data/spec/models/paginatedostree_ostree_content_response_list_spec.rb +10 -15
  153. data/spec/models/paginatedostree_ostree_distribution_response_list_spec.rb +10 -15
  154. data/spec/models/paginatedostree_ostree_object_response_list_spec.rb +10 -15
  155. data/spec/models/paginatedostree_ostree_ref_response_list_spec.rb +10 -15
  156. data/spec/models/paginatedostree_ostree_remote_response_list_spec.rb +10 -15
  157. data/spec/models/paginatedostree_ostree_repository_response_list_spec.rb +10 -15
  158. data/spec/models/paginatedostree_ostree_summary_response_list_spec.rb +10 -15
  159. data/spec/models/patchedostree_ostree_distribution_spec.rb +13 -18
  160. data/spec/models/patchedostree_ostree_remote_spec.rb +30 -35
  161. data/spec/models/patchedostree_ostree_repository_spec.rb +12 -17
  162. data/spec/models/policy_enum_spec.rb +6 -11
  163. data/spec/models/repair_spec.rb +7 -12
  164. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  165. data/spec/models/repository_sync_url_spec.rb +8 -13
  166. data/spec/models/repository_version_response_spec.rb +14 -19
  167. data/spec/models/set_label_response_spec.rb +8 -13
  168. data/spec/models/set_label_spec.rb +8 -13
  169. data/spec/models/unset_label_response_spec.rb +8 -13
  170. data/spec/models/unset_label_spec.rb +7 -12
  171. data/spec/spec_helper.rb +1 -1
  172. metadata +84 -60
  173. data/docs/OstreeOstreeRemoteResponseHiddenFields.md +0 -19
  174. data/spec/api_client_spec.rb +0 -188
  175. data/spec/configuration_spec.rb +0 -42
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
@@ -21,6 +21,18 @@ module PulpOstreeClient
21
21
  # Defines url base path
22
22
  attr_accessor :base_path
23
23
 
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
24
36
  # Defines API keys used with API Key authentications.
25
37
  #
26
38
  # @return [Hash] key: parameter name, value: parameter value (API key)
@@ -50,6 +62,16 @@ module PulpOstreeClient
50
62
  # Defines the access token (Bearer) used with OAuth2.
51
63
  attr_accessor :access_token
52
64
 
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
53
75
  # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
54
76
  # details will be logged with `logger.debug` (see the `logger` attribute).
55
77
  # Default to false.
@@ -57,6 +79,14 @@ module PulpOstreeClient
57
79
  # @return [true, false]
58
80
  attr_accessor :debugging
59
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
60
90
  # Defines the logger used for debugging.
61
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
62
92
  #
@@ -109,18 +139,17 @@ module PulpOstreeClient
109
139
  # Client private key file (for client certificate)
110
140
  attr_accessor :ssl_client_key
111
141
 
142
+ ### Proxy setting
143
+ # HTTP Proxy settings
144
+ attr_accessor :proxy
145
+
112
146
  # Set this to customize parameters encoder of array parameter.
113
147
  # Default to nil. Faraday uses NestedParamsEncoder when nil.
114
148
  #
115
149
  # @see The params_encoder option of Faraday. Related source code:
116
150
  # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
117
151
  attr_accessor :params_encoder
118
- # Set this to customize parameters encoding of array parameter with multi collectionFormat.
119
- # Default to nil.
120
- #
121
- # @see The params_encoding option of Ethon. Related source code:
122
- # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
123
- attr_accessor :params_encoding
152
+
124
153
 
125
154
  attr_accessor :inject_format
126
155
 
@@ -128,20 +157,28 @@ module PulpOstreeClient
128
157
 
129
158
  def initialize
130
159
  @scheme = 'http'
131
- @host = 'localhost'
160
+ @host = 'localhost:24817'
132
161
  @base_path = ''
162
+ @server_index = nil
163
+ @server_operation_index = {}
164
+ @server_variables = {}
165
+ @server_operation_variables = {}
133
166
  @api_key = {}
134
167
  @api_key_prefix = {}
135
- @timeout = 0
136
168
  @client_side_validation = true
137
169
  @ssl_verify = true
138
170
  @ssl_verify_mode = nil
139
171
  @ssl_ca_file = nil
140
172
  @ssl_client_cert = nil
141
173
  @ssl_client_key = nil
142
- @params_encoder = nil
174
+ @middlewares = Hash.new { |h, k| h[k] = [] }
175
+ @configure_connection_blocks = []
143
176
  @timeout = 60
177
+ # return data as binary instead of file
178
+ @return_binary_data = false
179
+ @params_encoder = nil
144
180
  @debugging = false
181
+ @ignore_operation_servers = false
145
182
  @inject_format = false
146
183
  @force_ending_format = false
147
184
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -174,20 +211,35 @@ module PulpOstreeClient
174
211
  @base_path = '' if @base_path == '/'
175
212
  end
176
213
 
177
- def base_url
178
- "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
214
+ # Returns base URL for specified operation based on server settings
215
+ def base_url(operation = nil)
216
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
217
+ if operation_server_settings.key?(operation) then
218
+ index = server_operation_index.fetch(operation, server_index)
219
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
220
+ else
221
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
222
+ end
179
223
  end
180
224
 
181
225
  # Gets API key (with prefix if set).
182
226
  # @param [String] param_name the parameter name of API key auth
183
- def api_key_with_prefix(param_name)
227
+ def api_key_with_prefix(param_name, param_alias = nil)
228
+ key = @api_key[param_name]
229
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
184
230
  if @api_key_prefix[param_name]
185
- "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
231
+ "#{@api_key_prefix[param_name]} #{key}"
186
232
  else
187
- @api_key[param_name]
233
+ key
188
234
  end
189
235
  end
190
236
 
237
+ # Gets access_token using access_token_getter or uses the static access_token
238
+ def access_token_with_refresh
239
+ return access_token if access_token_getter.nil?
240
+ access_token_getter.call
241
+ end
242
+
191
243
  # Gets Basic Auth token string
192
244
  def basic_auth_token
193
245
  'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
@@ -210,31 +262,38 @@ module PulpOstreeClient
210
262
  def server_settings
211
263
  [
212
264
  {
213
- url: "http://localhost:24817/",
265
+ url: "http://localhost:24817",
214
266
  description: "No description provided",
215
267
  }
216
268
  ]
217
269
  end
218
270
 
271
+ def operation_server_settings
272
+ {
273
+ }
274
+ end
275
+
219
276
  # Returns URL based on server settings
220
277
  #
221
278
  # @param index array index of the server settings
222
279
  # @param variables hash of variable and the corresponding value
223
- def server_url(index, variables = {})
224
- servers = server_settings
280
+ def server_url(index, variables = {}, servers = nil)
281
+ servers = server_settings if servers == nil
225
282
 
226
283
  # check array index out of bound
227
- if (index < 0 || index >= servers.size)
228
- fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
284
+ if (index.nil? || index < 0 || index >= servers.size)
285
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
229
286
  end
230
287
 
231
288
  server = servers[index]
232
289
  url = server[:url]
233
290
 
291
+ return url unless server.key? :variables
292
+
234
293
  # go through variable and assign a value
235
294
  server[:variables].each do |name, variable|
236
295
  if variables.key?(name)
237
- if (server[:variables][name][:enum_values].include? variables[name])
296
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
238
297
  url.gsub! "{" + name.to_s + "}", variables[name]
239
298
  else
240
299
  fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
@@ -247,5 +306,87 @@ module PulpOstreeClient
247
306
 
248
307
  url
249
308
  end
309
+
310
+ # Configure Faraday connection directly.
311
+ #
312
+ # ```
313
+ # c.configure_faraday_connection do |conn|
314
+ # conn.use Faraday::HttpCache, shared_cache: false, logger: logger
315
+ # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
316
+ # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
317
+ # end
318
+ # end
319
+ #
320
+ # c.configure_faraday_connection do |conn|
321
+ # conn.adapter :typhoeus
322
+ # end
323
+ # ```
324
+ #
325
+ # @param block [Proc] `#call`able object that takes one arg, the connection
326
+ def configure_faraday_connection(&block)
327
+ @configure_connection_blocks << block
328
+ end
329
+
330
+ def configure_connection(conn)
331
+ @configure_connection_blocks.each do |block|
332
+ block.call(conn)
333
+ end
334
+ end
335
+
336
+ # Adds middleware to the stack
337
+ def use(*middleware)
338
+ set_faraday_middleware(:use, *middleware)
339
+ end
340
+
341
+ # Adds request middleware to the stack
342
+ def request(*middleware)
343
+ set_faraday_middleware(:request, *middleware)
344
+ end
345
+
346
+ # Adds response middleware to the stack
347
+ def response(*middleware)
348
+ set_faraday_middleware(:response, *middleware)
349
+ end
350
+
351
+ # Adds Faraday middleware setting information to the stack
352
+ #
353
+ # @example Use the `set_faraday_middleware` method to set middleware information
354
+ # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
355
+ # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
356
+ # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
357
+ # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
358
+ # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
359
+ # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
360
+ #
361
+ # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
362
+ def set_faraday_middleware(operation, key, *args, &block)
363
+ unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
364
+ fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
365
+ " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
366
+ end
367
+
368
+ @middlewares[operation] << [key, args, block]
369
+ end
370
+ ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
371
+
372
+ # Set up middleware on the connection
373
+ def configure_middleware(connection)
374
+ return if @middlewares.empty?
375
+
376
+ [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
377
+ next unless @middlewares.key?(operation)
378
+
379
+ @middlewares[operation].each do |key, args, block|
380
+ connection.builder.send(operation, key, *args, &block)
381
+ end
382
+ end
383
+
384
+ if @middlewares.key?(:delete)
385
+ @middlewares[:delete].each do |key, _args, _block|
386
+ connection.builder.delete(key)
387
+ end
388
+ end
389
+ end
390
+
250
391
  end
251
392
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpOstreeClient
16
17
  # Serializer for asynchronous operations.
@@ -25,6 +26,11 @@ module PulpOstreeClient
25
26
  }
26
27
  end
27
28
 
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
28
34
  # Attribute type mapping.
29
35
  def self.openapi_types
30
36
  {
@@ -55,12 +61,15 @@ module PulpOstreeClient
55
61
 
56
62
  if attributes.key?(:'task')
57
63
  self.task = attributes[:'task']
64
+ else
65
+ self.task = nil
58
66
  end
59
67
  end
60
68
 
61
69
  # Show invalid properties with the reasons. Usually used together with valid?
62
70
  # @return Array for valid properties with the reasons
63
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
64
73
  invalid_properties = Array.new
65
74
  if @task.nil?
66
75
  invalid_properties.push('invalid value for "task", task cannot be nil.')
@@ -72,6 +81,7 @@ module PulpOstreeClient
72
81
  # Check to see if the all the properties in the model are valid
73
82
  # @return true if the model is valid
74
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
75
85
  return false if @task.nil?
76
86
  true
77
87
  end
@@ -100,37 +110,33 @@ module PulpOstreeClient
100
110
  # @param [Hash] attributes Model attributes in the form of hash
101
111
  # @return [Object] Returns the model itself
102
112
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
113
  return nil unless attributes.is_a?(Hash)
111
- self.class.openapi_types.each_pair do |key, type|
112
- if type =~ /\AArray<(.*)>/i
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
113
120
  # check to ensure the input is an array given that the attribute
114
121
  # is documented as an array but the input is not
115
- if attributes[self.class.attribute_map[key]].is_a?(Array)
116
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
117
124
  end
118
- elsif !attributes[self.class.attribute_map[key]].nil?
119
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
- end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
121
128
  end
122
-
123
- self
129
+ new(transformed_hash)
124
130
  end
125
131
 
126
132
  # Deserializes the data based on type
127
133
  # @param string type Data type
128
134
  # @param string value Value to be deserialized
129
135
  # @return [Object] Deserialized data
130
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
131
137
  case type.to_sym
132
- when :DateTime
133
- DateTime.parse(value)
138
+ when :Time
139
+ Time.parse(value)
134
140
  when :Date
135
141
  Date.parse(value)
136
142
  when :String
@@ -160,7 +166,9 @@ module PulpOstreeClient
160
166
  end
161
167
  end
162
168
  else # model
163
- PulpOstreeClient.const_get(type).build_from_hash(value)
169
+ # models (e.g. Pet) or oneOf
170
+ klass = PulpOstreeClient.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
172
  end
165
173
  end
166
174
 
@@ -186,7 +194,7 @@ module PulpOstreeClient
186
194
  is_nullable = self.class.openapi_nullable.include?(attr)
187
195
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
196
  end
189
-
197
+
190
198
  hash[param] = _to_hash(value)
191
199
  end
192
200
  hash
@@ -209,5 +217,7 @@ module PulpOstreeClient
209
217
  value
210
218
  end
211
219
  end
220
+
212
221
  end
222
+
213
223
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpOstreeClient
16
17
  # Serializer for the RepositoryVersion content summary
@@ -30,6 +31,11 @@ module PulpOstreeClient
30
31
  }
31
32
  end
32
33
 
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
33
39
  # Attribute type mapping.
34
40
  def self.openapi_types
35
41
  {
@@ -64,24 +70,31 @@ module PulpOstreeClient
64
70
  if (value = attributes[:'added']).is_a?(Hash)
65
71
  self.added = value
66
72
  end
73
+ else
74
+ self.added = nil
67
75
  end
68
76
 
69
77
  if attributes.key?(:'removed')
70
78
  if (value = attributes[:'removed']).is_a?(Hash)
71
79
  self.removed = value
72
80
  end
81
+ else
82
+ self.removed = nil
73
83
  end
74
84
 
75
85
  if attributes.key?(:'present')
76
86
  if (value = attributes[:'present']).is_a?(Hash)
77
87
  self.present = value
78
88
  end
89
+ else
90
+ self.present = nil
79
91
  end
80
92
  end
81
93
 
82
94
  # Show invalid properties with the reasons. Usually used together with valid?
83
95
  # @return Array for valid properties with the reasons
84
96
  def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
98
  invalid_properties = Array.new
86
99
  if @added.nil?
87
100
  invalid_properties.push('invalid value for "added", added cannot be nil.')
@@ -101,6 +114,7 @@ module PulpOstreeClient
101
114
  # Check to see if the all the properties in the model are valid
102
115
  # @return true if the model is valid
103
116
  def valid?
117
+ warn '[DEPRECATED] the `valid?` method is obsolete'
104
118
  return false if @added.nil?
105
119
  return false if @removed.nil?
106
120
  return false if @present.nil?
@@ -133,37 +147,33 @@ module PulpOstreeClient
133
147
  # @param [Hash] attributes Model attributes in the form of hash
134
148
  # @return [Object] Returns the model itself
135
149
  def self.build_from_hash(attributes)
136
- new.build_from_hash(attributes)
137
- end
138
-
139
- # Builds the object from hash
140
- # @param [Hash] attributes Model attributes in the form of hash
141
- # @return [Object] Returns the model itself
142
- def build_from_hash(attributes)
143
150
  return nil unless attributes.is_a?(Hash)
144
- self.class.openapi_types.each_pair do |key, type|
145
- if type =~ /\AArray<(.*)>/i
151
+ attributes = attributes.transform_keys(&:to_sym)
152
+ transformed_hash = {}
153
+ openapi_types.each_pair do |key, type|
154
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
155
+ transformed_hash["#{key}"] = nil
156
+ elsif type =~ /\AArray<(.*)>/i
146
157
  # check to ensure the input is an array given that the attribute
147
158
  # is documented as an array but the input is not
148
- if attributes[self.class.attribute_map[key]].is_a?(Array)
149
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ if attributes[attribute_map[key]].is_a?(Array)
160
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
161
  end
151
- elsif !attributes[self.class.attribute_map[key]].nil?
152
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
- end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ elsif !attributes[attribute_map[key]].nil?
163
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
164
+ end
154
165
  end
155
-
156
- self
166
+ new(transformed_hash)
157
167
  end
158
168
 
159
169
  # Deserializes the data based on type
160
170
  # @param string type Data type
161
171
  # @param string value Value to be deserialized
162
172
  # @return [Object] Deserialized data
163
- def _deserialize(type, value)
173
+ def self._deserialize(type, value)
164
174
  case type.to_sym
165
- when :DateTime
166
- DateTime.parse(value)
175
+ when :Time
176
+ Time.parse(value)
167
177
  when :Date
168
178
  Date.parse(value)
169
179
  when :String
@@ -193,7 +203,9 @@ module PulpOstreeClient
193
203
  end
194
204
  end
195
205
  else # model
196
- PulpOstreeClient.const_get(type).build_from_hash(value)
206
+ # models (e.g. Pet) or oneOf
207
+ klass = PulpOstreeClient.const_get(type)
208
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
209
  end
198
210
  end
199
211
 
@@ -219,7 +231,7 @@ module PulpOstreeClient
219
231
  is_nullable = self.class.openapi_nullable.include?(attr)
220
232
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
233
  end
222
-
234
+
223
235
  hash[param] = _to_hash(value)
224
236
  end
225
237
  hash
@@ -242,5 +254,7 @@ module PulpOstreeClient
242
254
  value
243
255
  end
244
256
  end
257
+
245
258
  end
259
+
246
260
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpOstreeClient
16
17
  class MyPermissionsResponse
@@ -23,6 +24,11 @@ module PulpOstreeClient
23
24
  }
24
25
  end
25
26
 
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
26
32
  # Attribute type mapping.
27
33
  def self.openapi_types
28
34
  {
@@ -55,12 +61,15 @@ module PulpOstreeClient
55
61
  if (value = attributes[:'permissions']).is_a?(Array)
56
62
  self.permissions = value
57
63
  end
64
+ else
65
+ self.permissions = nil
58
66
  end
59
67
  end
60
68
 
61
69
  # Show invalid properties with the reasons. Usually used together with valid?
62
70
  # @return Array for valid properties with the reasons
63
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
64
73
  invalid_properties = Array.new
65
74
  if @permissions.nil?
66
75
  invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
@@ -72,6 +81,7 @@ module PulpOstreeClient
72
81
  # Check to see if the all the properties in the model are valid
73
82
  # @return true if the model is valid
74
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
75
85
  return false if @permissions.nil?
76
86
  true
77
87
  end
@@ -100,37 +110,33 @@ module PulpOstreeClient
100
110
  # @param [Hash] attributes Model attributes in the form of hash
101
111
  # @return [Object] Returns the model itself
102
112
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
113
  return nil unless attributes.is_a?(Hash)
111
- self.class.openapi_types.each_pair do |key, type|
112
- if type =~ /\AArray<(.*)>/i
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
113
120
  # check to ensure the input is an array given that the attribute
114
121
  # is documented as an array but the input is not
115
- if attributes[self.class.attribute_map[key]].is_a?(Array)
116
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
117
124
  end
118
- elsif !attributes[self.class.attribute_map[key]].nil?
119
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
- end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
121
128
  end
122
-
123
- self
129
+ new(transformed_hash)
124
130
  end
125
131
 
126
132
  # Deserializes the data based on type
127
133
  # @param string type Data type
128
134
  # @param string value Value to be deserialized
129
135
  # @return [Object] Deserialized data
130
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
131
137
  case type.to_sym
132
- when :DateTime
133
- DateTime.parse(value)
138
+ when :Time
139
+ Time.parse(value)
134
140
  when :Date
135
141
  Date.parse(value)
136
142
  when :String
@@ -160,7 +166,9 @@ module PulpOstreeClient
160
166
  end
161
167
  end
162
168
  else # model
163
- PulpOstreeClient.const_get(type).build_from_hash(value)
169
+ # models (e.g. Pet) or oneOf
170
+ klass = PulpOstreeClient.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
172
  end
165
173
  end
166
174
 
@@ -186,7 +194,7 @@ module PulpOstreeClient
186
194
  is_nullable = self.class.openapi_nullable.include?(attr)
187
195
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
196
  end
189
-
197
+
190
198
  hash[param] = _to_hash(value)
191
199
  end
192
200
  hash
@@ -209,5 +217,7 @@ module PulpOstreeClient
209
217
  value
210
218
  end
211
219
  end
220
+
212
221
  end
222
+
213
223
  end