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,54 @@
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
+ module SubmitSelfServiceRegistrationFlowBody
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'SubmitSelfServiceRegistrationFlowWithPasswordMethodBody'
23
+ ]
24
+ end
25
+
26
+ # Discriminator's property name (OpenAPI v3)
27
+ def openapi_discriminator_name
28
+ :'method'
29
+ end
30
+
31
+ # Discriminator's mapping (OpenAPI v3)
32
+ def openapi_discriminator_mapping
33
+ {
34
+ :'oidc' => :'SubmitSelfServiceRegistrationFlowWithOidcMethodBody',
35
+ :'password' => :'SubmitSelfServiceRegistrationFlowWithPasswordMethodBody'
36
+ }
37
+ end
38
+
39
+ # Builds the object
40
+ # @param [Mixed] Data to be matched against the list of oneOf items
41
+ # @return [Object] Returns the model or the data itself
42
+ def build(data)
43
+ discriminator_value = data[openapi_discriminator_name]
44
+ return nil unless discriminator_value
45
+
46
+ klass = openapi_discriminator_mapping[discriminator_value.to_sym]
47
+ return nil unless klass
48
+
49
+ OryHydraClient.const_get(klass).build_from_hash(data)
50
+ end
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,250 @@
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
+ # SubmitSelfServiceRegistrationFlowWithOidcMethodBody is used to decode the registration form payload when using the oidc method.
18
+ class SubmitSelfServiceRegistrationFlowWithOidcMethodBody
19
+ # The CSRF Token
20
+ attr_accessor :csrf_token
21
+
22
+ # Method to use This field must be set to `oidc` when using the oidc method.
23
+ attr_accessor :method
24
+
25
+ # The provider to register with
26
+ attr_accessor :traits
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'csrf_token' => :'csrf_token',
32
+ :'method' => :'method',
33
+ :'traits' => :'traits'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'csrf_token' => :'String',
46
+ :'method' => :'String',
47
+ :'traits' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::SubmitSelfServiceRegistrationFlowWithOidcMethodBody` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::SubmitSelfServiceRegistrationFlowWithOidcMethodBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'csrf_token')
73
+ self.csrf_token = attributes[:'csrf_token']
74
+ end
75
+
76
+ if attributes.key?(:'method')
77
+ self.method = attributes[:'method']
78
+ end
79
+
80
+ if attributes.key?(:'traits')
81
+ self.traits = attributes[:'traits']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @method.nil?
90
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
91
+ end
92
+
93
+ if @traits.nil?
94
+ invalid_properties.push('invalid value for "traits", traits cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @method.nil?
104
+ return false if @traits.nil?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ csrf_token == o.csrf_token &&
114
+ method == o.method &&
115
+ traits == o.traits
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [csrf_token, method, traits].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ new.build_from_hash(attributes)
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
144
+ self.send("#{key}=", nil)
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = OryHydraClient.const_get(type)
198
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,299 @@
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
+ # SubmitSelfServiceRegistrationFlowWithPasswordMethodBody is used to decode the registration form payload when using the password method.
18
+ class SubmitSelfServiceRegistrationFlowWithPasswordMethodBody
19
+ # The CSRF Token
20
+ attr_accessor :csrf_token
21
+
22
+ # Method to use This field must be set to `password` when using the password method.
23
+ attr_accessor :method
24
+
25
+ # Password to sign the user up with
26
+ attr_accessor :password
27
+
28
+ # The identity's traits
29
+ attr_accessor :traits
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'csrf_token' => :'csrf_token',
57
+ :'method' => :'method',
58
+ :'password' => :'password',
59
+ :'traits' => :'traits'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'csrf_token' => :'String',
72
+ :'method' => :'String',
73
+ :'password' => :'String',
74
+ :'traits' => :'Object'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::SubmitSelfServiceRegistrationFlowWithPasswordMethodBody` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::SubmitSelfServiceRegistrationFlowWithPasswordMethodBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'csrf_token')
100
+ self.csrf_token = attributes[:'csrf_token']
101
+ end
102
+
103
+ if attributes.key?(:'method')
104
+ self.method = attributes[:'method']
105
+ end
106
+
107
+ if attributes.key?(:'password')
108
+ self.password = attributes[:'password']
109
+ end
110
+
111
+ if attributes.key?(:'traits')
112
+ self.traits = attributes[:'traits']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ if @method.nil?
121
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
122
+ end
123
+
124
+ if @password.nil?
125
+ invalid_properties.push('invalid value for "password", password cannot be nil.')
126
+ end
127
+
128
+ if @traits.nil?
129
+ invalid_properties.push('invalid value for "traits", traits cannot be nil.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ return false if @method.nil?
139
+ method_validator = EnumAttributeValidator.new('String', ["password", "oidc"])
140
+ return false unless method_validator.valid?(@method)
141
+ return false if @password.nil?
142
+ return false if @traits.nil?
143
+ true
144
+ end
145
+
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] method Object to be assigned
148
+ def method=(method)
149
+ validator = EnumAttributeValidator.new('String', ["password", "oidc"])
150
+ unless validator.valid?(method)
151
+ fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
152
+ end
153
+ @method = method
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
+ csrf_token == o.csrf_token &&
162
+ method == o.method &&
163
+ password == o.password &&
164
+ traits == o.traits
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [csrf_token, method, password, traits].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ new.build_from_hash(attributes)
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ self.class.openapi_types.each_pair do |key, type|
192
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
193
+ self.send("#{key}=", nil)
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
198
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
199
+ end
200
+ elsif !attributes[self.class.attribute_map[key]].nil?
201
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
202
+ end
203
+ end
204
+
205
+ self
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def _deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = OryHydraClient.const_get(type)
247
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+
299
+ end