permit-sdk 0.0.1

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 (196) hide show
  1. checksums.yaml +7 -0
  2. data/lib/api/api.rb +25 -0
  3. data/lib/api/base.rb +26 -0
  4. data/lib/api/resources.rb +13 -0
  5. data/lib/api/tenants.rb +11 -0
  6. data/lib/api/users.rb +50 -0
  7. data/lib/api/utils.rb +9 -0
  8. data/lib/config.rb +23 -0
  9. data/lib/main.rb +49 -0
  10. data/lib/openapi_client/api/api_keys_api.rb +413 -0
  11. data/lib/openapi_client/api/audit_elements_data_api.rb +118 -0
  12. data/lib/openapi_client/api/audit_logs_api.rb +204 -0
  13. data/lib/openapi_client/api/authentication_api.rb +512 -0
  14. data/lib/openapi_client/api/condition_set_rules_api.rb +278 -0
  15. data/lib/openapi_client/api/condition_sets_api.rb +428 -0
  16. data/lib/openapi_client/api/decision_logs_api.rb +128 -0
  17. data/lib/openapi_client/api/decision_logs_ingress_api.rb +90 -0
  18. data/lib/openapi_client/api/default_api.rb +297 -0
  19. data/lib/openapi_client/api/elements_configs_api.rb +657 -0
  20. data/lib/openapi_client/api/environments_api.rb +462 -0
  21. data/lib/openapi_client/api/instructions_api.rb +91 -0
  22. data/lib/openapi_client/api/members_api.rb +354 -0
  23. data/lib/openapi_client/api/opal_data_api.rb +343 -0
  24. data/lib/openapi_client/api/organizations_api.rb +652 -0
  25. data/lib/openapi_client/api/policy_api.rb +138 -0
  26. data/lib/openapi_client/api/policy_decision_points_api.rb +382 -0
  27. data/lib/openapi_client/api/policy_git_repositories_api.rb +510 -0
  28. data/lib/openapi_client/api/projects_api.rb +365 -0
  29. data/lib/openapi_client/api/resource_actions_api.rb +455 -0
  30. data/lib/openapi_client/api/resource_attributes_api.rb +473 -0
  31. data/lib/openapi_client/api/resource_instances_api.rb +425 -0
  32. data/lib/openapi_client/api/resource_roles_api.rb +813 -0
  33. data/lib/openapi_client/api/resources_api.rb +514 -0
  34. data/lib/openapi_client/api/role_assignments_api.rb +278 -0
  35. data/lib/openapi_client/api/roles_api.rb +759 -0
  36. data/lib/openapi_client/api/tenants_api.rb +603 -0
  37. data/lib/openapi_client/api/user_attributes_api.rb +458 -0
  38. data/lib/openapi_client/api/users_api.rb +684 -0
  39. data/lib/openapi_client/api/users_elements_data_api.rb +638 -0
  40. data/lib/openapi_client/api_client.rb +392 -0
  41. data/lib/openapi_client/api_error.rb +57 -0
  42. data/lib/openapi_client/configuration.rb +280 -0
  43. data/lib/openapi_client/models/action_block_editable.rb +230 -0
  44. data/lib/openapi_client/models/action_block_read.rb +255 -0
  45. data/lib/openapi_client/models/action_object.rb +275 -0
  46. data/lib/openapi_client/models/actor.rb +57 -0
  47. data/lib/openapi_client/models/add_role_permissions.rb +227 -0
  48. data/lib/openapi_client/models/api_key_create.rb +269 -0
  49. data/lib/openapi_client/models/api_key_owner_type.rb +41 -0
  50. data/lib/openapi_client/models/api_key_read.rb +329 -0
  51. data/lib/openapi_client/models/api_key_scope_read.rb +245 -0
  52. data/lib/openapi_client/models/attribute_block_editable.rb +235 -0
  53. data/lib/openapi_client/models/attribute_block_read.rb +260 -0
  54. data/lib/openapi_client/models/attribute_type.rb +44 -0
  55. data/lib/openapi_client/models/attributes.rb +231 -0
  56. data/lib/openapi_client/models/audit_log.rb +415 -0
  57. data/lib/openapi_client/models/audit_log_objects.rb +282 -0
  58. data/lib/openapi_client/models/authn_me_api_key_read.rb +329 -0
  59. data/lib/openapi_client/models/authn_me_member_read.rb +352 -0
  60. data/lib/openapi_client/models/authn_me_read.rb +224 -0
  61. data/lib/openapi_client/models/authn_me_user_read.rb +440 -0
  62. data/lib/openapi_client/models/condition_set_create.rb +340 -0
  63. data/lib/openapi_client/models/condition_set_read.rb +409 -0
  64. data/lib/openapi_client/models/condition_set_rule_create.rb +279 -0
  65. data/lib/openapi_client/models/condition_set_rule_read.rb +360 -0
  66. data/lib/openapi_client/models/condition_set_rule_remove.rb +279 -0
  67. data/lib/openapi_client/models/condition_set_type.rb +40 -0
  68. data/lib/openapi_client/models/condition_set_update.rb +255 -0
  69. data/lib/openapi_client/models/data_source_config.rb +228 -0
  70. data/lib/openapi_client/models/data_source_entry.rb +272 -0
  71. data/lib/openapi_client/models/detailed_audit_log.rb +443 -0
  72. data/lib/openapi_client/models/dev_login.rb +225 -0
  73. data/lib/openapi_client/models/dummy_engine_model.rb +229 -0
  74. data/lib/openapi_client/models/elements_config_create.rb +319 -0
  75. data/lib/openapi_client/models/elements_config_read.rb +402 -0
  76. data/lib/openapi_client/models/elements_config_runtime_read.rb +238 -0
  77. data/lib/openapi_client/models/elements_config_update.rb +268 -0
  78. data/lib/openapi_client/models/elements_env_type_read.rb +242 -0
  79. data/lib/openapi_client/models/elements_env_type_update.rb +222 -0
  80. data/lib/openapi_client/models/elements_permission_level.rb +44 -0
  81. data/lib/openapi_client/models/elements_role_read.rb +378 -0
  82. data/lib/openapi_client/models/elements_type.rb +41 -0
  83. data/lib/openapi_client/models/elements_user_create.rb +295 -0
  84. data/lib/openapi_client/models/elements_user_role_create.rb +225 -0
  85. data/lib/openapi_client/models/elements_user_role_remove.rb +225 -0
  86. data/lib/openapi_client/models/embedded_login_request_output.rb +265 -0
  87. data/lib/openapi_client/models/engine.rb +39 -0
  88. data/lib/openapi_client/models/environment_create.rb +281 -0
  89. data/lib/openapi_client/models/environment_object.rb +295 -0
  90. data/lib/openapi_client/models/environment_read.rb +335 -0
  91. data/lib/openapi_client/models/environment_stats.rb +365 -0
  92. data/lib/openapi_client/models/environment_update.rb +240 -0
  93. data/lib/openapi_client/models/failed_invite.rb +238 -0
  94. data/lib/openapi_client/models/full_data.rb +258 -0
  95. data/lib/openapi_client/models/http_validation_error.rb +221 -0
  96. data/lib/openapi_client/models/identity_read.rb +300 -0
  97. data/lib/openapi_client/models/invite_attempt_result.rb +232 -0
  98. data/lib/openapi_client/models/invite_create.rb +240 -0
  99. data/lib/openapi_client/models/invite_read.rb +325 -0
  100. data/lib/openapi_client/models/invite_status.rb +42 -0
  101. data/lib/openapi_client/models/labels.rb +238 -0
  102. data/lib/openapi_client/models/language_instructions.rb +252 -0
  103. data/lib/openapi_client/models/location_inner.rb +230 -0
  104. data/lib/openapi_client/models/login_result.rb +259 -0
  105. data/lib/openapi_client/models/member_access_level.rb +41 -0
  106. data/lib/openapi_client/models/member_access_obj.rb +41 -0
  107. data/lib/openapi_client/models/multi_invite_result.rb +238 -0
  108. data/lib/openapi_client/models/onboarding_step.rb +46 -0
  109. data/lib/openapi_client/models/opa_decision_log.rb +288 -0
  110. data/lib/openapi_client/models/opa_engine_decision_log.rb +345 -0
  111. data/lib/openapi_client/models/opa_labels.rb +238 -0
  112. data/lib/openapi_client/models/opa_metrics.rb +273 -0
  113. data/lib/openapi_client/models/opal_client.rb +305 -0
  114. data/lib/openapi_client/models/org_member_read.rb +420 -0
  115. data/lib/openapi_client/models/org_member_update.rb +230 -0
  116. data/lib/openapi_client/models/organization_create.rb +292 -0
  117. data/lib/openapi_client/models/organization_object.rb +295 -0
  118. data/lib/openapi_client/models/organization_read.rb +295 -0
  119. data/lib/openapi_client/models/organization_read_with_api_key.rb +313 -0
  120. data/lib/openapi_client/models/organization_update.rb +247 -0
  121. data/lib/openapi_client/models/paginated_result_api_key_read.rb +285 -0
  122. data/lib/openapi_client/models/paginated_result_audit_log.rb +285 -0
  123. data/lib/openapi_client/models/paginated_result_elements_config_read.rb +285 -0
  124. data/lib/openapi_client/models/paginated_result_opa_decision_log.rb +285 -0
  125. data/lib/openapi_client/models/paginated_result_user_read.rb +285 -0
  126. data/lib/openapi_client/models/pdp.rb +259 -0
  127. data/lib/openapi_client/models/pdp_config_object.rb +258 -0
  128. data/lib/openapi_client/models/pdp_config_read.rb +292 -0
  129. data/lib/openapi_client/models/pdp_context.rb +291 -0
  130. data/lib/openapi_client/models/pdp_state.rb +224 -0
  131. data/lib/openapi_client/models/pdp_state_update.rb +238 -0
  132. data/lib/openapi_client/models/pdp_values.rb +252 -0
  133. data/lib/openapi_client/models/permission_level_role_read.rb +254 -0
  134. data/lib/openapi_client/models/policy_repo_create.rb +318 -0
  135. data/lib/openapi_client/models/policy_repo_read.rb +347 -0
  136. data/lib/openapi_client/models/policy_repo_status.rb +41 -0
  137. data/lib/openapi_client/models/programming_language.rb +43 -0
  138. data/lib/openapi_client/models/project_create.rb +318 -0
  139. data/lib/openapi_client/models/project_object.rb +295 -0
  140. data/lib/openapi_client/models/project_read.rb +357 -0
  141. data/lib/openapi_client/models/project_update.rb +250 -0
  142. data/lib/openapi_client/models/raw_data.rb +329 -0
  143. data/lib/openapi_client/models/relationship_tuple_object.rb +252 -0
  144. data/lib/openapi_client/models/remote_config.rb +256 -0
  145. data/lib/openapi_client/models/remove_role_permissions.rb +227 -0
  146. data/lib/openapi_client/models/resource_action_create.rb +271 -0
  147. data/lib/openapi_client/models/resource_action_read.rb +370 -0
  148. data/lib/openapi_client/models/resource_action_update.rb +230 -0
  149. data/lib/openapi_client/models/resource_attribute_create.rb +271 -0
  150. data/lib/openapi_client/models/resource_attribute_read.rb +370 -0
  151. data/lib/openapi_client/models/resource_attribute_update.rb +230 -0
  152. data/lib/openapi_client/models/resource_attributes.rb +238 -0
  153. data/lib/openapi_client/models/resource_create.rb +310 -0
  154. data/lib/openapi_client/models/resource_id.rb +230 -0
  155. data/lib/openapi_client/models/resource_instance_create.rb +281 -0
  156. data/lib/openapi_client/models/resource_instance_read.rb +375 -0
  157. data/lib/openapi_client/models/resource_instance_update.rb +220 -0
  158. data/lib/openapi_client/models/resource_read.rb +374 -0
  159. data/lib/openapi_client/models/resource_replace.rb +274 -0
  160. data/lib/openapi_client/models/resource_role_create.rb +295 -0
  161. data/lib/openapi_client/models/resource_role_read.rb +379 -0
  162. data/lib/openapi_client/models/resource_role_update.rb +254 -0
  163. data/lib/openapi_client/models/resource_type_object.rb +286 -0
  164. data/lib/openapi_client/models/resource_update.rb +264 -0
  165. data/lib/openapi_client/models/role_assignment_create.rb +255 -0
  166. data/lib/openapi_client/models/role_assignment_read.rb +375 -0
  167. data/lib/openapi_client/models/role_assignment_remove.rb +255 -0
  168. data/lib/openapi_client/models/role_block.rb +244 -0
  169. data/lib/openapi_client/models/role_create.rb +295 -0
  170. data/lib/openapi_client/models/role_data.rb +221 -0
  171. data/lib/openapi_client/models/role_read.rb +364 -0
  172. data/lib/openapi_client/models/role_update.rb +254 -0
  173. data/lib/openapi_client/models/settings.rb +231 -0
  174. data/lib/openapi_client/models/ssh_auth_data.rb +295 -0
  175. data/lib/openapi_client/models/statistics.rb +389 -0
  176. data/lib/openapi_client/models/tenant_create.rb +281 -0
  177. data/lib/openapi_client/models/tenant_object.rb +284 -0
  178. data/lib/openapi_client/models/tenant_read.rb +365 -0
  179. data/lib/openapi_client/models/tenant_update.rb +240 -0
  180. data/lib/openapi_client/models/user_create.rb +286 -0
  181. data/lib/openapi_client/models/user_data.rb +232 -0
  182. data/lib/openapi_client/models/user_login_request_input.rb +240 -0
  183. data/lib/openapi_client/models/user_object.rb +313 -0
  184. data/lib/openapi_client/models/user_read.rb +336 -0
  185. data/lib/openapi_client/models/user_role.rb +240 -0
  186. data/lib/openapi_client/models/user_role_create.rb +240 -0
  187. data/lib/openapi_client/models/user_role_remove.rb +240 -0
  188. data/lib/openapi_client/models/user_update.rb +250 -0
  189. data/lib/openapi_client/models/validation_error.rb +254 -0
  190. data/lib/openapi_client/models/webhook_create.rb +235 -0
  191. data/lib/openapi_client/models/webhook_read.rb +315 -0
  192. data/lib/openapi_client/models/webhook_update.rb +230 -0
  193. data/lib/openapi_client/version.rb +15 -0
  194. data/lib/openapi_client.rb +220 -0
  195. data/lib/permit.rb +58 -0
  196. metadata +251 -0
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #Permit.io API
3
+
4
+ # Authorization as a service
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class ElementsUserRoleRemove
18
+ # the role that will be unassigned (accepts either the role id or the role key)
19
+ attr_accessor :role
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'role' => :'role'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'role' => :'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 `OpenapiClient::ElementsUserRoleRemove` 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 `OpenapiClient::ElementsUserRoleRemove`. 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?(:'role')
62
+ self.role = attributes[:'role']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ if @role.nil?
71
+ invalid_properties.push('invalid value for "role", role cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @role.nil?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ role == o.role
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [role].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ self.class.openapi_types.each_pair do |key, type|
118
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
119
+ self.send("#{key}=", nil)
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = OpenapiClient.const_get(type)
173
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #Permit.io API
3
+
4
+ # Authorization as a service
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class EmbeddedLoginRequestOutput
18
+ # If the login request failed, this field will contain the error message
19
+ attr_accessor :error
20
+
21
+ # If the login request failed, this field will contain the error code
22
+ attr_accessor :error_code
23
+
24
+ # The auth token that lets your users login into permit elements
25
+ attr_accessor :token
26
+
27
+ # Extra data that you can pass to the login request
28
+ attr_accessor :extra
29
+
30
+ # The full URL to which the user should be redirected in order to complete the login process
31
+ attr_accessor :redirect_url
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'error' => :'error',
37
+ :'error_code' => :'error_code',
38
+ :'token' => :'token',
39
+ :'extra' => :'extra',
40
+ :'redirect_url' => :'redirect_url'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'error' => :'String',
53
+ :'error_code' => :'Integer',
54
+ :'token' => :'String',
55
+ :'extra' => :'String',
56
+ :'redirect_url' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::EmbeddedLoginRequestOutput` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::EmbeddedLoginRequestOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'error')
82
+ self.error = attributes[:'error']
83
+ end
84
+
85
+ if attributes.key?(:'error_code')
86
+ self.error_code = attributes[:'error_code']
87
+ end
88
+
89
+ if attributes.key?(:'token')
90
+ self.token = attributes[:'token']
91
+ end
92
+
93
+ if attributes.key?(:'extra')
94
+ self.extra = attributes[:'extra']
95
+ end
96
+
97
+ if attributes.key?(:'redirect_url')
98
+ self.redirect_url = attributes[:'redirect_url']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ if @redirect_url.nil?
107
+ invalid_properties.push('invalid value for "redirect_url", redirect_url cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return false if @redirect_url.nil?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ error == o.error &&
126
+ error_code == o.error_code &&
127
+ token == o.token &&
128
+ extra == o.extra &&
129
+ redirect_url == o.redirect_url
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [error, error_code, token, extra, redirect_url].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
159
+ self.send("#{key}=", nil)
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :Time
181
+ Time.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ # models (e.g. Pet) or oneOf
212
+ klass = OpenapiClient.const_get(type)
213
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+
265
+ end
@@ -0,0 +1,39 @@
1
+ =begin
2
+ #Permit.io API
3
+
4
+ # Authorization as a service
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class Engine
18
+ OPA = "OPA".freeze
19
+
20
+ def self.all_vars
21
+ @all_vars ||= [OPA].freeze
22
+ end
23
+
24
+ # Builds the enum from string
25
+ # @param [String] The enum value in the form of the string
26
+ # @return [String] The enum value
27
+ def self.build_from_hash(value)
28
+ new.build_from_hash(value)
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def build_from_hash(value)
35
+ return value if Engine.all_vars.include?(value)
36
+ raise "Invalid ENUM value #{value} for class #Engine"
37
+ end
38
+ end
39
+ end