ory-kratos-client 0.0.3.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +128 -0
  4. data/Rakefile +10 -0
  5. data/docs/AdminApi.md +389 -0
  6. data/docs/CommonApi.md +152 -0
  7. data/docs/CompleteSelfServiceBrowserProfileManagementFlowPayload.md +17 -0
  8. data/docs/Error.md +17 -0
  9. data/docs/Form.md +23 -0
  10. data/docs/FormField.md +25 -0
  11. data/docs/GenericError.md +17 -0
  12. data/docs/GenericErrorPayload.md +29 -0
  13. data/docs/HealthApi.md +96 -0
  14. data/docs/HealthNotReadyStatus.md +17 -0
  15. data/docs/HealthStatus.md +17 -0
  16. data/docs/Identity.md +23 -0
  17. data/docs/LoginRequest.md +27 -0
  18. data/docs/LoginRequestMethod.md +19 -0
  19. data/docs/LoginRequestMethodConfig.md +16 -0
  20. data/docs/OidcStrategyCredentialsConfig.md +19 -0
  21. data/docs/OidcStrategyRequestMethod.md +25 -0
  22. data/docs/ProfileManagementRequest.md +29 -0
  23. data/docs/PublicApi.md +419 -0
  24. data/docs/RegistrationRequest.md +27 -0
  25. data/docs/RegistrationRequestMethod.md +19 -0
  26. data/docs/RegistrationRequestMethodConfig.md +16 -0
  27. data/docs/Session.md +25 -0
  28. data/docs/Version.md +17 -0
  29. data/docs/VersionApi.md +52 -0
  30. data/lib/ory-kratos-client.rb +62 -0
  31. data/lib/ory-kratos-client/api/admin_api.rb +525 -0
  32. data/lib/ory-kratos-client/api/common_api.rb +211 -0
  33. data/lib/ory-kratos-client/api/health_api.rb +134 -0
  34. data/lib/ory-kratos-client/api/public_api.rb +558 -0
  35. data/lib/ory-kratos-client/api/version_api.rb +78 -0
  36. data/lib/ory-kratos-client/api_client.rb +385 -0
  37. data/lib/ory-kratos-client/api_error.rb +57 -0
  38. data/lib/ory-kratos-client/configuration.rb +241 -0
  39. data/lib/ory-kratos-client/models/complete_self_service_browser_profile_management_flow_payload.rb +212 -0
  40. data/lib/ory-kratos-client/models/error.rb +207 -0
  41. data/lib/ory-kratos-client/models/form.rb +242 -0
  42. data/lib/ory-kratos-client/models/form_field.rb +250 -0
  43. data/lib/ory-kratos-client/models/generic_error.rb +207 -0
  44. data/lib/ory-kratos-client/models/generic_error_payload.rb +265 -0
  45. data/lib/ory-kratos-client/models/health_not_ready_status.rb +209 -0
  46. data/lib/ory-kratos-client/models/health_status.rb +207 -0
  47. data/lib/ory-kratos-client/models/identity.rb +245 -0
  48. data/lib/ory-kratos-client/models/login_request.rb +258 -0
  49. data/lib/ory-kratos-client/models/login_request_method.rb +216 -0
  50. data/lib/ory-kratos-client/models/login_request_method_config.rb +197 -0
  51. data/lib/ory-kratos-client/models/oidc_strategy_credentials_config.rb +215 -0
  52. data/lib/ory-kratos-client/models/oidc_strategy_request_method.rb +252 -0
  53. data/lib/ory-kratos-client/models/profile_management_request.rb +265 -0
  54. data/lib/ory-kratos-client/models/registration_request.rb +258 -0
  55. data/lib/ory-kratos-client/models/registration_request_method.rb +216 -0
  56. data/lib/ory-kratos-client/models/registration_request_method_config.rb +197 -0
  57. data/lib/ory-kratos-client/models/session.rb +242 -0
  58. data/lib/ory-kratos-client/models/version.rb +207 -0
  59. data/lib/ory-kratos-client/version.rb +15 -0
  60. data/ory-kratos-client.gemspec +39 -0
  61. data/spec/api/admin_api_spec.rb +131 -0
  62. data/spec/api/common_api_spec.rb +71 -0
  63. data/spec/api/health_api_spec.rb +57 -0
  64. data/spec/api/public_api_spec.rb +113 -0
  65. data/spec/api/version_api_spec.rb +46 -0
  66. data/spec/api_client_spec.rb +226 -0
  67. data/spec/configuration_spec.rb +42 -0
  68. data/spec/models/complete_self_service_browser_profile_management_flow_payload_spec.rb +41 -0
  69. data/spec/models/error_spec.rb +41 -0
  70. data/spec/models/form_field_spec.rb +65 -0
  71. data/spec/models/form_spec.rb +59 -0
  72. data/spec/models/generic_error_payload_spec.rb +77 -0
  73. data/spec/models/generic_error_spec.rb +59 -0
  74. data/spec/models/health_not_ready_status_spec.rb +41 -0
  75. data/spec/models/health_status_spec.rb +41 -0
  76. data/spec/models/identity_spec.rb +53 -0
  77. data/spec/models/login_request_method_config_spec.rb +35 -0
  78. data/spec/models/login_request_method_spec.rb +47 -0
  79. data/spec/models/login_request_spec.rb +71 -0
  80. data/spec/models/oidc_strategy_credentials_config_spec.rb +47 -0
  81. data/spec/models/oidc_strategy_request_method_spec.rb +65 -0
  82. data/spec/models/profile_management_request_spec.rb +77 -0
  83. data/spec/models/registration_request_method_config_spec.rb +35 -0
  84. data/spec/models/registration_request_method_spec.rb +47 -0
  85. data/spec/models/registration_request_spec.rb +71 -0
  86. data/spec/models/session_spec.rb +65 -0
  87. data/spec/models/version_spec.rb +41 -0
  88. data/spec/spec_helper.rb +111 -0
  89. metadata +219 -0
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: latest
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ # This request is used when an identity wants to update profile information (especially traits) in a selfservice manner. For more information head over to: https://www.ory.sh/docs/kratos/selfservice/profile
17
+ class ProfileManagementRequest
18
+ # ExpiresAt is the time (UTC) when the request expires. If the user still wishes to update the profile, a new request has to be initiated.
19
+ attr_accessor :expires_at
20
+
21
+ attr_accessor :form
22
+
23
+ attr_accessor :id
24
+
25
+ attr_accessor :identity
26
+
27
+ # IssuedAt is the time (UTC) when the request occurred.
28
+ attr_accessor :issued_at
29
+
30
+ # 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.
31
+ attr_accessor :request_url
32
+
33
+ # UpdateSuccessful, if true, indicates that the profile has been updated successfully with the provided data. Done will stay true when repeatedly checking. If set to true, done will revert back to false only when a request with invalid (e.g. \"please use a valid phone number\") data was sent.
34
+ attr_accessor :update_successful
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'expires_at' => :'expires_at',
40
+ :'form' => :'form',
41
+ :'id' => :'id',
42
+ :'identity' => :'identity',
43
+ :'issued_at' => :'issued_at',
44
+ :'request_url' => :'request_url',
45
+ :'update_successful' => :'update_successful'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'expires_at' => :'DateTime',
53
+ :'form' => :'Form',
54
+ :'id' => :'String',
55
+ :'identity' => :'Identity',
56
+ :'issued_at' => :'DateTime',
57
+ :'request_url' => :'String',
58
+ :'update_successful' => :'Boolean'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::ProfileManagementRequest` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::ProfileManagementRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'expires_at')
84
+ self.expires_at = attributes[:'expires_at']
85
+ end
86
+
87
+ if attributes.key?(:'form')
88
+ self.form = attributes[:'form']
89
+ end
90
+
91
+ if attributes.key?(:'id')
92
+ self.id = attributes[:'id']
93
+ end
94
+
95
+ if attributes.key?(:'identity')
96
+ self.identity = attributes[:'identity']
97
+ end
98
+
99
+ if attributes.key?(:'issued_at')
100
+ self.issued_at = attributes[:'issued_at']
101
+ end
102
+
103
+ if attributes.key?(:'request_url')
104
+ self.request_url = attributes[:'request_url']
105
+ end
106
+
107
+ if attributes.key?(:'update_successful')
108
+ self.update_successful = attributes[:'update_successful']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ expires_at == o.expires_at &&
131
+ form == o.form &&
132
+ id == o.id &&
133
+ identity == o.identity &&
134
+ issued_at == o.issued_at &&
135
+ request_url == o.request_url &&
136
+ update_successful == o.update_successful
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [expires_at, form, id, identity, issued_at, request_url, update_successful].hash
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 self.build_from_hash(attributes)
155
+ new.build_from_hash(attributes)
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.openapi_types.each_pair do |key, type|
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
168
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
173
+ end
174
+
175
+ self
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def _deserialize(type, value)
183
+ case type.to_sym
184
+ when :DateTime
185
+ DateTime.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :Boolean
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ OryHydraClient.const_get(type).build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+ end
265
+ end
@@ -0,0 +1,258 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: latest
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ class RegistrationRequest
17
+ # and so on.
18
+ attr_accessor :active
19
+
20
+ # ExpiresAt is the time (UTC) when the request expires. If the user still wishes to log in, a new request has to be initiated.
21
+ attr_accessor :expires_at
22
+
23
+ attr_accessor :id
24
+
25
+ # IssuedAt is the time (UTC) when the request occurred.
26
+ attr_accessor :issued_at
27
+
28
+ # Methods contains context for all enabled registration methods. If a registration request has been processed, but for example the password is incorrect, this will contain error messages.
29
+ attr_accessor :methods
30
+
31
+ # 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.
32
+ attr_accessor :request_url
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'active' => :'active',
38
+ :'expires_at' => :'expires_at',
39
+ :'id' => :'id',
40
+ :'issued_at' => :'issued_at',
41
+ :'methods' => :'methods',
42
+ :'request_url' => :'request_url'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'active' => :'String',
50
+ :'expires_at' => :'DateTime',
51
+ :'id' => :'String',
52
+ :'issued_at' => :'DateTime',
53
+ :'methods' => :'Hash<String, RegistrationRequestMethod>',
54
+ :'request_url' => :'String'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::RegistrationRequest` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::RegistrationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'active')
80
+ self.active = attributes[:'active']
81
+ end
82
+
83
+ if attributes.key?(:'expires_at')
84
+ self.expires_at = attributes[:'expires_at']
85
+ end
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.key?(:'issued_at')
92
+ self.issued_at = attributes[:'issued_at']
93
+ end
94
+
95
+ if attributes.key?(:'methods')
96
+ if (value = attributes[:'methods']).is_a?(Hash)
97
+ self.methods = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'request_url')
102
+ self.request_url = attributes[:'request_url']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
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
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ active == o.active &&
125
+ expires_at == o.expires_at &&
126
+ id == o.id &&
127
+ issued_at == o.issued_at &&
128
+ methods == o.methods &&
129
+ request_url == o.request_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
+ [active, expires_at, id, issued_at, methods, request_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
+ self.class.openapi_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ OryHydraClient.const_get(type).build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+ end
258
+ end