ory-keto-client 0.0.0.alpha58 → 0.4.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +19 -5
  4. data/docs/AddOryAccessControlPolicyRoleMembersBody.md +7 -8
  5. data/docs/AuthorizationResult.md +7 -8
  6. data/docs/EnginesApi.md +129 -319
  7. data/docs/HealthApi.md +15 -50
  8. data/docs/HealthNotReadyStatus.md +7 -8
  9. data/docs/HealthStatus.md +7 -8
  10. data/docs/InlineResponse500.md +17 -18
  11. data/docs/OryAccessControlPolicy.md +19 -20
  12. data/docs/OryAccessControlPolicyAllowedInput.md +13 -14
  13. data/docs/OryAccessControlPolicyRole.md +9 -10
  14. data/docs/Version.md +7 -8
  15. data/docs/VersionApi.md +9 -26
  16. data/lib/ory-keto-client.rb +16 -2
  17. data/lib/ory-keto-client/api/engines_api.rb +35 -46
  18. data/lib/ory-keto-client/api/health_api.rb +8 -10
  19. data/lib/ory-keto-client/api/version_api.rb +5 -6
  20. data/lib/ory-keto-client/api_client.rb +46 -50
  21. data/lib/ory-keto-client/api_error.rb +2 -2
  22. data/lib/ory-keto-client/configuration.rb +7 -34
  23. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_body.rb +8 -20
  24. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_internal_server_error_body.rb +2 -2
  25. data/lib/ory-keto-client/models/authorization_result.rb +8 -20
  26. data/lib/ory-keto-client/models/delete_ory_access_control_policy_internal_server_error_body.rb +3 -3
  27. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role_internal_server_error_body.rb +2 -2
  28. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_internal_server_error_body.rb +3 -3
  29. data/lib/ory-keto-client/models/get_ory_access_control_policy_internal_server_error_body.rb +3 -3
  30. data/lib/ory-keto-client/models/get_ory_access_control_policy_not_found_body.rb +3 -3
  31. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_internal_server_error_body.rb +2 -2
  32. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_not_found_body.rb +3 -3
  33. data/lib/ory-keto-client/models/health_not_ready_status.rb +8 -20
  34. data/lib/ory-keto-client/models/health_status.rb +8 -20
  35. data/lib/ory-keto-client/models/inline_response500.rb +9 -21
  36. data/lib/ory-keto-client/models/is_instance_alive_internal_server_error_body.rb +2 -2
  37. data/lib/ory-keto-client/models/list_ory_access_control_policies_internal_server_error_body.rb +3 -3
  38. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_internal_server_error_body.rb +3 -3
  39. data/lib/ory-keto-client/models/ory_access_control_policy.rb +12 -22
  40. data/lib/ory-keto-client/models/ory_access_control_policy_allowed_input.rb +12 -22
  41. data/lib/ory-keto-client/models/ory_access_control_policy_role.rb +8 -20
  42. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members_internal_server_error_body.rb +2 -2
  43. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_internal_server_error_body.rb +3 -3
  44. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_internal_server_error_body.rb +2 -2
  45. data/lib/ory-keto-client/models/version.rb +9 -20
  46. data/lib/ory-keto-client/version.rb +3 -3
  47. data/ory-keto-client.gemspec +5 -4
  48. data/spec/api_client_spec.rb +4 -4
  49. data/spec/configuration_spec.rb +3 -3
  50. data/spec/spec_helper.rb +3 -3
  51. metadata +79 -59
@@ -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.58
6
+ The version of the OpenAPI document: Latest
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
@@ -67,16 +67,15 @@ module OryHydraClient
67
67
  form_params = opts[:form_params] || {}
68
68
 
69
69
  # http body (model)
70
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
70
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
71
71
 
72
72
  # return_type
73
- return_type = opts[:debug_return_type] || 'OryAccessControlPolicyRole'
73
+ return_type = opts[:return_type] || 'OryAccessControlPolicyRole'
74
74
 
75
75
  # auth_names
76
- auth_names = opts[:debug_auth_names] || []
76
+ auth_names = opts[:auth_names] || []
77
77
 
78
78
  new_options = opts.merge(
79
- :operation => :"EnginesApi.add_ory_access_control_policy_role_members",
80
79
  :header_params => header_params,
81
80
  :query_params => query_params,
82
81
  :form_params => form_params,
@@ -134,16 +133,15 @@ module OryHydraClient
134
133
  form_params = opts[:form_params] || {}
135
134
 
136
135
  # http body (model)
137
- post_body = opts[:debug_body]
136
+ post_body = opts[:body]
138
137
 
139
138
  # return_type
140
- return_type = opts[:debug_return_type]
139
+ return_type = opts[:return_type]
141
140
 
142
141
  # auth_names
143
- auth_names = opts[:debug_auth_names] || []
142
+ auth_names = opts[:auth_names] || []
144
143
 
145
144
  new_options = opts.merge(
146
- :operation => :"EnginesApi.delete_ory_access_control_policy",
147
145
  :header_params => header_params,
148
146
  :query_params => query_params,
149
147
  :form_params => form_params,
@@ -203,16 +201,15 @@ module OryHydraClient
203
201
  form_params = opts[:form_params] || {}
204
202
 
205
203
  # http body (model)
206
- post_body = opts[:debug_body]
204
+ post_body = opts[:body]
207
205
 
208
206
  # return_type
209
- return_type = opts[:debug_return_type]
207
+ return_type = opts[:return_type]
210
208
 
211
209
  # auth_names
212
- auth_names = opts[:debug_auth_names] || []
210
+ auth_names = opts[:auth_names] || []
213
211
 
214
212
  new_options = opts.merge(
215
- :operation => :"EnginesApi.delete_ory_access_control_policy_role",
216
213
  :header_params => header_params,
217
214
  :query_params => query_params,
218
215
  :form_params => form_params,
@@ -270,16 +267,15 @@ module OryHydraClient
270
267
  form_params = opts[:form_params] || {}
271
268
 
272
269
  # http body (model)
273
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
270
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
274
271
 
275
272
  # return_type
276
- return_type = opts[:debug_return_type] || 'AuthorizationResult'
273
+ return_type = opts[:return_type] || 'AuthorizationResult'
277
274
 
278
275
  # auth_names
279
- auth_names = opts[:debug_auth_names] || []
276
+ auth_names = opts[:auth_names] || []
280
277
 
281
278
  new_options = opts.merge(
282
- :operation => :"EnginesApi.do_ory_access_control_policies_allow",
283
279
  :header_params => header_params,
284
280
  :query_params => query_params,
285
281
  :form_params => form_params,
@@ -337,16 +333,15 @@ module OryHydraClient
337
333
  form_params = opts[:form_params] || {}
338
334
 
339
335
  # http body (model)
340
- post_body = opts[:debug_body]
336
+ post_body = opts[:body]
341
337
 
342
338
  # return_type
343
- return_type = opts[:debug_return_type] || 'OryAccessControlPolicy'
339
+ return_type = opts[:return_type] || 'OryAccessControlPolicy'
344
340
 
345
341
  # auth_names
346
- auth_names = opts[:debug_auth_names] || []
342
+ auth_names = opts[:auth_names] || []
347
343
 
348
344
  new_options = opts.merge(
349
- :operation => :"EnginesApi.get_ory_access_control_policy",
350
345
  :header_params => header_params,
351
346
  :query_params => query_params,
352
347
  :form_params => form_params,
@@ -406,16 +401,15 @@ module OryHydraClient
406
401
  form_params = opts[:form_params] || {}
407
402
 
408
403
  # http body (model)
409
- post_body = opts[:debug_body]
404
+ post_body = opts[:body]
410
405
 
411
406
  # return_type
412
- return_type = opts[:debug_return_type] || 'OryAccessControlPolicyRole'
407
+ return_type = opts[:return_type] || 'OryAccessControlPolicyRole'
413
408
 
414
409
  # auth_names
415
- auth_names = opts[:debug_auth_names] || []
410
+ auth_names = opts[:auth_names] || []
416
411
 
417
412
  new_options = opts.merge(
418
- :operation => :"EnginesApi.get_ory_access_control_policy_role",
419
413
  :header_params => header_params,
420
414
  :query_params => query_params,
421
415
  :form_params => form_params,
@@ -482,16 +476,15 @@ module OryHydraClient
482
476
  form_params = opts[:form_params] || {}
483
477
 
484
478
  # http body (model)
485
- post_body = opts[:debug_body]
479
+ post_body = opts[:body]
486
480
 
487
481
  # return_type
488
- return_type = opts[:debug_return_type] || 'Array<OryAccessControlPolicy>'
482
+ return_type = opts[:return_type] || 'Array<OryAccessControlPolicy>'
489
483
 
490
484
  # auth_names
491
- auth_names = opts[:debug_auth_names] || []
485
+ auth_names = opts[:auth_names] || []
492
486
 
493
487
  new_options = opts.merge(
494
- :operation => :"EnginesApi.list_ory_access_control_policies",
495
488
  :header_params => header_params,
496
489
  :query_params => query_params,
497
490
  :form_params => form_params,
@@ -554,16 +547,15 @@ module OryHydraClient
554
547
  form_params = opts[:form_params] || {}
555
548
 
556
549
  # http body (model)
557
- post_body = opts[:debug_body]
550
+ post_body = opts[:body]
558
551
 
559
552
  # return_type
560
- return_type = opts[:debug_return_type] || 'Array<OryAccessControlPolicyRole>'
553
+ return_type = opts[:return_type] || 'Array<OryAccessControlPolicyRole>'
561
554
 
562
555
  # auth_names
563
- auth_names = opts[:debug_auth_names] || []
556
+ auth_names = opts[:auth_names] || []
564
557
 
565
558
  new_options = opts.merge(
566
- :operation => :"EnginesApi.list_ory_access_control_policy_roles",
567
559
  :header_params => header_params,
568
560
  :query_params => query_params,
569
561
  :form_params => form_params,
@@ -629,16 +621,15 @@ module OryHydraClient
629
621
  form_params = opts[:form_params] || {}
630
622
 
631
623
  # http body (model)
632
- post_body = opts[:debug_body]
624
+ post_body = opts[:body]
633
625
 
634
626
  # return_type
635
- return_type = opts[:debug_return_type]
627
+ return_type = opts[:return_type]
636
628
 
637
629
  # auth_names
638
- auth_names = opts[:debug_auth_names] || []
630
+ auth_names = opts[:auth_names] || []
639
631
 
640
632
  new_options = opts.merge(
641
- :operation => :"EnginesApi.remove_ory_access_control_policy_role_members",
642
633
  :header_params => header_params,
643
634
  :query_params => query_params,
644
635
  :form_params => form_params,
@@ -694,16 +685,15 @@ module OryHydraClient
694
685
  form_params = opts[:form_params] || {}
695
686
 
696
687
  # http body (model)
697
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
688
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
698
689
 
699
690
  # return_type
700
- return_type = opts[:debug_return_type] || 'OryAccessControlPolicy'
691
+ return_type = opts[:return_type] || 'OryAccessControlPolicy'
701
692
 
702
693
  # auth_names
703
- auth_names = opts[:debug_auth_names] || []
694
+ auth_names = opts[:auth_names] || []
704
695
 
705
696
  new_options = opts.merge(
706
- :operation => :"EnginesApi.upsert_ory_access_control_policy",
707
697
  :header_params => header_params,
708
698
  :query_params => query_params,
709
699
  :form_params => form_params,
@@ -761,16 +751,15 @@ module OryHydraClient
761
751
  form_params = opts[:form_params] || {}
762
752
 
763
753
  # http body (model)
764
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
754
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
765
755
 
766
756
  # return_type
767
- return_type = opts[:debug_return_type] || 'OryAccessControlPolicyRole'
757
+ return_type = opts[:return_type] || 'OryAccessControlPolicyRole'
768
758
 
769
759
  # auth_names
770
- auth_names = opts[:debug_auth_names] || []
760
+ auth_names = opts[:auth_names] || []
771
761
 
772
762
  new_options = opts.merge(
773
- :operation => :"EnginesApi.upsert_ory_access_control_policy_role",
774
763
  :header_params => header_params,
775
764
  :query_params => query_params,
776
765
  :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.58
6
+ The version of the OpenAPI document: Latest
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
@@ -51,16 +51,15 @@ module OryHydraClient
51
51
  form_params = opts[:form_params] || {}
52
52
 
53
53
  # http body (model)
54
- post_body = opts[:debug_body]
54
+ post_body = opts[:body]
55
55
 
56
56
  # return_type
57
- return_type = opts[:debug_return_type] || 'HealthStatus'
57
+ return_type = opts[:return_type] || 'HealthStatus'
58
58
 
59
59
  # auth_names
60
- auth_names = opts[:debug_auth_names] || []
60
+ auth_names = opts[:auth_names] || []
61
61
 
62
62
  new_options = opts.merge(
63
- :operation => :"HealthApi.is_instance_alive",
64
63
  :header_params => header_params,
65
64
  :query_params => query_params,
66
65
  :form_params => form_params,
@@ -108,16 +107,15 @@ module OryHydraClient
108
107
  form_params = opts[:form_params] || {}
109
108
 
110
109
  # http body (model)
111
- post_body = opts[:debug_body]
110
+ post_body = opts[:body]
112
111
 
113
112
  # return_type
114
- return_type = opts[:debug_return_type] || 'HealthStatus'
113
+ return_type = opts[:return_type] || 'HealthStatus'
115
114
 
116
115
  # auth_names
117
- auth_names = opts[:debug_auth_names] || []
116
+ auth_names = opts[:auth_names] || []
118
117
 
119
118
  new_options = opts.merge(
120
- :operation => :"HealthApi.is_instance_ready",
121
119
  :header_params => header_params,
122
120
  :query_params => query_params,
123
121
  :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.58
6
+ The version of the OpenAPI document: Latest
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
@@ -51,16 +51,15 @@ module OryHydraClient
51
51
  form_params = opts[:form_params] || {}
52
52
 
53
53
  # http body (model)
54
- post_body = opts[:debug_body]
54
+ post_body = opts[:body]
55
55
 
56
56
  # return_type
57
- return_type = opts[:debug_return_type] || 'Version'
57
+ return_type = opts[:return_type] || 'Version'
58
58
 
59
59
  # auth_names
60
- auth_names = opts[:debug_auth_names] || []
60
+ auth_names = opts[:auth_names] || []
61
61
 
62
62
  new_options = opts.merge(
63
- :operation => :"VersionApi.get_version",
64
63
  :header_params => header_params,
65
64
  :query_params => query_params,
66
65
  :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.58
6
+ The version of the OpenAPI document: Latest
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,6 @@ require 'date'
14
14
  require 'json'
15
15
  require 'logger'
16
16
  require 'tempfile'
17
- require 'time'
18
17
  require 'typhoeus'
19
18
 
20
19
  module OryHydraClient
@@ -87,7 +86,7 @@ module OryHydraClient
87
86
  # @option opts [Object] :body HTTP body (JSON/XML)
88
87
  # @return [Typhoeus::Request] A Typhoeus Request
89
88
  def build_request(http_method, path, opts = {})
90
- url = build_request_url(path, opts)
89
+ url = build_request_url(path)
91
90
  http_method = http_method.to_sym.downcase
92
91
 
93
92
  header_params = @default_headers.merge(opts[:header_params] || {})
@@ -155,44 +154,6 @@ module OryHydraClient
155
154
  data
156
155
  end
157
156
 
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
-
196
157
  # Check if the given MIME is a JSON MIME.
197
158
  # JSON MIME examples:
198
159
  # application/json
@@ -229,7 +190,7 @@ module OryHydraClient
229
190
  begin
230
191
  data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
231
192
  rescue JSON::ParserError => e
232
- if %w(String Date Time).include?(return_type)
193
+ if %w(String Date DateTime).include?(return_type)
233
194
  data = body
234
195
  else
235
196
  raise e
@@ -254,9 +215,9 @@ module OryHydraClient
254
215
  data.to_f
255
216
  when 'Boolean'
256
217
  data == true
257
- when 'Time'
218
+ when 'DateTime'
258
219
  # parse date time (expecting ISO 8601 format)
259
- Time.parse data
220
+ DateTime.parse data
260
221
  when 'Date'
261
222
  # parse date time (expecting ISO 8601 format)
262
223
  Date.parse data
@@ -274,9 +235,44 @@ module OryHydraClient
274
235
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
275
236
  end
276
237
  else
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)
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
+ tempfile.close if tempfile
272
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
273
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
274
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
275
+ "explicitly with `tempfile.delete`"
280
276
  end
281
277
  end
282
278
 
@@ -289,10 +285,10 @@ module OryHydraClient
289
285
  filename.gsub(/.*[\/\\]/, '')
290
286
  end
291
287
 
292
- def build_request_url(path, opts = {})
288
+ def build_request_url(path)
293
289
  # Add leading and trailing slashes to path
294
290
  path = "/#{path}".gsub(/\/+/, '/')
295
- @config.base_url(opts[:operation]) + path
291
+ @config.base_url + path
296
292
  end
297
293
 
298
294
  # Update hearder and query params based on authentication settings.