ory-client 0.0.1.alpha15 → 0.0.1.alpha16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -97
  3. data/docs/AdminCreateIdentityBody.md +20 -0
  4. data/docs/AdminCreateSelfServiceRecoveryLinkBody.md +20 -0
  5. data/docs/AdminUpdateIdentityBody.md +22 -0
  6. data/docs/Identity.md +6 -0
  7. data/docs/IdentityState.md +15 -0
  8. data/docs/MetadataApi.md +254 -0
  9. data/docs/SelfServiceError.md +24 -0
  10. data/docs/SelfServiceLoginFlow.md +36 -0
  11. data/docs/SelfServiceLogoutUrl.md +18 -0
  12. data/docs/SelfServiceRecoveryFlow.md +32 -0
  13. data/docs/SelfServiceRecoveryFlowState.md +15 -0
  14. data/docs/SelfServiceRecoveryLink.md +20 -0
  15. data/docs/SelfServiceRegistrationFlow.md +30 -0
  16. data/docs/SelfServiceSettingsFlow.md +34 -0
  17. data/docs/SelfServiceSettingsFlowState.md +15 -0
  18. data/docs/SelfServiceVerificationFlow.md +32 -0
  19. data/docs/SelfServiceVerificationFlowState.md +15 -0
  20. data/docs/Session.md +4 -4
  21. data/docs/SubmitSelfServiceLoginFlowBody.md +76 -0
  22. data/docs/SubmitSelfServiceLoginFlowWithOidcMethodBody.md +22 -0
  23. data/docs/SubmitSelfServiceLoginFlowWithPasswordMethodBody.md +24 -0
  24. data/docs/SubmitSelfServiceLogoutFlowWithoutBrowserBody.md +18 -0
  25. data/docs/SubmitSelfServiceRecoveryFlowBody.md +75 -0
  26. data/docs/SubmitSelfServiceRecoveryFlowWithLinkMethodBody.md +22 -0
  27. data/docs/SubmitSelfServiceRegistrationFlowBody.md +76 -0
  28. data/docs/SubmitSelfServiceRegistrationFlowWithOidcMethodBody.md +22 -0
  29. data/docs/SubmitSelfServiceRegistrationFlowWithPasswordMethodBody.md +24 -0
  30. data/docs/SubmitSelfServiceSettingsFlowBody.md +79 -0
  31. data/docs/SubmitSelfServiceSettingsFlowWithOidcMethodBody.md +24 -0
  32. data/docs/SubmitSelfServiceSettingsFlowWithPasswordMethodBody.md +22 -0
  33. data/docs/SubmitSelfServiceSettingsFlowWithProfileMethodBody.md +22 -0
  34. data/docs/SubmitSelfServiceVerificationFlowBody.md +75 -0
  35. data/docs/SubmitSelfServiceVerificationFlowWithLinkMethodBody.md +22 -0
  36. data/docs/SuccessfulSelfServiceLoginWithoutBrowser.md +20 -0
  37. data/docs/SuccessfulSelfServiceRegistrationWithoutBrowser.md +22 -0
  38. data/docs/SuccessfulSelfServiceSettingsWithoutBrowser.md +20 -0
  39. data/docs/V0alpha1Api.md +2172 -0
  40. data/lib/ory-client.rb +36 -26
  41. data/lib/ory-client/api/metadata_api.rb +248 -0
  42. data/lib/ory-client/api/v0alpha1_api.rb +2054 -0
  43. data/lib/ory-client/api_client.rb +1 -1
  44. data/lib/ory-client/api_error.rb +1 -1
  45. data/lib/ory-client/configuration.rb +2 -16
  46. data/lib/ory-client/models/admin_create_identity_body.rb +239 -0
  47. data/lib/ory-client/models/admin_create_self_service_recovery_link_body.rb +250 -0
  48. data/lib/ory-client/models/admin_update_identity_body.rb +248 -0
  49. data/lib/ory-client/models/authenticate_ok_body.rb +1 -1
  50. data/lib/ory-client/models/container_change_response_item.rb +1 -1
  51. data/lib/ory-client/models/container_create_created_body.rb +1 -1
  52. data/lib/ory-client/models/container_top_ok_body.rb +1 -1
  53. data/lib/ory-client/models/container_update_ok_body.rb +1 -1
  54. data/lib/ory-client/models/container_wait_ok_body.rb +1 -1
  55. data/lib/ory-client/models/container_wait_ok_body_error.rb +1 -1
  56. data/lib/ory-client/models/error_response.rb +1 -1
  57. data/lib/ory-client/models/generic_error.rb +1 -1
  58. data/lib/ory-client/models/graph_driver_data.rb +1 -1
  59. data/lib/ory-client/models/health_not_ready_status.rb +1 -1
  60. data/lib/ory-client/models/health_status.rb +1 -1
  61. data/lib/ory-client/models/id_response.rb +1 -1
  62. data/lib/ory-client/models/identity.rb +32 -2
  63. data/lib/ory-client/models/identity_credentials.rb +1 -1
  64. data/lib/ory-client/models/identity_state.rb +37 -0
  65. data/lib/ory-client/models/image_delete_response_item.rb +1 -1
  66. data/lib/ory-client/models/image_summary.rb +1 -1
  67. data/lib/ory-client/models/inline_response200.rb +1 -1
  68. data/lib/ory-client/models/inline_response2001.rb +1 -1
  69. data/lib/ory-client/models/inline_response503.rb +1 -1
  70. data/lib/ory-client/models/json_error.rb +1 -1
  71. data/lib/ory-client/models/meta.rb +1 -1
  72. data/lib/ory-client/models/plugin.rb +1 -1
  73. data/lib/ory-client/models/plugin_config.rb +1 -1
  74. data/lib/ory-client/models/plugin_config_args.rb +1 -1
  75. data/lib/ory-client/models/plugin_config_interface.rb +1 -1
  76. data/lib/ory-client/models/plugin_config_linux.rb +1 -1
  77. data/lib/ory-client/models/plugin_config_network.rb +1 -1
  78. data/lib/ory-client/models/plugin_config_rootfs.rb +1 -1
  79. data/lib/ory-client/models/plugin_config_user.rb +1 -1
  80. data/lib/ory-client/models/plugin_device.rb +1 -1
  81. data/lib/ory-client/models/plugin_env.rb +1 -1
  82. data/lib/ory-client/models/plugin_interface_type.rb +1 -1
  83. data/lib/ory-client/models/plugin_mount.rb +1 -1
  84. data/lib/ory-client/models/plugin_settings.rb +1 -1
  85. data/lib/ory-client/models/port.rb +1 -1
  86. data/lib/ory-client/models/recovery_address.rb +1 -1
  87. data/lib/ory-client/models/self_service_error.rb +252 -0
  88. data/lib/ory-client/models/self_service_login_flow.rb +338 -0
  89. data/lib/ory-client/models/self_service_logout_url.rb +219 -0
  90. data/lib/ory-client/models/self_service_recovery_flow.rb +317 -0
  91. data/lib/ory-client/models/self_service_recovery_flow_state.rb +38 -0
  92. data/lib/ory-client/models/self_service_recovery_link.rb +234 -0
  93. data/lib/ory-client/models/self_service_registration_flow.rb +302 -0
  94. data/lib/ory-client/models/self_service_settings_flow.rb +331 -0
  95. data/lib/ory-client/models/self_service_settings_flow_state.rb +37 -0
  96. data/lib/ory-client/models/self_service_verification_flow.rb +307 -0
  97. data/lib/ory-client/models/self_service_verification_flow_state.rb +38 -0
  98. data/lib/ory-client/models/service_update_response.rb +1 -1
  99. data/lib/ory-client/models/session.rb +6 -16
  100. data/lib/ory-client/models/settings_profile_form_config.rb +1 -1
  101. data/lib/ory-client/models/submit_self_service_login_flow_body.rb +54 -0
  102. data/lib/ory-client/models/submit_self_service_login_flow_with_oidc_method_body.rb +250 -0
  103. data/lib/ory-client/models/submit_self_service_login_flow_with_password_method_body.rb +298 -0
  104. data/lib/ory-client/models/submit_self_service_logout_flow_without_browser_body.rb +225 -0
  105. data/lib/ory-client/models/submit_self_service_recovery_flow_body.rb +53 -0
  106. data/lib/ory-client/models/submit_self_service_recovery_flow_with_link_method_body.rb +283 -0
  107. data/lib/ory-client/models/submit_self_service_registration_flow_body.rb +54 -0
  108. data/lib/ory-client/models/submit_self_service_registration_flow_with_oidc_method_body.rb +250 -0
  109. data/lib/ory-client/models/submit_self_service_registration_flow_with_password_method_body.rb +299 -0
  110. data/lib/ory-client/models/submit_self_service_settings_flow_body.rb +56 -0
  111. data/lib/ory-client/models/submit_self_service_settings_flow_with_oidc_method_body.rb +255 -0
  112. data/lib/ory-client/models/submit_self_service_settings_flow_with_password_method_body.rb +283 -0
  113. data/lib/ory-client/models/submit_self_service_settings_flow_with_profile_method_body.rb +250 -0
  114. data/lib/ory-client/models/submit_self_service_verification_flow_body.rb +54 -0
  115. data/lib/ory-client/models/submit_self_service_verification_flow_with_link_method_body.rb +283 -0
  116. data/lib/ory-client/models/successful_self_service_login_without_browser.rb +234 -0
  117. data/lib/ory-client/models/successful_self_service_registration_without_browser.rb +243 -0
  118. data/lib/ory-client/models/successful_self_service_settings_without_browser.rb +238 -0
  119. data/lib/ory-client/models/ui_container.rb +1 -1
  120. data/lib/ory-client/models/ui_node.rb +1 -1
  121. data/lib/ory-client/models/ui_node_anchor_attributes.rb +1 -1
  122. data/lib/ory-client/models/ui_node_attributes.rb +1 -1
  123. data/lib/ory-client/models/ui_node_image_attributes.rb +1 -1
  124. data/lib/ory-client/models/ui_node_input_attributes.rb +1 -1
  125. data/lib/ory-client/models/ui_node_text_attributes.rb +1 -1
  126. data/lib/ory-client/models/ui_text.rb +1 -1
  127. data/lib/ory-client/models/verifiable_identity_address.rb +1 -1
  128. data/lib/ory-client/models/version.rb +1 -1
  129. data/lib/ory-client/models/volume.rb +1 -1
  130. data/lib/ory-client/models/volume_usage_data.rb +1 -1
  131. data/lib/ory-client/version.rb +2 -2
  132. data/ory-client.gemspec +1 -1
  133. data/spec/api/metadata_api_spec.rb +79 -0
  134. data/spec/api/v0alpha1_api_spec.rb +429 -0
  135. data/spec/api_client_spec.rb +1 -1
  136. data/spec/configuration_spec.rb +1 -1
  137. data/spec/models/admin_create_identity_body_spec.rb +40 -0
  138. data/spec/models/admin_create_self_service_recovery_link_body_spec.rb +40 -0
  139. data/spec/models/admin_update_identity_body_spec.rb +46 -0
  140. data/spec/models/identity_state_spec.rb +28 -0
  141. data/spec/models/self_service_error_spec.rb +52 -0
  142. data/spec/models/self_service_login_flow_spec.rb +88 -0
  143. data/spec/models/self_service_logout_url_spec.rb +34 -0
  144. data/spec/models/self_service_recovery_flow_spec.rb +76 -0
  145. data/spec/models/self_service_recovery_flow_state_spec.rb +28 -0
  146. data/spec/models/self_service_recovery_link_spec.rb +40 -0
  147. data/spec/models/self_service_registration_flow_spec.rb +70 -0
  148. data/spec/models/self_service_settings_flow_spec.rb +82 -0
  149. data/spec/models/self_service_settings_flow_state_spec.rb +28 -0
  150. data/spec/models/self_service_verification_flow_spec.rb +76 -0
  151. data/spec/models/self_service_verification_flow_state_spec.rb +28 -0
  152. data/spec/models/submit_self_service_login_flow_body_spec.rb +43 -0
  153. data/spec/models/submit_self_service_login_flow_with_oidc_method_body_spec.rb +46 -0
  154. data/spec/models/submit_self_service_login_flow_with_password_method_body_spec.rb +56 -0
  155. data/spec/models/submit_self_service_logout_flow_without_browser_body_spec.rb +34 -0
  156. data/spec/models/submit_self_service_recovery_flow_body_spec.rb +43 -0
  157. data/spec/models/submit_self_service_recovery_flow_with_link_method_body_spec.rb +50 -0
  158. data/spec/models/submit_self_service_registration_flow_body_spec.rb +43 -0
  159. data/spec/models/submit_self_service_registration_flow_with_oidc_method_body_spec.rb +46 -0
  160. data/spec/models/submit_self_service_registration_flow_with_password_method_body_spec.rb +56 -0
  161. data/spec/models/submit_self_service_settings_flow_body_spec.rb +43 -0
  162. data/spec/models/submit_self_service_settings_flow_with_oidc_method_body_spec.rb +52 -0
  163. data/spec/models/submit_self_service_settings_flow_with_password_method_body_spec.rb +50 -0
  164. data/spec/models/submit_self_service_settings_flow_with_profile_method_body_spec.rb +46 -0
  165. data/spec/models/submit_self_service_verification_flow_body_spec.rb +43 -0
  166. data/spec/models/submit_self_service_verification_flow_with_link_method_body_spec.rb +50 -0
  167. data/spec/models/successful_self_service_login_without_browser_spec.rb +40 -0
  168. data/spec/models/successful_self_service_registration_without_browser_spec.rb +46 -0
  169. data/spec/models/successful_self_service_settings_without_browser_spec.rb +40 -0
  170. data/spec/spec_helper.rb +1 -1
  171. metadata +142 -2
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #Ory APIs
3
+
4
+ #Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
5
+
6
+ The version of the OpenAPI document: v0.0.1-alpha.16
7
+ Contact: support@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OryHydraClient
17
+ class SelfServiceRegistrationFlow
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
+ attr_accessor :id
25
+
26
+ # IssuedAt is the time (UTC) when the flow occurred.
27
+ attr_accessor :issued_at
28
+
29
+ # 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.
30
+ attr_accessor :request_url
31
+
32
+ # The flow type can either be `api` or `browser`.
33
+ attr_accessor :type
34
+
35
+ attr_accessor :ui
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'active' => :'active',
41
+ :'expires_at' => :'expires_at',
42
+ :'id' => :'id',
43
+ :'issued_at' => :'issued_at',
44
+ :'request_url' => :'request_url',
45
+ :'type' => :'type',
46
+ :'ui' => :'ui'
47
+ }
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'active' => :'String',
59
+ :'expires_at' => :'Time',
60
+ :'id' => :'String',
61
+ :'issued_at' => :'Time',
62
+ :'request_url' => :'String',
63
+ :'type' => :'String',
64
+ :'ui' => :'UiContainer'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::SelfServiceRegistrationFlow` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::SelfServiceRegistrationFlow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'active')
90
+ self.active = attributes[:'active']
91
+ end
92
+
93
+ if attributes.key?(:'expires_at')
94
+ self.expires_at = attributes[:'expires_at']
95
+ end
96
+
97
+ if attributes.key?(:'id')
98
+ self.id = attributes[:'id']
99
+ end
100
+
101
+ if attributes.key?(:'issued_at')
102
+ self.issued_at = attributes[:'issued_at']
103
+ end
104
+
105
+ if attributes.key?(:'request_url')
106
+ self.request_url = attributes[:'request_url']
107
+ end
108
+
109
+ if attributes.key?(:'type')
110
+ self.type = attributes[:'type']
111
+ end
112
+
113
+ if attributes.key?(:'ui')
114
+ self.ui = attributes[:'ui']
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ if @expires_at.nil?
123
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
124
+ end
125
+
126
+ if @id.nil?
127
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
128
+ end
129
+
130
+ if @issued_at.nil?
131
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
132
+ end
133
+
134
+ if @request_url.nil?
135
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
136
+ end
137
+
138
+ if @ui.nil?
139
+ invalid_properties.push('invalid value for "ui", ui cannot be nil.')
140
+ end
141
+
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ return false if @expires_at.nil?
149
+ return false if @id.nil?
150
+ return false if @issued_at.nil?
151
+ return false if @request_url.nil?
152
+ return false if @ui.nil?
153
+ true
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ active == o.active &&
162
+ expires_at == o.expires_at &&
163
+ id == o.id &&
164
+ issued_at == o.issued_at &&
165
+ request_url == o.request_url &&
166
+ type == o.type &&
167
+ ui == o.ui
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [active, expires_at, id, issued_at, request_url, type, ui].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ new.build_from_hash(attributes)
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ self.class.openapi_types.each_pair do |key, type|
195
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
196
+ self.send("#{key}=", nil)
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = OryHydraClient.const_get(type)
250
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,331 @@
1
+ =begin
2
+ #Ory APIs
3
+
4
+ #Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
5
+
6
+ The version of the OpenAPI document: v0.0.1-alpha.16
7
+ Contact: support@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OryHydraClient
17
+ # This flow is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner. We recommend reading the [User Settings Documentation](../self-service/flows/user-settings)
18
+ class SelfServiceSettingsFlow
19
+ # Active, if set, contains the registration method that is being used. It is initially not set.
20
+ attr_accessor :active
21
+
22
+ # ExpiresAt is the time (UTC) when the flow expires. If the user still wishes to update the setting, a new flow has to be initiated.
23
+ attr_accessor :expires_at
24
+
25
+ attr_accessor :id
26
+
27
+ attr_accessor :identity
28
+
29
+ # IssuedAt is the time (UTC) when the flow occurred.
30
+ attr_accessor :issued_at
31
+
32
+ # 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.
33
+ attr_accessor :request_url
34
+
35
+ attr_accessor :state
36
+
37
+ # The flow type can either be `api` or `browser`.
38
+ attr_accessor :type
39
+
40
+ attr_accessor :ui
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'active' => :'active',
46
+ :'expires_at' => :'expires_at',
47
+ :'id' => :'id',
48
+ :'identity' => :'identity',
49
+ :'issued_at' => :'issued_at',
50
+ :'request_url' => :'request_url',
51
+ :'state' => :'state',
52
+ :'type' => :'type',
53
+ :'ui' => :'ui'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'active' => :'String',
66
+ :'expires_at' => :'Time',
67
+ :'id' => :'String',
68
+ :'identity' => :'Identity',
69
+ :'issued_at' => :'Time',
70
+ :'request_url' => :'String',
71
+ :'state' => :'SelfServiceSettingsFlowState',
72
+ :'type' => :'String',
73
+ :'ui' => :'UiContainer'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::SelfServiceSettingsFlow` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::SelfServiceSettingsFlow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'active')
99
+ self.active = attributes[:'active']
100
+ end
101
+
102
+ if attributes.key?(:'expires_at')
103
+ self.expires_at = attributes[:'expires_at']
104
+ end
105
+
106
+ if attributes.key?(:'id')
107
+ self.id = attributes[:'id']
108
+ end
109
+
110
+ if attributes.key?(:'identity')
111
+ self.identity = attributes[:'identity']
112
+ end
113
+
114
+ if attributes.key?(:'issued_at')
115
+ self.issued_at = attributes[:'issued_at']
116
+ end
117
+
118
+ if attributes.key?(:'request_url')
119
+ self.request_url = attributes[:'request_url']
120
+ end
121
+
122
+ if attributes.key?(:'state')
123
+ self.state = attributes[:'state']
124
+ end
125
+
126
+ if attributes.key?(:'type')
127
+ self.type = attributes[:'type']
128
+ end
129
+
130
+ if attributes.key?(:'ui')
131
+ self.ui = attributes[:'ui']
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 @identity.nil?
148
+ invalid_properties.push('invalid value for "identity", identity cannot be nil.')
149
+ end
150
+
151
+ if @issued_at.nil?
152
+ invalid_properties.push('invalid value for "issued_at", issued_at 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
+ if @state.nil?
160
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
161
+ end
162
+
163
+ if @ui.nil?
164
+ invalid_properties.push('invalid value for "ui", ui cannot be nil.')
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ return false if @expires_at.nil?
174
+ return false if @id.nil?
175
+ return false if @identity.nil?
176
+ return false if @issued_at.nil?
177
+ return false if @request_url.nil?
178
+ return false if @state.nil?
179
+ return false if @ui.nil?
180
+ true
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(o)
186
+ return true if self.equal?(o)
187
+ self.class == o.class &&
188
+ active == o.active &&
189
+ expires_at == o.expires_at &&
190
+ id == o.id &&
191
+ identity == o.identity &&
192
+ issued_at == o.issued_at &&
193
+ request_url == o.request_url &&
194
+ state == o.state &&
195
+ type == o.type &&
196
+ ui == o.ui
197
+ end
198
+
199
+ # @see the `==` method
200
+ # @param [Object] Object to be compared
201
+ def eql?(o)
202
+ self == o
203
+ end
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Integer] Hash code
207
+ def hash
208
+ [active, expires_at, id, identity, issued_at, request_url, state, type, ui].hash
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def self.build_from_hash(attributes)
215
+ new.build_from_hash(attributes)
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ self.class.openapi_types.each_pair do |key, type|
224
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
225
+ self.send("#{key}=", nil)
226
+ elsif type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
230
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
231
+ end
232
+ elsif !attributes[self.class.attribute_map[key]].nil?
233
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
+ end
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ # Deserializes the data based on type
241
+ # @param string type Data type
242
+ # @param string value Value to be deserialized
243
+ # @return [Object] Deserialized data
244
+ def _deserialize(type, value)
245
+ case type.to_sym
246
+ when :Time
247
+ Time.parse(value)
248
+ when :Date
249
+ Date.parse(value)
250
+ when :String
251
+ value.to_s
252
+ when :Integer
253
+ value.to_i
254
+ when :Float
255
+ value.to_f
256
+ when :Boolean
257
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
+ true
259
+ else
260
+ false
261
+ end
262
+ when :Object
263
+ # generic object (usually a Hash), return directly
264
+ value
265
+ when /\AArray<(?<inner_type>.+)>\z/
266
+ inner_type = Regexp.last_match[:inner_type]
267
+ value.map { |v| _deserialize(inner_type, v) }
268
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
269
+ k_type = Regexp.last_match[:k_type]
270
+ v_type = Regexp.last_match[:v_type]
271
+ {}.tap do |hash|
272
+ value.each do |k, v|
273
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
274
+ end
275
+ end
276
+ else # model
277
+ # models (e.g. Pet) or oneOf
278
+ klass = OryHydraClient.const_get(type)
279
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
280
+ end
281
+ end
282
+
283
+ # Returns the string representation of the object
284
+ # @return [String] String presentation of the object
285
+ def to_s
286
+ to_hash.to_s
287
+ end
288
+
289
+ # to_body is an alias to to_hash (backward compatibility)
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_body
292
+ to_hash
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ self.class.attribute_map.each_pair do |attr, param|
300
+ value = self.send(attr)
301
+ if value.nil?
302
+ is_nullable = self.class.openapi_nullable.include?(attr)
303
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
304
+ end
305
+
306
+ hash[param] = _to_hash(value)
307
+ end
308
+ hash
309
+ end
310
+
311
+ # Outputs non-array value in the form of hash
312
+ # For object, use to_hash. Otherwise, just return the value
313
+ # @param [Object] value Any valid value
314
+ # @return [Hash] Returns the value in the form of hash
315
+ def _to_hash(value)
316
+ if value.is_a?(Array)
317
+ value.compact.map { |v| _to_hash(v) }
318
+ elsif value.is_a?(Hash)
319
+ {}.tap do |hash|
320
+ value.each { |k, v| hash[k] = _to_hash(v) }
321
+ end
322
+ elsif value.respond_to? :to_hash
323
+ value.to_hash
324
+ else
325
+ value
326
+ end
327
+ end
328
+
329
+ end
330
+
331
+ end