ory-keto-client 0.0.0.alpha45 → 0.0.0.alpha50

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/docs/AddOryAccessControlPolicyRoleMembersBody.md +8 -7
  4. data/docs/AuthorizationResult.md +8 -7
  5. data/docs/EnginesApi.md +319 -129
  6. data/docs/HealthApi.md +50 -15
  7. data/docs/HealthNotReadyStatus.md +8 -7
  8. data/docs/HealthStatus.md +8 -7
  9. data/docs/InlineResponse500.md +18 -17
  10. data/docs/OryAccessControlPolicy.md +20 -19
  11. data/docs/OryAccessControlPolicyAllowedInput.md +14 -13
  12. data/docs/OryAccessControlPolicyRole.md +10 -9
  13. data/docs/Version.md +8 -7
  14. data/docs/VersionApi.md +26 -9
  15. data/lib/ory-keto-client.rb +2 -2
  16. data/lib/ory-keto-client/api/engines_api.rb +46 -35
  17. data/lib/ory-keto-client/api/health_api.rb +10 -8
  18. data/lib/ory-keto-client/api/version_api.rb +6 -5
  19. data/lib/ory-keto-client/api_client.rb +50 -48
  20. data/lib/ory-keto-client/api_error.rb +2 -2
  21. data/lib/ory-keto-client/configuration.rb +34 -7
  22. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_body.rb +20 -8
  23. data/lib/ory-keto-client/models/authorization_result.rb +20 -8
  24. data/lib/ory-keto-client/models/health_not_ready_status.rb +20 -8
  25. data/lib/ory-keto-client/models/health_status.rb +20 -8
  26. data/lib/ory-keto-client/models/inline_response500.rb +20 -8
  27. data/lib/ory-keto-client/models/ory_access_control_policy.rb +20 -8
  28. data/lib/ory-keto-client/models/ory_access_control_policy_allowed_input.rb +20 -8
  29. data/lib/ory-keto-client/models/ory_access_control_policy_role.rb +20 -8
  30. data/lib/ory-keto-client/models/version.rb +20 -8
  31. data/lib/ory-keto-client/version.rb +3 -3
  32. data/ory-keto-client.gemspec +4 -5
  33. data/spec/api_client_spec.rb +4 -4
  34. data/spec/configuration_spec.rb +3 -3
  35. data/spec/spec_helper.rb +3 -3
  36. metadata +55 -75
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
@@ -51,15 +51,16 @@ module OryHydraClient
51
51
  form_params = opts[:form_params] || {}
52
52
 
53
53
  # http body (model)
54
- post_body = opts[:body]
54
+ post_body = opts[:debug_body]
55
55
 
56
56
  # return_type
57
- return_type = opts[:return_type] || 'HealthStatus'
57
+ return_type = opts[:debug_return_type] || 'HealthStatus'
58
58
 
59
59
  # auth_names
60
- auth_names = opts[:auth_names] || []
60
+ auth_names = opts[:debug_auth_names] || []
61
61
 
62
62
  new_options = opts.merge(
63
+ :operation => :"HealthApi.is_instance_alive",
63
64
  :header_params => header_params,
64
65
  :query_params => query_params,
65
66
  :form_params => form_params,
@@ -107,15 +108,16 @@ module OryHydraClient
107
108
  form_params = opts[:form_params] || {}
108
109
 
109
110
  # http body (model)
110
- post_body = opts[:body]
111
+ post_body = opts[:debug_body]
111
112
 
112
113
  # return_type
113
- return_type = opts[:return_type] || 'HealthStatus'
114
+ return_type = opts[:debug_return_type] || 'HealthStatus'
114
115
 
115
116
  # auth_names
116
- auth_names = opts[:auth_names] || []
117
+ auth_names = opts[:debug_auth_names] || []
117
118
 
118
119
  new_options = opts.merge(
120
+ :operation => :"HealthApi.is_instance_ready",
119
121
  :header_params => header_params,
120
122
  :query_params => query_params,
121
123
  :form_params => form_params,
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
@@ -51,15 +51,16 @@ module OryHydraClient
51
51
  form_params = opts[:form_params] || {}
52
52
 
53
53
  # http body (model)
54
- post_body = opts[:body]
54
+ post_body = opts[:debug_body]
55
55
 
56
56
  # return_type
57
- return_type = opts[:return_type] || 'Version'
57
+ return_type = opts[:debug_return_type] || 'Version'
58
58
 
59
59
  # auth_names
60
- auth_names = opts[:auth_names] || []
60
+ auth_names = opts[:debug_auth_names] || []
61
61
 
62
62
  new_options = opts.merge(
63
+ :operation => :"VersionApi.get_version",
63
64
  :header_params => header_params,
64
65
  :query_params => query_params,
65
66
  :form_params => form_params,
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'json'
15
15
  require 'logger'
16
16
  require 'tempfile'
17
+ require 'time'
17
18
  require 'typhoeus'
18
19
 
19
20
  module OryHydraClient
@@ -86,7 +87,7 @@ module OryHydraClient
86
87
  # @option opts [Object] :body HTTP body (JSON/XML)
87
88
  # @return [Typhoeus::Request] A Typhoeus Request
88
89
  def build_request(http_method, path, opts = {})
89
- url = build_request_url(path)
90
+ url = build_request_url(path, opts)
90
91
  http_method = http_method.to_sym.downcase
91
92
 
92
93
  header_params = @default_headers.merge(opts[:header_params] || {})
@@ -154,6 +155,44 @@ module OryHydraClient
154
155
  data
155
156
  end
156
157
 
158
+ # Save response body into a file in (the defined) temporary folder, using the filename
159
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
160
+ # The response body is written to the file in chunks in order to handle files which
161
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
162
+ # process can use.
163
+ #
164
+ # @see Configuration#temp_folder_path
165
+ def download_file(request)
166
+ tempfile = nil
167
+ encoding = nil
168
+ request.on_headers do |response|
169
+ content_disposition = response.headers['Content-Disposition']
170
+ if content_disposition && content_disposition =~ /filename=/i
171
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
172
+ prefix = sanitize_filename(filename)
173
+ else
174
+ prefix = 'download-'
175
+ end
176
+ prefix = prefix + '-' unless prefix.end_with?('-')
177
+ encoding = response.body.encoding
178
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
179
+ @tempfile = tempfile
180
+ end
181
+ request.on_body do |chunk|
182
+ chunk.force_encoding(encoding)
183
+ tempfile.write(chunk)
184
+ end
185
+ request.on_complete do |response|
186
+ if tempfile
187
+ tempfile.close
188
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
189
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
190
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
191
+ "explicitly with `tempfile.delete`"
192
+ end
193
+ end
194
+ end
195
+
157
196
  # Check if the given MIME is a JSON MIME.
158
197
  # JSON MIME examples:
159
198
  # application/json
@@ -190,7 +229,7 @@ module OryHydraClient
190
229
  begin
191
230
  data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
192
231
  rescue JSON::ParserError => e
193
- if %w(String Date DateTime).include?(return_type)
232
+ if %w(String Date Time).include?(return_type)
194
233
  data = body
195
234
  else
196
235
  raise e
@@ -215,9 +254,9 @@ module OryHydraClient
215
254
  data.to_f
216
255
  when 'Boolean'
217
256
  data == true
218
- when 'DateTime'
257
+ when 'Time'
219
258
  # parse date time (expecting ISO 8601 format)
220
- DateTime.parse data
259
+ Time.parse data
221
260
  when 'Date'
222
261
  # parse date time (expecting ISO 8601 format)
223
262
  Date.parse data
@@ -235,46 +274,9 @@ module OryHydraClient
235
274
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
236
275
  end
237
276
  else
238
- # models, e.g. Pet
239
- OryHydraClient.const_get(return_type).build_from_hash(data)
240
- end
241
- end
242
-
243
- # Save response body into a file in (the defined) temporary folder, using the filename
244
- # from the "Content-Disposition" header if provided, otherwise a random filename.
245
- # The response body is written to the file in chunks in order to handle files which
246
- # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
247
- # process can use.
248
- #
249
- # @see Configuration#temp_folder_path
250
- def download_file(request)
251
- tempfile = nil
252
- encoding = nil
253
- request.on_headers do |response|
254
- content_disposition = response.headers['Content-Disposition']
255
- if content_disposition && content_disposition =~ /filename=/i
256
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
257
- prefix = sanitize_filename(filename)
258
- else
259
- prefix = 'download-'
260
- end
261
- prefix = prefix + '-' unless prefix.end_with?('-')
262
- encoding = response.body.encoding
263
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
264
- @tempfile = tempfile
265
- end
266
- request.on_body do |chunk|
267
- chunk.force_encoding(encoding)
268
- tempfile.write(chunk)
269
- end
270
- request.on_complete do |response|
271
- if tempfile
272
- tempfile.close
273
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
274
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
275
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
276
- "explicitly with `tempfile.delete`"
277
- end
277
+ # models (e.g. Pet) or oneOf
278
+ klass = OryHydraClient.const_get(return_type)
279
+ klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
278
280
  end
279
281
  end
280
282
 
@@ -287,10 +289,10 @@ module OryHydraClient
287
289
  filename.gsub(/.*[\/\\]/, '')
288
290
  end
289
291
 
290
- def build_request_url(path)
292
+ def build_request_url(path, opts = {})
291
293
  # Add leading and trailing slashes to path
292
294
  path = "/#{path}".gsub(/\/+/, '/')
293
- @config.base_url + path
295
+ @config.base_url(opts[:operation]) + path
294
296
  end
295
297
 
296
298
  # Update hearder and query params based on authentication settings.
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
@@ -21,6 +21,18 @@ module OryHydraClient
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)
@@ -129,6 +141,10 @@ module OryHydraClient
129
141
  @scheme = 'http'
130
142
  @host = 'localhost'
131
143
  @base_path = ''
144
+ @server_index = 0
145
+ @server_operation_index = {}
146
+ @server_variables = {}
147
+ @server_operation_variables = {}
132
148
  @api_key = {}
133
149
  @api_key_prefix = {}
134
150
  @timeout = 0
@@ -171,8 +187,12 @@ module OryHydraClient
171
187
  @base_path = '' if @base_path == '/'
172
188
  end
173
189
 
174
- def base_url
175
- "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
190
+ # Returns base URL for specified operation based on server settings
191
+ def base_url(operation = nil)
192
+ index = server_operation_index.fetch(operation, server_index)
193
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
194
+
195
+ server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
176
196
  end
177
197
 
178
198
  # Gets API key (with prefix if set).
@@ -206,12 +226,17 @@ module OryHydraClient
206
226
  ]
207
227
  end
208
228
 
229
+ def operation_server_settings
230
+ {
231
+ }
232
+ end
233
+
209
234
  # Returns URL based on server settings
210
235
  #
211
236
  # @param index array index of the server settings
212
237
  # @param variables hash of variable and the corresponding value
213
- def server_url(index, variables = {})
214
- servers = server_settings
238
+ def server_url(index, variables = {}, servers = nil)
239
+ servers = server_settings if servers == nil
215
240
 
216
241
  # check array index out of bound
217
242
  if (index < 0 || index >= servers.size)
@@ -221,10 +246,12 @@ module OryHydraClient
221
246
  server = servers[index]
222
247
  url = server[:url]
223
248
 
249
+ return url unless server.key? :variables
250
+
224
251
  # go through variable and assign a value
225
252
  server[:variables].each do |name, variable|
226
253
  if variables.key?(name)
227
- if (server[:variables][name][:enum_values].include? variables[name])
254
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
228
255
  url.gsub! "{" + name.to_s + "}", variables[name]
229
256
  else
230
257
  fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
@@ -3,14 +3,15 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module OryHydraClient
16
17
  class AddOryAccessControlPolicyRoleMembersBody
@@ -24,6 +25,11 @@ module OryHydraClient
24
25
  }
25
26
  end
26
27
 
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
27
33
  # Attribute type mapping.
28
34
  def self.openapi_types
29
35
  {
@@ -105,7 +111,9 @@ module OryHydraClient
105
111
  def build_from_hash(attributes)
106
112
  return nil unless attributes.is_a?(Hash)
107
113
  self.class.openapi_types.each_pair do |key, type|
108
- if type =~ /\AArray<(.*)>/i
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
109
117
  # check to ensure the input is an array given that the attribute
110
118
  # is documented as an array but the input is not
111
119
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -113,7 +121,7 @@ module OryHydraClient
113
121
  end
114
122
  elsif !attributes[self.class.attribute_map[key]].nil?
115
123
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
- end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
117
125
  end
118
126
 
119
127
  self
@@ -125,8 +133,8 @@ module OryHydraClient
125
133
  # @return [Object] Deserialized data
126
134
  def _deserialize(type, value)
127
135
  case type.to_sym
128
- when :DateTime
129
- DateTime.parse(value)
136
+ when :Time
137
+ Time.parse(value)
130
138
  when :Date
131
139
  Date.parse(value)
132
140
  when :String
@@ -156,7 +164,9 @@ module OryHydraClient
156
164
  end
157
165
  end
158
166
  else # model
159
- OryHydraClient.const_get(type).build_from_hash(value)
167
+ # models (e.g. Pet) or oneOf
168
+ klass = OryHydraClient.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
160
170
  end
161
171
  end
162
172
 
@@ -182,7 +192,7 @@ module OryHydraClient
182
192
  is_nullable = self.class.openapi_nullable.include?(attr)
183
193
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
194
  end
185
-
195
+
186
196
  hash[param] = _to_hash(value)
187
197
  end
188
198
  hash
@@ -205,5 +215,7 @@ module OryHydraClient
205
215
  value
206
216
  end
207
217
  end
218
+
208
219
  end
220
+
209
221
  end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: v0.0.0-alpha.45
6
+ The version of the OpenAPI document: v0.0.0-alpha.50
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module OryHydraClient
16
17
  class AuthorizationResult
@@ -24,6 +25,11 @@ module OryHydraClient
24
25
  }
25
26
  end
26
27
 
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
27
33
  # Attribute type mapping.
28
34
  def self.openapi_types
29
35
  {
@@ -108,7 +114,9 @@ module OryHydraClient
108
114
  def build_from_hash(attributes)
109
115
  return nil unless attributes.is_a?(Hash)
110
116
  self.class.openapi_types.each_pair do |key, type|
111
- if type =~ /\AArray<(.*)>/i
117
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
+ self.send("#{key}=", nil)
119
+ elsif type =~ /\AArray<(.*)>/i
112
120
  # check to ensure the input is an array given that the attribute
113
121
  # is documented as an array but the input is not
114
122
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -116,7 +124,7 @@ module OryHydraClient
116
124
  end
117
125
  elsif !attributes[self.class.attribute_map[key]].nil?
118
126
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
- end # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ end
120
128
  end
121
129
 
122
130
  self
@@ -128,8 +136,8 @@ module OryHydraClient
128
136
  # @return [Object] Deserialized data
129
137
  def _deserialize(type, value)
130
138
  case type.to_sym
131
- when :DateTime
132
- DateTime.parse(value)
139
+ when :Time
140
+ Time.parse(value)
133
141
  when :Date
134
142
  Date.parse(value)
135
143
  when :String
@@ -159,7 +167,9 @@ module OryHydraClient
159
167
  end
160
168
  end
161
169
  else # model
162
- OryHydraClient.const_get(type).build_from_hash(value)
170
+ # models (e.g. Pet) or oneOf
171
+ klass = OryHydraClient.const_get(type)
172
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
173
  end
164
174
  end
165
175
 
@@ -185,7 +195,7 @@ module OryHydraClient
185
195
  is_nullable = self.class.openapi_nullable.include?(attr)
186
196
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
197
  end
188
-
198
+
189
199
  hash[param] = _to_hash(value)
190
200
  end
191
201
  hash
@@ -208,5 +218,7 @@ module OryHydraClient
208
218
  value
209
219
  end
210
220
  end
221
+
211
222
  end
223
+
212
224
  end