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

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