ory-keto-client 0.0.0.alpha40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +115 -0
  4. data/Rakefile +10 -0
  5. data/docs/AddOryAccessControlPolicyRoleMembers.md +21 -0
  6. data/docs/AddOryAccessControlPolicyRoleMembersBody.md +17 -0
  7. data/docs/AddOryAccessControlPolicyRoleMembersInternalServerError.md +17 -0
  8. data/docs/AddOryAccessControlPolicyRoleMembersInternalServerErrorBody.md +27 -0
  9. data/docs/AddOryAccessControlPolicyRoleMembersOK.md +17 -0
  10. data/docs/AuthorizationResult.md +17 -0
  11. data/docs/DeleteOryAccessControlPolicy.md +19 -0
  12. data/docs/DeleteOryAccessControlPolicyInternalServerError.md +17 -0
  13. data/docs/DeleteOryAccessControlPolicyInternalServerErrorBody.md +27 -0
  14. data/docs/DeleteOryAccessControlPolicyRole.md +19 -0
  15. data/docs/DeleteOryAccessControlPolicyRoleInternalServerError.md +17 -0
  16. data/docs/DeleteOryAccessControlPolicyRoleInternalServerErrorBody.md +27 -0
  17. data/docs/DoOryAccessControlPoliciesAllow.md +19 -0
  18. data/docs/DoOryAccessControlPoliciesAllowForbidden.md +17 -0
  19. data/docs/DoOryAccessControlPoliciesAllowInternalServerError.md +17 -0
  20. data/docs/DoOryAccessControlPoliciesAllowInternalServerErrorBody.md +27 -0
  21. data/docs/DoOryAccessControlPoliciesAllowOK.md +17 -0
  22. data/docs/EnginesApi.md +579 -0
  23. data/docs/GetOryAccessControlPolicy.md +19 -0
  24. data/docs/GetOryAccessControlPolicyInternalServerError.md +17 -0
  25. data/docs/GetOryAccessControlPolicyInternalServerErrorBody.md +27 -0
  26. data/docs/GetOryAccessControlPolicyNotFound.md +17 -0
  27. data/docs/GetOryAccessControlPolicyNotFoundBody.md +27 -0
  28. data/docs/GetOryAccessControlPolicyOK.md +17 -0
  29. data/docs/GetOryAccessControlPolicyRole.md +19 -0
  30. data/docs/GetOryAccessControlPolicyRoleInternalServerError.md +17 -0
  31. data/docs/GetOryAccessControlPolicyRoleInternalServerErrorBody.md +27 -0
  32. data/docs/GetOryAccessControlPolicyRoleNotFound.md +17 -0
  33. data/docs/GetOryAccessControlPolicyRoleNotFoundBody.md +27 -0
  34. data/docs/GetOryAccessControlPolicyRoleOK.md +17 -0
  35. data/docs/HealthApi.md +96 -0
  36. data/docs/HealthNotReadyStatus.md +17 -0
  37. data/docs/HealthStatus.md +17 -0
  38. data/docs/InlineResponse500.md +27 -0
  39. data/docs/Input.md +23 -0
  40. data/docs/IsInstanceAliveInternalServerError.md +17 -0
  41. data/docs/IsInstanceAliveInternalServerErrorBody.md +27 -0
  42. data/docs/IsInstanceAliveOK.md +17 -0
  43. data/docs/ListOryAccessControlPolicies.md +21 -0
  44. data/docs/ListOryAccessControlPoliciesInternalServerError.md +17 -0
  45. data/docs/ListOryAccessControlPoliciesInternalServerErrorBody.md +27 -0
  46. data/docs/ListOryAccessControlPoliciesOK.md +17 -0
  47. data/docs/ListOryAccessControlPolicyRoles.md +21 -0
  48. data/docs/ListOryAccessControlPolicyRolesInternalServerError.md +17 -0
  49. data/docs/ListOryAccessControlPolicyRolesInternalServerErrorBody.md +27 -0
  50. data/docs/ListOryAccessControlPolicyRolesOK.md +17 -0
  51. data/docs/OryAccessControlPolicies.md +17 -0
  52. data/docs/OryAccessControlPolicy.md +29 -0
  53. data/docs/OryAccessControlPolicyAllowedInput.md +23 -0
  54. data/docs/OryAccessControlPolicyRole.md +19 -0
  55. data/docs/OryAccessControlPolicyRoles.md +17 -0
  56. data/docs/Policy.md +29 -0
  57. data/docs/RemoveOryAccessControlPolicyRoleMembers.md +21 -0
  58. data/docs/RemoveOryAccessControlPolicyRoleMembersInternalServerError.md +17 -0
  59. data/docs/RemoveOryAccessControlPolicyRoleMembersInternalServerErrorBody.md +27 -0
  60. data/docs/Role.md +19 -0
  61. data/docs/SwaggerHealthStatus.md +17 -0
  62. data/docs/SwaggerNotReadyStatus.md +17 -0
  63. data/docs/SwaggerVersion.md +17 -0
  64. data/docs/UpsertOryAccessControlPolicy.md +19 -0
  65. data/docs/UpsertOryAccessControlPolicyInternalServerError.md +17 -0
  66. data/docs/UpsertOryAccessControlPolicyInternalServerErrorBody.md +27 -0
  67. data/docs/UpsertOryAccessControlPolicyOK.md +17 -0
  68. data/docs/UpsertOryAccessControlPolicyRole.md +19 -0
  69. data/docs/UpsertOryAccessControlPolicyRoleInternalServerError.md +17 -0
  70. data/docs/UpsertOryAccessControlPolicyRoleInternalServerErrorBody.md +27 -0
  71. data/docs/UpsertOryAccessControlPolicyRoleOK.md +17 -0
  72. data/docs/Version.md +17 -0
  73. data/docs/VersionApi.md +52 -0
  74. data/lib/ory-keto-client.rb +51 -0
  75. data/lib/ory-keto-client/api/engines_api.rb +778 -0
  76. data/lib/ory-keto-client/api/health_api.rb +134 -0
  77. data/lib/ory-keto-client/api/version_api.rb +78 -0
  78. data/lib/ory-keto-client/api_client.rb +387 -0
  79. data/lib/ory-keto-client/api_error.rb +57 -0
  80. data/lib/ory-keto-client/configuration.rb +241 -0
  81. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members.rb +237 -0
  82. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_body.rb +209 -0
  83. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_internal_server_error.rb +207 -0
  84. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_internal_server_error_body.rb +260 -0
  85. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_ok.rb +207 -0
  86. data/lib/ory-keto-client/models/authorization_result.rb +212 -0
  87. data/lib/ory-keto-client/models/delete_ory_access_control_policy.rb +228 -0
  88. data/lib/ory-keto-client/models/delete_ory_access_control_policy_internal_server_error.rb +207 -0
  89. data/lib/ory-keto-client/models/delete_ory_access_control_policy_internal_server_error_body.rb +260 -0
  90. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role.rb +228 -0
  91. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role_internal_server_error.rb +207 -0
  92. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role_internal_server_error_body.rb +260 -0
  93. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow.rb +222 -0
  94. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_forbidden.rb +207 -0
  95. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_internal_server_error.rb +207 -0
  96. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_internal_server_error_body.rb +260 -0
  97. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_ok.rb +207 -0
  98. data/lib/ory-keto-client/models/get_ory_access_control_policy.rb +228 -0
  99. data/lib/ory-keto-client/models/get_ory_access_control_policy_internal_server_error.rb +207 -0
  100. data/lib/ory-keto-client/models/get_ory_access_control_policy_internal_server_error_body.rb +260 -0
  101. data/lib/ory-keto-client/models/get_ory_access_control_policy_not_found.rb +207 -0
  102. data/lib/ory-keto-client/models/get_ory_access_control_policy_not_found_body.rb +260 -0
  103. data/lib/ory-keto-client/models/get_ory_access_control_policy_ok.rb +207 -0
  104. data/lib/ory-keto-client/models/get_ory_access_control_policy_role.rb +228 -0
  105. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_internal_server_error.rb +207 -0
  106. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_internal_server_error_body.rb +260 -0
  107. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_not_found.rb +207 -0
  108. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_not_found_body.rb +260 -0
  109. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_ok.rb +207 -0
  110. data/lib/ory-keto-client/models/health_not_ready_status.rb +209 -0
  111. data/lib/ory-keto-client/models/health_status.rb +207 -0
  112. data/lib/ory-keto-client/models/inline_response500.rb +253 -0
  113. data/lib/ory-keto-client/models/input.rb +239 -0
  114. data/lib/ory-keto-client/models/is_instance_alive_internal_server_error.rb +207 -0
  115. data/lib/ory-keto-client/models/is_instance_alive_internal_server_error_body.rb +260 -0
  116. data/lib/ory-keto-client/models/is_instance_alive_ok.rb +207 -0
  117. data/lib/ory-keto-client/models/list_ory_access_control_policies.rb +233 -0
  118. data/lib/ory-keto-client/models/list_ory_access_control_policies_internal_server_error.rb +207 -0
  119. data/lib/ory-keto-client/models/list_ory_access_control_policies_internal_server_error_body.rb +260 -0
  120. data/lib/ory-keto-client/models/list_ory_access_control_policies_ok.rb +210 -0
  121. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles.rb +233 -0
  122. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_internal_server_error.rb +207 -0
  123. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_internal_server_error_body.rb +260 -0
  124. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_ok.rb +210 -0
  125. data/lib/ory-keto-client/models/ory_access_control_policies.rb +209 -0
  126. data/lib/ory-keto-client/models/ory_access_control_policy.rb +273 -0
  127. data/lib/ory-keto-client/models/ory_access_control_policy_allowed_input.rb +237 -0
  128. data/lib/ory-keto-client/models/ory_access_control_policy_role.rb +220 -0
  129. data/lib/ory-keto-client/models/ory_access_control_policy_roles.rb +209 -0
  130. data/lib/ory-keto-client/models/policy.rb +275 -0
  131. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members.rb +243 -0
  132. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members_internal_server_error.rb +207 -0
  133. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members_internal_server_error_body.rb +260 -0
  134. data/lib/ory-keto-client/models/role.rb +220 -0
  135. data/lib/ory-keto-client/models/swagger_health_status.rb +208 -0
  136. data/lib/ory-keto-client/models/swagger_not_ready_status.rb +210 -0
  137. data/lib/ory-keto-client/models/swagger_version.rb +208 -0
  138. data/lib/ory-keto-client/models/upsert_ory_access_control_policy.rb +222 -0
  139. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_internal_server_error.rb +207 -0
  140. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_internal_server_error_body.rb +260 -0
  141. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_ok.rb +207 -0
  142. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role.rb +222 -0
  143. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_internal_server_error.rb +207 -0
  144. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_internal_server_error_body.rb +260 -0
  145. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_ok.rb +207 -0
  146. data/lib/ory-keto-client/models/version.rb +207 -0
  147. data/lib/ory-keto-client/version.rb +15 -0
  148. data/ory-keto-client.gemspec +39 -0
  149. data/spec/api/engines_api_spec.rb +182 -0
  150. data/spec/api/health_api_spec.rb +57 -0
  151. data/spec/api/version_api_spec.rb +46 -0
  152. data/spec/api_client_spec.rb +226 -0
  153. data/spec/configuration_spec.rb +42 -0
  154. data/spec/models/add_ory_access_control_policy_role_members_body_spec.rb +41 -0
  155. data/spec/models/add_ory_access_control_policy_role_members_internal_server_error_body_spec.rb +71 -0
  156. data/spec/models/add_ory_access_control_policy_role_members_internal_server_error_spec.rb +41 -0
  157. data/spec/models/add_ory_access_control_policy_role_members_ok_spec.rb +41 -0
  158. data/spec/models/add_ory_access_control_policy_role_members_spec.rb +53 -0
  159. data/spec/models/authorization_result_spec.rb +41 -0
  160. data/spec/models/delete_ory_access_control_policy_internal_server_error_body_spec.rb +71 -0
  161. data/spec/models/delete_ory_access_control_policy_internal_server_error_spec.rb +41 -0
  162. data/spec/models/delete_ory_access_control_policy_role_internal_server_error_body_spec.rb +71 -0
  163. data/spec/models/delete_ory_access_control_policy_role_internal_server_error_spec.rb +41 -0
  164. data/spec/models/delete_ory_access_control_policy_role_spec.rb +47 -0
  165. data/spec/models/delete_ory_access_control_policy_spec.rb +47 -0
  166. data/spec/models/do_ory_access_control_policies_allow_forbidden_spec.rb +41 -0
  167. data/spec/models/do_ory_access_control_policies_allow_internal_server_error_body_spec.rb +71 -0
  168. data/spec/models/do_ory_access_control_policies_allow_internal_server_error_spec.rb +41 -0
  169. data/spec/models/do_ory_access_control_policies_allow_ok_spec.rb +41 -0
  170. data/spec/models/do_ory_access_control_policies_allow_spec.rb +47 -0
  171. data/spec/models/get_ory_access_control_policy_internal_server_error_body_spec.rb +71 -0
  172. data/spec/models/get_ory_access_control_policy_internal_server_error_spec.rb +41 -0
  173. data/spec/models/get_ory_access_control_policy_not_found_body_spec.rb +71 -0
  174. data/spec/models/get_ory_access_control_policy_not_found_spec.rb +41 -0
  175. data/spec/models/get_ory_access_control_policy_ok_spec.rb +41 -0
  176. data/spec/models/get_ory_access_control_policy_role_internal_server_error_body_spec.rb +71 -0
  177. data/spec/models/get_ory_access_control_policy_role_internal_server_error_spec.rb +41 -0
  178. data/spec/models/get_ory_access_control_policy_role_not_found_body_spec.rb +71 -0
  179. data/spec/models/get_ory_access_control_policy_role_not_found_spec.rb +41 -0
  180. data/spec/models/get_ory_access_control_policy_role_ok_spec.rb +41 -0
  181. data/spec/models/get_ory_access_control_policy_role_spec.rb +47 -0
  182. data/spec/models/get_ory_access_control_policy_spec.rb +47 -0
  183. data/spec/models/health_not_ready_status_spec.rb +41 -0
  184. data/spec/models/health_status_spec.rb +41 -0
  185. data/spec/models/inline_response500_spec.rb +71 -0
  186. data/spec/models/input_spec.rb +59 -0
  187. data/spec/models/is_instance_alive_internal_server_error_body_spec.rb +71 -0
  188. data/spec/models/is_instance_alive_internal_server_error_spec.rb +41 -0
  189. data/spec/models/is_instance_alive_ok_spec.rb +41 -0
  190. data/spec/models/list_ory_access_control_policies_internal_server_error_body_spec.rb +71 -0
  191. data/spec/models/list_ory_access_control_policies_internal_server_error_spec.rb +41 -0
  192. data/spec/models/list_ory_access_control_policies_ok_spec.rb +41 -0
  193. data/spec/models/list_ory_access_control_policies_spec.rb +53 -0
  194. data/spec/models/list_ory_access_control_policy_roles_internal_server_error_body_spec.rb +71 -0
  195. data/spec/models/list_ory_access_control_policy_roles_internal_server_error_spec.rb +41 -0
  196. data/spec/models/list_ory_access_control_policy_roles_ok_spec.rb +41 -0
  197. data/spec/models/list_ory_access_control_policy_roles_spec.rb +53 -0
  198. data/spec/models/ory_access_control_policies_spec.rb +41 -0
  199. data/spec/models/ory_access_control_policy_allowed_input_spec.rb +59 -0
  200. data/spec/models/ory_access_control_policy_role_spec.rb +47 -0
  201. data/spec/models/ory_access_control_policy_roles_spec.rb +41 -0
  202. data/spec/models/ory_access_control_policy_spec.rb +77 -0
  203. data/spec/models/policy_spec.rb +77 -0
  204. data/spec/models/remove_ory_access_control_policy_role_members_internal_server_error_body_spec.rb +71 -0
  205. data/spec/models/remove_ory_access_control_policy_role_members_internal_server_error_spec.rb +41 -0
  206. data/spec/models/remove_ory_access_control_policy_role_members_spec.rb +53 -0
  207. data/spec/models/role_spec.rb +47 -0
  208. data/spec/models/swagger_health_status_spec.rb +41 -0
  209. data/spec/models/swagger_not_ready_status_spec.rb +41 -0
  210. data/spec/models/swagger_version_spec.rb +41 -0
  211. data/spec/models/upsert_ory_access_control_policy_internal_server_error_body_spec.rb +71 -0
  212. data/spec/models/upsert_ory_access_control_policy_internal_server_error_spec.rb +41 -0
  213. data/spec/models/upsert_ory_access_control_policy_ok_spec.rb +41 -0
  214. data/spec/models/upsert_ory_access_control_policy_role_internal_server_error_body_spec.rb +71 -0
  215. data/spec/models/upsert_ory_access_control_policy_role_internal_server_error_spec.rb +41 -0
  216. data/spec/models/upsert_ory_access_control_policy_role_ok_spec.rb +41 -0
  217. data/spec/models/upsert_ory_access_control_policy_role_spec.rb +47 -0
  218. data/spec/models/upsert_ory_access_control_policy_spec.rb +47 -0
  219. data/spec/models/version_spec.rb +41 -0
  220. data/spec/spec_helper.rb +111 -0
  221. metadata +396 -0
@@ -0,0 +1,237 @@
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.0.0-alpha.40
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ class OryAccessControlPolicyAllowedInput
17
+ # Action is the action that is requested on the resource.
18
+ attr_accessor :action
19
+
20
+ # Context is the request's environmental context.
21
+ attr_accessor :context
22
+
23
+ # Resource is the resource that access is requested to.
24
+ attr_accessor :resource
25
+
26
+ # Subject is the subject that is requesting access.
27
+ attr_accessor :subject
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'action' => :'action',
33
+ :'context' => :'context',
34
+ :'resource' => :'resource',
35
+ :'subject' => :'subject'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'action' => :'String',
43
+ :'context' => :'Object',
44
+ :'resource' => :'String',
45
+ :'subject' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::OryAccessControlPolicyAllowedInput` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::OryAccessControlPolicyAllowedInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'action')
71
+ self.action = attributes[:'action']
72
+ end
73
+
74
+ if attributes.key?(:'context')
75
+ self.context = attributes[:'context']
76
+ end
77
+
78
+ if attributes.key?(:'resource')
79
+ self.resource = attributes[:'resource']
80
+ end
81
+
82
+ if attributes.key?(:'subject')
83
+ self.subject = attributes[:'subject']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ action == o.action &&
106
+ context == o.context &&
107
+ resource == o.resource &&
108
+ subject == o.subject
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [action, context, resource, subject].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ OryHydraClient.const_get(type).build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end
@@ -0,0 +1,220 @@
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.0.0-alpha.40
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ # oryAccessControlPolicyRole represents a group of users that share the same role. A role could be an administrator, a moderator, a regular user or some other sort of role.
17
+ class OryAccessControlPolicyRole
18
+ # ID is the role's unique id.
19
+ attr_accessor :id
20
+
21
+ # Members is who belongs to the role.
22
+ attr_accessor :members
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'members' => :'members'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'id' => :'String',
36
+ :'members' => :'Array<String>'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::OryAccessControlPolicyRole` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::OryAccessControlPolicyRole`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'id')
62
+ self.id = attributes[:'id']
63
+ end
64
+
65
+ if attributes.key?(:'members')
66
+ if (value = attributes[:'members']).is_a?(Array)
67
+ self.members = value
68
+ end
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ id == o.id &&
91
+ members == o.members
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [id, members].hash
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 self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ OryHydraClient.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end