ory-keto-client 0.5.4.alpha1 → 0.6.0.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +22 -31
  4. data/docs/AddOryAccessControlPolicyRoleMembersBody.md +8 -7
  5. data/docs/AuthorizationResult.md +8 -7
  6. data/docs/EnginesApi.md +319 -129
  7. data/docs/ExpandTree.md +22 -0
  8. data/docs/GetCheckResponse.md +18 -0
  9. data/docs/GetRelationTuplesResponse.md +20 -0
  10. data/docs/HealthApi.md +50 -15
  11. data/docs/HealthNotReadyStatus.md +8 -7
  12. data/docs/HealthStatus.md +8 -7
  13. data/docs/InlineResponse400.md +28 -0
  14. data/docs/InlineResponse500.md +18 -17
  15. data/docs/InternalRelationTuple.md +24 -0
  16. data/docs/OryAccessControlPolicy.md +20 -19
  17. data/docs/OryAccessControlPolicyAllowedInput.md +14 -13
  18. data/docs/OryAccessControlPolicyRole.md +10 -9
  19. data/docs/PatchDelta.md +20 -0
  20. data/docs/ReadApi.md +297 -0
  21. data/docs/Version.md +8 -7
  22. data/docs/VersionApi.md +26 -9
  23. data/docs/WriteApi.md +212 -0
  24. data/lib/ory-keto-client.rb +10 -9
  25. data/lib/ory-keto-client/api/engines_api.rb +46 -35
  26. data/lib/ory-keto-client/api/health_api.rb +10 -8
  27. data/lib/ory-keto-client/api/read_api.rb +324 -0
  28. data/lib/ory-keto-client/api/version_api.rb +6 -5
  29. data/lib/ory-keto-client/api/write_api.rb +225 -0
  30. data/lib/ory-keto-client/api_client.rb +51 -47
  31. data/lib/ory-keto-client/api_error.rb +2 -2
  32. data/lib/ory-keto-client/configuration.rb +40 -11
  33. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_body.rb +20 -8
  34. data/lib/ory-keto-client/models/authorization_result.rb +20 -8
  35. data/lib/ory-keto-client/models/expand_tree.rb +282 -0
  36. data/lib/ory-keto-client/models/get_check_response.rb +225 -0
  37. data/lib/ory-keto-client/models/get_relation_tuples_response.rb +230 -0
  38. data/lib/ory-keto-client/models/health_not_ready_status.rb +20 -8
  39. data/lib/ory-keto-client/models/health_status.rb +20 -8
  40. data/lib/ory-keto-client/models/inline_response400.rb +265 -0
  41. data/lib/ory-keto-client/models/inline_response500.rb +21 -9
  42. data/lib/ory-keto-client/models/internal_relation_tuple.rb +268 -0
  43. data/lib/ory-keto-client/models/ory_access_control_policy.rb +22 -12
  44. data/lib/ory-keto-client/models/ory_access_control_policy_allowed_input.rb +22 -12
  45. data/lib/ory-keto-client/models/ory_access_control_policy_role.rb +20 -8
  46. data/lib/ory-keto-client/models/patch_delta.rb +227 -0
  47. data/lib/ory-keto-client/models/version.rb +20 -8
  48. data/lib/ory-keto-client/version.rb +3 -3
  49. data/ory-keto-client.gemspec +4 -5
  50. data/spec/api/read_api_spec.rb +94 -0
  51. data/spec/api/write_api_spec.rb +74 -0
  52. data/spec/api_client_spec.rb +4 -4
  53. data/spec/configuration_spec.rb +3 -3
  54. data/spec/models/expand_tree_spec.rb +50 -0
  55. data/spec/models/get_check_response_spec.rb +34 -0
  56. data/spec/models/get_relation_tuples_response_spec.rb +40 -0
  57. data/spec/models/inline_response400_spec.rb +64 -0
  58. data/spec/models/internal_relation_tuple_spec.rb +52 -0
  59. data/spec/models/patch_delta_spec.rb +40 -0
  60. data/spec/spec_helper.rb +3 -3
  61. metadata +92 -80
@@ -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: Latest
6
+ The version of the OpenAPI document: v0.0.0-alpha.58
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
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: Latest
6
+ The version of the OpenAPI document: v0.0.0-alpha.58
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
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
@@ -0,0 +1,282 @@
1
+ =begin
2
+ #ORY Keto
3
+
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
+
6
+ The version of the OpenAPI document: v0.6.0-alpha.6
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OryHydraClient
17
+ class ExpandTree
18
+ attr_accessor :children
19
+
20
+ attr_accessor :subject
21
+
22
+ attr_accessor :type
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'children' => :'children',
50
+ :'subject' => :'subject',
51
+ :'type' => :'type'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'children' => :'Array<ExpandTree>',
64
+ :'subject' => :'String',
65
+ :'type' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::ExpandTree` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::ExpandTree`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'children')
91
+ if (value = attributes[:'children']).is_a?(Array)
92
+ self.children = value
93
+ end
94
+ end
95
+
96
+ if attributes.key?(:'subject')
97
+ self.subject = attributes[:'subject']
98
+ end
99
+
100
+ if attributes.key?(:'type')
101
+ self.type = attributes[:'type']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if @subject.nil?
110
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
111
+ end
112
+
113
+ if @type.nil?
114
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ return false if @subject.nil?
124
+ return false if @type.nil?
125
+ type_validator = EnumAttributeValidator.new('String', ["union", "exclusion", "intersection", "leaf"])
126
+ return false unless type_validator.valid?(@type)
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method checking allowed values (enum).
131
+ # @param [Object] type Object to be assigned
132
+ def type=(type)
133
+ validator = EnumAttributeValidator.new('String', ["union", "exclusion", "intersection", "leaf"])
134
+ unless validator.valid?(type)
135
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
136
+ end
137
+ @type = type
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ children == o.children &&
146
+ subject == o.subject &&
147
+ type == o.type
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [children, subject, type].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ new.build_from_hash(attributes)
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
+ self.send("#{key}=", nil)
177
+ elsif type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = OryHydraClient.const_get(type)
230
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ end