ory-kratos-client 0.2.1.alpha1 → 0.5.2.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +84 -52
  4. data/docs/AdminApi.md +244 -86
  5. data/docs/CommonApi.md +54 -6
  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 +4 -4
  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/ProviderCredentialsConfig.md +19 -0
  25. data/docs/PublicApi.md +726 -151
  26. data/docs/RecoveryAddress.md +21 -0
  27. data/docs/RecoveryFlow.md +33 -0
  28. data/docs/RecoveryFlowMethod.md +19 -0
  29. data/docs/RecoveryFlowMethodConfig.md +23 -0
  30. data/docs/RecoveryLink.md +19 -0
  31. data/docs/RecoveryRequest.md +31 -0
  32. data/docs/RecoveryRequestMethod.md +19 -0
  33. data/docs/RegistrationFlow.md +31 -0
  34. data/docs/RegistrationFlowMethod.md +19 -0
  35. data/docs/RegistrationFlowMethodConfig.md +25 -0
  36. data/docs/RegistrationRequest.md +3 -1
  37. data/docs/RegistrationRequestMethodConfig.md +2 -2
  38. data/docs/RegistrationViaApiResponse.md +21 -0
  39. data/docs/RequestMethodConfig.md +2 -2
  40. data/docs/RevokeSession.md +17 -0
  41. data/docs/Session.md +6 -4
  42. data/docs/SettingsFlow.md +35 -0
  43. data/docs/SettingsFlowMethod.md +19 -0
  44. data/docs/SettingsFlowMethodConfig.md +23 -0
  45. data/docs/SettingsRequest.md +4 -2
  46. data/docs/SettingsViaApiResponse.md +19 -0
  47. data/docs/UpdateIdentity.md +19 -0
  48. data/docs/VerifiableAddress.md +3 -3
  49. data/docs/VerificationFlow.md +33 -0
  50. data/docs/VerificationFlowMethod.md +19 -0
  51. data/docs/VerificationFlowMethodConfig.md +23 -0
  52. data/docs/VerificationRequest.md +2 -0
  53. data/lib/ory-kratos-client.rb +31 -16
  54. data/lib/ory-kratos-client/api/admin_api.rb +321 -130
  55. data/lib/ory-kratos-client/api/common_api.rb +75 -12
  56. data/lib/ory-kratos-client/api/health_api.rb +2 -2
  57. data/lib/ory-kratos-client/api/public_api.rb +896 -246
  58. data/lib/ory-kratos-client/api/version_api.rb +2 -2
  59. data/lib/ory-kratos-client/api_client.rb +10 -7
  60. data/lib/ory-kratos-client/api_error.rb +2 -2
  61. data/lib/ory-kratos-client/configuration.rb +9 -2
  62. data/lib/ory-kratos-client/models/complete_self_service_browser_settings_strategy_profile_flow_payload.rb +2 -2
  63. data/lib/ory-kratos-client/models/complete_self_service_login_flow_with_password_method.rb +227 -0
  64. data/lib/ory-kratos-client/models/complete_self_service_recovery_flow_with_link_method.rb +217 -0
  65. data/lib/ory-kratos-client/models/complete_self_service_settings_flow_with_password_method.rb +222 -0
  66. data/lib/ory-kratos-client/models/complete_self_service_verification_flow_with_link_method.rb +217 -0
  67. data/lib/ory-kratos-client/models/create_identity.rb +227 -0
  68. data/lib/ory-kratos-client/models/create_recovery_link.rb +238 -0
  69. data/lib/ory-kratos-client/models/error_container.rb +13 -2
  70. data/lib/ory-kratos-client/models/form.rb +14 -15
  71. data/lib/ory-kratos-client/models/form_field.rb +11 -17
  72. data/lib/ory-kratos-client/models/generic_error.rb +2 -2
  73. data/lib/ory-kratos-client/models/generic_error_payload.rb +4 -6
  74. data/lib/ory-kratos-client/models/health_not_ready_status.rb +2 -2
  75. data/lib/ory-kratos-client/models/health_status.rb +2 -2
  76. data/lib/ory-kratos-client/models/identity.rb +53 -35
  77. data/lib/ory-kratos-client/models/login_flow.rb +315 -0
  78. data/lib/ory-kratos-client/models/login_flow_method.rb +226 -0
  79. data/lib/ory-kratos-client/models/login_flow_method_config.rb +267 -0
  80. data/lib/ory-kratos-client/models/login_request.rb +14 -3
  81. data/lib/ory-kratos-client/models/login_request_method.rb +2 -2
  82. data/lib/ory-kratos-client/models/login_request_method_config.rb +14 -15
  83. data/lib/ory-kratos-client/models/login_via_api_response.rb +227 -0
  84. data/lib/ory-kratos-client/models/message.rb +234 -0
  85. data/lib/ory-kratos-client/models/provider_credentials_config.rb +215 -0
  86. data/lib/ory-kratos-client/models/recovery_address.rb +239 -0
  87. data/lib/ory-kratos-client/models/recovery_flow.rb +319 -0
  88. data/lib/ory-kratos-client/models/recovery_flow_method.rb +226 -0
  89. data/lib/ory-kratos-client/models/recovery_flow_method_config.rb +255 -0
  90. data/lib/ory-kratos-client/models/recovery_link.rb +222 -0
  91. data/lib/ory-kratos-client/models/recovery_request.rb +309 -0
  92. data/lib/ory-kratos-client/models/recovery_request_method.rb +216 -0
  93. data/lib/ory-kratos-client/models/registration_flow.rb +304 -0
  94. data/lib/ory-kratos-client/models/registration_flow_method.rb +226 -0
  95. data/lib/ory-kratos-client/models/registration_flow_method_config.rb +267 -0
  96. data/lib/ory-kratos-client/models/registration_request.rb +14 -8
  97. data/lib/ory-kratos-client/models/registration_request_method.rb +2 -2
  98. data/lib/ory-kratos-client/models/registration_request_method_config.rb +14 -15
  99. data/lib/ory-kratos-client/models/registration_via_api_response.rb +236 -0
  100. data/lib/ory-kratos-client/models/request_method_config.rb +14 -15
  101. data/lib/ory-kratos-client/models/revoke_session.rb +212 -0
  102. data/lib/ory-kratos-client/models/session.rb +29 -20
  103. data/lib/ory-kratos-client/models/settings_flow.rb +333 -0
  104. data/lib/ory-kratos-client/models/settings_flow_method.rb +226 -0
  105. data/lib/ory-kratos-client/models/settings_flow_method_config.rb +255 -0
  106. data/lib/ory-kratos-client/models/settings_request.rb +24 -14
  107. data/lib/ory-kratos-client/models/settings_request_method.rb +2 -2
  108. data/lib/ory-kratos-client/models/settings_via_api_response.rb +226 -0
  109. data/lib/ory-kratos-client/models/update_identity.rb +222 -0
  110. data/lib/ory-kratos-client/models/verifiable_address.rb +17 -17
  111. data/lib/ory-kratos-client/models/verification_flow.rb +299 -0
  112. data/lib/ory-kratos-client/models/verification_flow_method.rb +226 -0
  113. data/lib/ory-kratos-client/models/verification_flow_method_config.rb +255 -0
  114. data/lib/ory-kratos-client/models/verification_request.rb +14 -3
  115. data/lib/ory-kratos-client/models/version.rb +2 -2
  116. data/lib/ory-kratos-client/version.rb +3 -3
  117. data/ory-kratos-client.gemspec +2 -2
  118. data/spec/models/complete_self_service_login_flow_with_password_method_spec.rb +53 -0
  119. data/spec/models/complete_self_service_recovery_flow_with_link_method_spec.rb +47 -0
  120. data/spec/models/complete_self_service_settings_flow_with_password_method_spec.rb +47 -0
  121. data/spec/models/complete_self_service_verification_flow_with_link_method_spec.rb +47 -0
  122. data/spec/models/create_identity_spec.rb +47 -0
  123. data/spec/models/create_recovery_link_spec.rb +47 -0
  124. data/spec/models/login_flow_method_config_spec.rb +65 -0
  125. data/spec/models/login_flow_method_spec.rb +47 -0
  126. data/spec/models/login_flow_spec.rb +89 -0
  127. data/spec/models/login_via_api_response_spec.rb +47 -0
  128. data/spec/models/message_spec.rb +59 -0
  129. data/spec/models/provider_credentials_config_spec.rb +47 -0
  130. data/spec/models/recovery_address_spec.rb +53 -0
  131. data/spec/models/recovery_flow_method_config_spec.rb +59 -0
  132. data/spec/models/recovery_flow_method_spec.rb +47 -0
  133. data/spec/models/recovery_flow_spec.rb +89 -0
  134. data/spec/models/recovery_link_spec.rb +47 -0
  135. data/spec/models/recovery_request_method_spec.rb +47 -0
  136. data/spec/models/recovery_request_spec.rb +83 -0
  137. data/spec/models/registration_flow_method_config_spec.rb +65 -0
  138. data/spec/models/registration_flow_method_spec.rb +47 -0
  139. data/spec/models/registration_flow_spec.rb +83 -0
  140. data/spec/models/registration_via_api_response_spec.rb +53 -0
  141. data/spec/models/revoke_session_spec.rb +41 -0
  142. data/spec/models/settings_flow_method_config_spec.rb +59 -0
  143. data/spec/models/settings_flow_method_spec.rb +47 -0
  144. data/spec/models/settings_flow_spec.rb +95 -0
  145. data/spec/models/settings_via_api_response_spec.rb +47 -0
  146. data/spec/models/update_identity_spec.rb +47 -0
  147. data/spec/models/verification_flow_method_config_spec.rb +59 -0
  148. data/spec/models/verification_flow_method_spec.rb +47 -0
  149. data/spec/models/verification_flow_spec.rb +89 -0
  150. metadata +150 -22
@@ -0,0 +1,236 @@
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.2-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
+ # The Response for Registration Flows via API
17
+ class RegistrationViaApiResponse
18
+ attr_accessor :identity
19
+
20
+ attr_accessor :session
21
+
22
+ # The Session Token This field is only set when the session hook is configured as a post-registration hook. A session token is equivalent to a session cookie, but it can be sent in the HTTP Authorization Header: Authorization: bearer ${session-token} The session token is only issued for API flows, not for Browser flows!
23
+ attr_accessor :session_token
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'identity' => :'identity',
29
+ :'session' => :'session',
30
+ :'session_token' => :'session_token'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'identity' => :'Identity',
38
+ :'session' => :'Session',
39
+ :'session_token' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::RegistrationViaApiResponse` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::RegistrationViaApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'identity')
65
+ self.identity = attributes[:'identity']
66
+ end
67
+
68
+ if attributes.key?(:'session')
69
+ self.session = attributes[:'session']
70
+ end
71
+
72
+ if attributes.key?(:'session_token')
73
+ self.session_token = attributes[:'session_token']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @identity.nil?
82
+ invalid_properties.push('invalid value for "identity", identity cannot be nil.')
83
+ end
84
+
85
+ if @session_token.nil?
86
+ invalid_properties.push('invalid value for "session_token", session_token cannot be nil.')
87
+ end
88
+
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ return false if @identity.nil?
96
+ return false if @session_token.nil?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ identity == o.identity &&
106
+ session == o.session &&
107
+ session_token == o.session_token
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Integer] Hash code
118
+ def hash
119
+ [identity, session, session_token].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def self.build_from_hash(attributes)
126
+ new.build_from_hash(attributes)
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.openapi_types.each_pair do |key, type|
135
+ if type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ OryHydraClient.const_get(type).build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+ end
236
+ 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.4.6-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
 
@@ -17,12 +17,11 @@ module OryHydraClient
17
17
  # Action should be used as the form action URL `<form action=\"{{ .Action }}\" method=\"post\">`.
18
18
  attr_accessor :action
19
19
 
20
- # Errors contains all form errors. These will be duplicates of the individual field errors.
21
- attr_accessor :errors
22
-
23
20
  # Fields contains multiple fields
24
21
  attr_accessor :fields
25
22
 
23
+ attr_accessor :messages
24
+
26
25
  # Method is the form method (e.g. POST)
27
26
  attr_accessor :method
28
27
 
@@ -30,8 +29,8 @@ module OryHydraClient
30
29
  def self.attribute_map
31
30
  {
32
31
  :'action' => :'action',
33
- :'errors' => :'errors',
34
32
  :'fields' => :'fields',
33
+ :'messages' => :'messages',
35
34
  :'method' => :'method'
36
35
  }
37
36
  end
@@ -40,8 +39,8 @@ module OryHydraClient
40
39
  def self.openapi_types
41
40
  {
42
41
  :'action' => :'String',
43
- :'errors' => :'Array<Error>',
44
42
  :'fields' => :'Array<FormField>',
43
+ :'messages' => :'Array<Message>',
45
44
  :'method' => :'String'
46
45
  }
47
46
  end
@@ -71,18 +70,18 @@ module OryHydraClient
71
70
  self.action = attributes[:'action']
72
71
  end
73
72
 
74
- if attributes.key?(:'errors')
75
- if (value = attributes[:'errors']).is_a?(Array)
76
- self.errors = value
77
- end
78
- end
79
-
80
73
  if attributes.key?(:'fields')
81
74
  if (value = attributes[:'fields']).is_a?(Array)
82
75
  self.fields = value
83
76
  end
84
77
  end
85
78
 
79
+ if attributes.key?(:'messages')
80
+ if (value = attributes[:'messages']).is_a?(Array)
81
+ self.messages = value
82
+ end
83
+ end
84
+
86
85
  if attributes.key?(:'method')
87
86
  self.method = attributes[:'method']
88
87
  end
@@ -122,8 +121,8 @@ module OryHydraClient
122
121
  return true if self.equal?(o)
123
122
  self.class == o.class &&
124
123
  action == o.action &&
125
- errors == o.errors &&
126
124
  fields == o.fields &&
125
+ messages == o.messages &&
127
126
  method == o.method
128
127
  end
129
128
 
@@ -136,7 +135,7 @@ module OryHydraClient
136
135
  # Calculates hash code according to all attributes.
137
136
  # @return [Integer] Hash code
138
137
  def hash
139
- [action, errors, fields, method].hash
138
+ [action, fields, messages, method].hash
140
139
  end
141
140
 
142
141
  # Builds the object from hash
@@ -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.2-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