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