ory-kratos-client 0.1.1.alpha1 → 0.5.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +86 -48
  4. data/docs/AdminApi.md +290 -85
  5. data/docs/CommonApi.md +111 -16
  6. data/docs/CompleteSelfServiceBrowserSettingsStrategyProfileFlowPayload.md +19 -0
  7. data/docs/CompleteSelfServiceLoginFlowWithPasswordMethod.md +21 -0
  8. data/docs/CompleteSelfServiceRecoveryFlowWithLinkMethod.md +19 -0
  9. data/docs/CompleteSelfServiceSettingsFlowWithPasswordMethod.md +19 -0
  10. data/docs/CompleteSelfServiceVerificationFlowWithLinkMethod.md +19 -0
  11. data/docs/CreateIdentity.md +19 -0
  12. data/docs/CreateRecoveryLink.md +19 -0
  13. data/docs/ErrorContainer.md +2 -2
  14. data/docs/Form.md +3 -3
  15. data/docs/FormField.md +8 -8
  16. data/docs/GenericErrorPayload.md +1 -1
  17. data/docs/Identity.md +9 -7
  18. data/docs/LoginFlow.md +33 -0
  19. data/docs/LoginFlowMethod.md +19 -0
  20. data/docs/LoginFlowMethodConfig.md +25 -0
  21. data/docs/LoginRequest.md +4 -0
  22. data/docs/LoginRequestMethodConfig.md +3 -3
  23. data/docs/LoginViaApiResponse.md +19 -0
  24. data/docs/Message.md +23 -0
  25. data/docs/ProviderCredentialsConfig.md +19 -0
  26. data/docs/PublicApi.md +806 -141
  27. data/docs/RecoveryAddress.md +21 -0
  28. data/docs/RecoveryFlow.md +33 -0
  29. data/docs/RecoveryFlowMethod.md +19 -0
  30. data/docs/RecoveryFlowMethodConfig.md +23 -0
  31. data/docs/RecoveryLink.md +19 -0
  32. data/docs/RecoveryRequest.md +31 -0
  33. data/docs/RecoveryRequestMethod.md +19 -0
  34. data/docs/RegistrationFlow.md +31 -0
  35. data/docs/RegistrationFlowMethod.md +19 -0
  36. data/docs/RegistrationFlowMethodConfig.md +25 -0
  37. data/docs/RegistrationRequest.md +3 -1
  38. data/docs/RegistrationRequestMethodConfig.md +3 -3
  39. data/docs/RegistrationViaApiResponse.md +21 -0
  40. data/docs/RequestMethodConfig.md +23 -0
  41. data/docs/RevokeSession.md +17 -0
  42. data/docs/Session.md +6 -4
  43. data/docs/SettingsFlow.md +35 -0
  44. data/docs/SettingsFlowMethod.md +19 -0
  45. data/docs/SettingsFlowMethodConfig.md +23 -0
  46. data/docs/SettingsRequest.md +33 -0
  47. data/docs/SettingsRequestMethod.md +19 -0
  48. data/docs/SettingsViaApiResponse.md +19 -0
  49. data/docs/UpdateIdentity.md +19 -0
  50. data/docs/VerifiableAddress.md +4 -4
  51. data/docs/VerificationFlow.md +33 -0
  52. data/docs/VerificationFlowMethod.md +19 -0
  53. data/docs/VerificationFlowMethodConfig.md +23 -0
  54. data/docs/VerificationRequest.md +3 -1
  55. data/lib/ory-kratos-client.rb +31 -14
  56. data/lib/ory-kratos-client/api/admin_api.rb +379 -128
  57. data/lib/ory-kratos-client/api/common_api.rb +150 -27
  58. data/lib/ory-kratos-client/api/health_api.rb +2 -2
  59. data/lib/ory-kratos-client/api/public_api.rb +1000 -234
  60. data/lib/ory-kratos-client/api/version_api.rb +2 -2
  61. data/lib/ory-kratos-client/api_client.rb +10 -7
  62. data/lib/ory-kratos-client/api_error.rb +2 -2
  63. data/lib/ory-kratos-client/configuration.rb +9 -2
  64. data/lib/ory-kratos-client/models/complete_self_service_browser_settings_strategy_profile_flow_payload.rb +222 -0
  65. data/lib/ory-kratos-client/models/complete_self_service_login_flow_with_password_method.rb +227 -0
  66. data/lib/ory-kratos-client/models/complete_self_service_recovery_flow_with_link_method.rb +217 -0
  67. data/lib/ory-kratos-client/models/complete_self_service_settings_flow_with_password_method.rb +222 -0
  68. data/lib/ory-kratos-client/models/complete_self_service_verification_flow_with_link_method.rb +217 -0
  69. data/lib/ory-kratos-client/models/create_identity.rb +227 -0
  70. data/lib/ory-kratos-client/models/create_recovery_link.rb +238 -0
  71. data/lib/ory-kratos-client/models/error_container.rb +13 -2
  72. data/lib/ory-kratos-client/models/form.rb +15 -16
  73. data/lib/ory-kratos-client/models/form_field.rb +16 -22
  74. data/lib/ory-kratos-client/models/generic_error.rb +2 -2
  75. data/lib/ory-kratos-client/models/generic_error_payload.rb +4 -7
  76. data/lib/ory-kratos-client/models/health_not_ready_status.rb +2 -2
  77. data/lib/ory-kratos-client/models/health_status.rb +2 -2
  78. data/lib/ory-kratos-client/models/identity.rb +53 -35
  79. data/lib/ory-kratos-client/models/login_flow.rb +315 -0
  80. data/lib/ory-kratos-client/models/login_flow_method.rb +226 -0
  81. data/lib/ory-kratos-client/models/login_flow_method_config.rb +267 -0
  82. data/lib/ory-kratos-client/models/login_request.rb +24 -3
  83. data/lib/ory-kratos-client/models/login_request_method.rb +2 -2
  84. data/lib/ory-kratos-client/models/login_request_method_config.rb +15 -16
  85. data/lib/ory-kratos-client/models/login_via_api_response.rb +227 -0
  86. data/lib/ory-kratos-client/models/message.rb +234 -0
  87. data/lib/ory-kratos-client/models/provider_credentials_config.rb +215 -0
  88. data/lib/ory-kratos-client/models/recovery_address.rb +239 -0
  89. data/lib/ory-kratos-client/models/recovery_flow.rb +319 -0
  90. data/lib/ory-kratos-client/models/recovery_flow_method.rb +226 -0
  91. data/lib/ory-kratos-client/models/recovery_flow_method_config.rb +255 -0
  92. data/lib/ory-kratos-client/models/recovery_link.rb +222 -0
  93. data/lib/ory-kratos-client/models/recovery_request.rb +309 -0
  94. data/lib/ory-kratos-client/models/recovery_request_method.rb +216 -0
  95. data/lib/ory-kratos-client/models/registration_flow.rb +304 -0
  96. data/lib/ory-kratos-client/models/registration_flow_method.rb +226 -0
  97. data/lib/ory-kratos-client/models/registration_flow_method_config.rb +267 -0
  98. data/lib/ory-kratos-client/models/registration_request.rb +14 -8
  99. data/lib/ory-kratos-client/models/registration_request_method.rb +2 -2
  100. data/lib/ory-kratos-client/models/registration_request_method_config.rb +15 -16
  101. data/lib/ory-kratos-client/models/registration_via_api_response.rb +236 -0
  102. data/lib/ory-kratos-client/models/request_method_config.rb +255 -0
  103. data/lib/ory-kratos-client/models/revoke_session.rb +212 -0
  104. data/lib/ory-kratos-client/models/session.rb +29 -20
  105. data/lib/ory-kratos-client/models/settings_flow.rb +333 -0
  106. data/lib/ory-kratos-client/models/settings_flow_method.rb +226 -0
  107. data/lib/ory-kratos-client/models/settings_flow_method_config.rb +255 -0
  108. data/lib/ory-kratos-client/models/settings_request.rb +323 -0
  109. data/lib/ory-kratos-client/models/settings_request_method.rb +216 -0
  110. data/lib/ory-kratos-client/models/settings_via_api_response.rb +226 -0
  111. data/lib/ory-kratos-client/models/update_identity.rb +222 -0
  112. data/lib/ory-kratos-client/models/verifiable_address.rb +17 -22
  113. data/lib/ory-kratos-client/models/verification_flow.rb +299 -0
  114. data/lib/ory-kratos-client/models/verification_flow_method.rb +226 -0
  115. data/lib/ory-kratos-client/models/verification_flow_method_config.rb +255 -0
  116. data/lib/ory-kratos-client/models/verification_request.rb +15 -4
  117. data/lib/ory-kratos-client/models/version.rb +2 -2
  118. data/lib/ory-kratos-client/version.rb +3 -3
  119. data/ory-kratos-client.gemspec +2 -2
  120. data/spec/models/complete_self_service_browser_settings_strategy_profile_flow_payload_spec.rb +47 -0
  121. data/spec/models/complete_self_service_login_flow_with_password_method_spec.rb +53 -0
  122. data/spec/models/complete_self_service_recovery_flow_with_link_method_spec.rb +47 -0
  123. data/spec/models/complete_self_service_settings_flow_with_password_method_spec.rb +47 -0
  124. data/spec/models/complete_self_service_verification_flow_with_link_method_spec.rb +47 -0
  125. data/spec/models/create_identity_spec.rb +47 -0
  126. data/spec/models/create_recovery_link_spec.rb +47 -0
  127. data/spec/models/login_flow_method_config_spec.rb +65 -0
  128. data/spec/models/login_flow_method_spec.rb +47 -0
  129. data/spec/models/login_flow_spec.rb +89 -0
  130. data/spec/models/login_via_api_response_spec.rb +47 -0
  131. data/spec/models/message_spec.rb +59 -0
  132. data/spec/models/provider_credentials_config_spec.rb +47 -0
  133. data/spec/models/recovery_address_spec.rb +53 -0
  134. data/spec/models/recovery_flow_method_config_spec.rb +59 -0
  135. data/spec/models/recovery_flow_method_spec.rb +47 -0
  136. data/spec/models/recovery_flow_spec.rb +89 -0
  137. data/spec/models/recovery_link_spec.rb +47 -0
  138. data/spec/models/recovery_request_method_spec.rb +47 -0
  139. data/spec/models/recovery_request_spec.rb +83 -0
  140. data/spec/models/registration_flow_method_config_spec.rb +65 -0
  141. data/spec/models/registration_flow_method_spec.rb +47 -0
  142. data/spec/models/registration_flow_spec.rb +83 -0
  143. data/spec/models/registration_via_api_response_spec.rb +53 -0
  144. data/spec/models/request_method_config_spec.rb +59 -0
  145. data/spec/models/revoke_session_spec.rb +41 -0
  146. data/spec/models/settings_flow_method_config_spec.rb +59 -0
  147. data/spec/models/settings_flow_method_spec.rb +47 -0
  148. data/spec/models/settings_flow_spec.rb +95 -0
  149. data/spec/models/settings_request_method_spec.rb +47 -0
  150. data/spec/models/settings_request_spec.rb +83 -0
  151. data/spec/models/settings_via_api_response_spec.rb +47 -0
  152. data/spec/models/update_identity_spec.rb +47 -0
  153. data/spec/models/verification_flow_method_config_spec.rb +59 -0
  154. data/spec/models/verification_flow_method_spec.rb +47 -0
  155. data/spec/models/verification_flow_spec.rb +89 -0
  156. metadata +161 -17
@@ -0,0 +1,315 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.5.0-alpha.1
7
+
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
+ # This object represents a login flow. A login flow is initiated at the \"Initiate Login API / Browser Flow\" endpoint by a client. Once a login flow is completed successfully, a session cookie or session token will be issued.
17
+ class LoginFlow
18
+ # and so on.
19
+ attr_accessor :active
20
+
21
+ # ExpiresAt is the time (UTC) when the flow expires. If the user still wishes to log in, a new flow has to be initiated.
22
+ attr_accessor :expires_at
23
+
24
+ # Forced stores whether this login flow should enforce re-authentication.
25
+ attr_accessor :forced
26
+
27
+ attr_accessor :id
28
+
29
+ # IssuedAt is the time (UTC) when the flow started.
30
+ attr_accessor :issued_at
31
+
32
+ attr_accessor :messages
33
+
34
+ # List of login methods This is the list of available login methods with their required form fields, such as `identifier` and `password` for the password login method. This will also contain error messages such as \"password can not be empty\".
35
+ attr_accessor :methods
36
+
37
+ # RequestURL is the initial URL that was requested from ORY Kratos. It can be used to forward information contained in the URL's path or query for example.
38
+ attr_accessor :request_url
39
+
40
+ # The flow type can either be `api` or `browser`.
41
+ attr_accessor :type
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'active' => :'active',
47
+ :'expires_at' => :'expires_at',
48
+ :'forced' => :'forced',
49
+ :'id' => :'id',
50
+ :'issued_at' => :'issued_at',
51
+ :'messages' => :'messages',
52
+ :'methods' => :'methods',
53
+ :'request_url' => :'request_url',
54
+ :'type' => :'type'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'active' => :'String',
62
+ :'expires_at' => :'DateTime',
63
+ :'forced' => :'Boolean',
64
+ :'id' => :'String',
65
+ :'issued_at' => :'DateTime',
66
+ :'messages' => :'Array<Message>',
67
+ :'methods' => :'Hash<String, LoginFlowMethod>',
68
+ :'request_url' => :'String',
69
+ :'type' => :'String'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::LoginFlow` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::LoginFlow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'active')
95
+ self.active = attributes[:'active']
96
+ end
97
+
98
+ if attributes.key?(:'expires_at')
99
+ self.expires_at = attributes[:'expires_at']
100
+ end
101
+
102
+ if attributes.key?(:'forced')
103
+ self.forced = attributes[:'forced']
104
+ end
105
+
106
+ if attributes.key?(:'id')
107
+ self.id = attributes[:'id']
108
+ end
109
+
110
+ if attributes.key?(:'issued_at')
111
+ self.issued_at = attributes[:'issued_at']
112
+ end
113
+
114
+ if attributes.key?(:'messages')
115
+ if (value = attributes[:'messages']).is_a?(Array)
116
+ self.messages = value
117
+ end
118
+ end
119
+
120
+ if attributes.key?(:'methods')
121
+ if (value = attributes[:'methods']).is_a?(Hash)
122
+ self.methods = value
123
+ end
124
+ end
125
+
126
+ if attributes.key?(:'request_url')
127
+ self.request_url = attributes[:'request_url']
128
+ end
129
+
130
+ if attributes.key?(:'type')
131
+ self.type = attributes[:'type']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ invalid_properties = Array.new
139
+ if @expires_at.nil?
140
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
141
+ end
142
+
143
+ if @id.nil?
144
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
145
+ end
146
+
147
+ if @issued_at.nil?
148
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
149
+ end
150
+
151
+ if @methods.nil?
152
+ invalid_properties.push('invalid value for "methods", methods cannot be nil.')
153
+ end
154
+
155
+ if @request_url.nil?
156
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
157
+ end
158
+
159
+ invalid_properties
160
+ end
161
+
162
+ # Check to see if the all the properties in the model are valid
163
+ # @return true if the model is valid
164
+ def valid?
165
+ return false if @expires_at.nil?
166
+ return false if @id.nil?
167
+ return false if @issued_at.nil?
168
+ return false if @methods.nil?
169
+ return false if @request_url.nil?
170
+ true
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ active == o.active &&
179
+ expires_at == o.expires_at &&
180
+ forced == o.forced &&
181
+ id == o.id &&
182
+ issued_at == o.issued_at &&
183
+ messages == o.messages &&
184
+ methods == o.methods &&
185
+ request_url == o.request_url &&
186
+ type == o.type
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [active, expires_at, forced, id, issued_at, messages, methods, request_url, type].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ new.build_from_hash(attributes)
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ self.class.openapi_types.each_pair do |key, type|
214
+ if type =~ /\AArray<(.*)>/i
215
+ # check to ensure the input is an array given that the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
218
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
219
+ end
220
+ elsif !attributes[self.class.attribute_map[key]].nil?
221
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
222
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
223
+ end
224
+
225
+ self
226
+ end
227
+
228
+ # Deserializes the data based on type
229
+ # @param string type Data type
230
+ # @param string value Value to be deserialized
231
+ # @return [Object] Deserialized data
232
+ def _deserialize(type, value)
233
+ case type.to_sym
234
+ when :DateTime
235
+ DateTime.parse(value)
236
+ when :Date
237
+ Date.parse(value)
238
+ when :String
239
+ value.to_s
240
+ when :Integer
241
+ value.to_i
242
+ when :Float
243
+ value.to_f
244
+ when :Boolean
245
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
246
+ true
247
+ else
248
+ false
249
+ end
250
+ when :Object
251
+ # generic object (usually a Hash), return directly
252
+ value
253
+ when /\AArray<(?<inner_type>.+)>\z/
254
+ inner_type = Regexp.last_match[:inner_type]
255
+ value.map { |v| _deserialize(inner_type, v) }
256
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
257
+ k_type = Regexp.last_match[:k_type]
258
+ v_type = Regexp.last_match[:v_type]
259
+ {}.tap do |hash|
260
+ value.each do |k, v|
261
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
262
+ end
263
+ end
264
+ else # model
265
+ OryHydraClient.const_get(type).build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ # Returns the object in the form of hash
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_hash
284
+ hash = {}
285
+ self.class.attribute_map.each_pair do |attr, param|
286
+ value = self.send(attr)
287
+ if value.nil?
288
+ is_nullable = self.class.openapi_nullable.include?(attr)
289
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
+ end
291
+
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+ end
315
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.5.0-alpha.1
7
+
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 LoginFlowMethod
17
+ attr_accessor :config
18
+
19
+ # and so on.
20
+ attr_accessor :method
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'config' => :'config',
26
+ :'method' => :'method'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'config' => :'LoginFlowMethodConfig',
34
+ :'method' => :'String'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::LoginFlowMethod` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::LoginFlowMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'config')
60
+ self.config = attributes[:'config']
61
+ end
62
+
63
+ if attributes.key?(:'method')
64
+ self.method = attributes[:'method']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @config.nil?
73
+ invalid_properties.push('invalid value for "config", config cannot be nil.')
74
+ end
75
+
76
+ if @method.nil?
77
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
78
+ end
79
+
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ return false if @config.nil?
87
+ return false if @method.nil?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ config == o.config &&
97
+ method == o.method
98
+ end
99
+
100
+ # @see the `==` method
101
+ # @param [Object] Object to be compared
102
+ def eql?(o)
103
+ self == o
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Integer] Hash code
108
+ def hash
109
+ [config, method].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def self.build_from_hash(attributes)
116
+ new.build_from_hash(attributes)
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.openapi_types.each_pair do |key, type|
125
+ if type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ OryHydraClient.const_get(type).build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+ end
226
+ end