ory-kratos-client 0.3.0.alpha1 → 0.4.6.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +14 -6
  4. data/docs/AdminApi.md +53 -5
  5. data/docs/CommonApi.md +53 -5
  6. data/docs/Form.md +2 -2
  7. data/docs/FormField.md +3 -3
  8. data/docs/GenericErrorPayload.md +1 -1
  9. data/docs/Identity.md +9 -7
  10. data/docs/LoginRequest.md +2 -0
  11. data/docs/LoginRequestMethodConfig.md +2 -2
  12. data/docs/Message.md +23 -0
  13. data/docs/PublicApi.md +153 -13
  14. data/docs/RecoveryAddress.md +21 -0
  15. data/docs/RecoveryRequest.md +31 -0
  16. data/docs/RecoveryRequestMethod.md +19 -0
  17. data/docs/RegistrationRequest.md +2 -0
  18. data/docs/RegistrationRequestMethodConfig.md +2 -2
  19. data/docs/RequestMethodConfig.md +2 -2
  20. data/docs/SettingsRequest.md +4 -2
  21. data/docs/VerificationRequest.md +2 -0
  22. data/lib/ory-kratos-client.rb +6 -3
  23. data/lib/ory-kratos-client/api/admin_api.rb +73 -10
  24. data/lib/ory-kratos-client/api/common_api.rb +73 -10
  25. data/lib/ory-kratos-client/api/health_api.rb +2 -2
  26. data/lib/ory-kratos-client/api/public_api.rb +198 -20
  27. data/lib/ory-kratos-client/api/version_api.rb +2 -2
  28. data/lib/ory-kratos-client/api_client.rb +9 -7
  29. data/lib/ory-kratos-client/api_error.rb +2 -2
  30. data/lib/ory-kratos-client/configuration.rb +2 -2
  31. data/lib/ory-kratos-client/models/complete_self_service_browser_settings_strategy_profile_flow_payload.rb +2 -2
  32. data/lib/ory-kratos-client/models/error_container.rb +2 -2
  33. data/lib/ory-kratos-client/models/form.rb +14 -15
  34. data/lib/ory-kratos-client/models/form_field.rb +11 -11
  35. data/lib/ory-kratos-client/models/generic_error.rb +2 -2
  36. data/lib/ory-kratos-client/models/generic_error_payload.rb +4 -6
  37. data/lib/ory-kratos-client/models/health_not_ready_status.rb +2 -2
  38. data/lib/ory-kratos-client/models/health_status.rb +2 -2
  39. data/lib/ory-kratos-client/models/identity.rb +48 -35
  40. data/lib/ory-kratos-client/models/login_request.rb +14 -3
  41. data/lib/ory-kratos-client/models/login_request_method.rb +2 -2
  42. data/lib/ory-kratos-client/models/login_request_method_config.rb +14 -15
  43. data/lib/ory-kratos-client/models/message.rb +233 -0
  44. data/lib/ory-kratos-client/models/provider_credentials_config.rb +2 -2
  45. data/lib/ory-kratos-client/models/recovery_address.rb +239 -0
  46. data/lib/ory-kratos-client/models/recovery_request.rb +309 -0
  47. data/lib/ory-kratos-client/models/recovery_request_method.rb +216 -0
  48. data/lib/ory-kratos-client/models/registration_request.rb +14 -3
  49. data/lib/ory-kratos-client/models/registration_request_method.rb +2 -2
  50. data/lib/ory-kratos-client/models/registration_request_method_config.rb +14 -15
  51. data/lib/ory-kratos-client/models/request_method_config.rb +14 -15
  52. data/lib/ory-kratos-client/models/session.rb +2 -2
  53. data/lib/ory-kratos-client/models/settings_request.rb +23 -13
  54. data/lib/ory-kratos-client/models/settings_request_method.rb +2 -2
  55. data/lib/ory-kratos-client/models/verifiable_address.rb +2 -2
  56. data/lib/ory-kratos-client/models/verification_request.rb +14 -3
  57. data/lib/ory-kratos-client/models/version.rb +2 -2
  58. data/lib/ory-kratos-client/version.rb +3 -3
  59. data/ory-kratos-client.gemspec +2 -2
  60. data/spec/models/message_spec.rb +59 -0
  61. data/spec/models/recovery_address_spec.rb +53 -0
  62. data/spec/models/recovery_request_method_spec.rb +47 -0
  63. data/spec/models/recovery_request_spec.rb +83 -0
  64. metadata +40 -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