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
@@ -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
 
@@ -0,0 +1,239 @@
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 RecoveryAddress
17
+ attr_accessor :id
18
+
19
+ attr_accessor :value
20
+
21
+ attr_accessor :via
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'id' => :'id',
27
+ :'value' => :'value',
28
+ :'via' => :'via'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'id' => :'String',
36
+ :'value' => :'String',
37
+ :'via' => :'String'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::RecoveryAddress` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::RecoveryAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'id')
63
+ self.id = attributes[:'id']
64
+ end
65
+
66
+ if attributes.key?(:'value')
67
+ self.value = attributes[:'value']
68
+ end
69
+
70
+ if attributes.key?(:'via')
71
+ self.via = attributes[:'via']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @id.nil?
80
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
81
+ end
82
+
83
+ if @value.nil?
84
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
85
+ end
86
+
87
+ if @via.nil?
88
+ invalid_properties.push('invalid value for "via", via cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @id.nil?
98
+ return false if @value.nil?
99
+ return false if @via.nil?
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ id == o.id &&
109
+ value == o.value &&
110
+ via == o.via
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [id, value, via].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ OryHydraClient.const_get(type).build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+ end
239
+ end
@@ -0,0 +1,319 @@
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 request is used when an identity wants to recover their account. We recommend reading the [Account Recovery Documentation](../self-service/flows/password-reset-account-recovery)
17
+ class RecoveryFlow
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 request expires. If the user still wishes to update the setting, a new request has to be initiated.
22
+ attr_accessor :expires_at
23
+
24
+ attr_accessor :id
25
+
26
+ # IssuedAt is the time (UTC) when the request occurred.
27
+ attr_accessor :issued_at
28
+
29
+ attr_accessor :messages
30
+
31
+ # Methods contains context for all account recovery methods. If a registration request has been processed, but for example the password is incorrect, this will contain error messages.
32
+ attr_accessor :methods
33
+
34
+ # 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.
35
+ attr_accessor :request_url
36
+
37
+ attr_accessor :state
38
+
39
+ # The flow type can either be `api` or `browser`.
40
+ attr_accessor :type
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
+ :'issued_at' => :'issued_at',
49
+ :'messages' => :'messages',
50
+ :'methods' => :'methods',
51
+ :'request_url' => :'request_url',
52
+ :'state' => :'state',
53
+ :'type' => :'type'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'active' => :'String',
61
+ :'expires_at' => :'DateTime',
62
+ :'id' => :'String',
63
+ :'issued_at' => :'DateTime',
64
+ :'messages' => :'Array<Message>',
65
+ :'methods' => :'Hash<String, RecoveryFlowMethod>',
66
+ :'request_url' => :'String',
67
+ :'state' => :'String',
68
+ :'type' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::RecoveryFlow` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::RecoveryFlow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'active')
94
+ self.active = attributes[:'active']
95
+ end
96
+
97
+ if attributes.key?(:'expires_at')
98
+ self.expires_at = attributes[:'expires_at']
99
+ end
100
+
101
+ if attributes.key?(:'id')
102
+ self.id = attributes[:'id']
103
+ end
104
+
105
+ if attributes.key?(:'issued_at')
106
+ self.issued_at = attributes[:'issued_at']
107
+ end
108
+
109
+ if attributes.key?(:'messages')
110
+ if (value = attributes[:'messages']).is_a?(Array)
111
+ self.messages = value
112
+ end
113
+ end
114
+
115
+ if attributes.key?(:'methods')
116
+ if (value = attributes[:'methods']).is_a?(Hash)
117
+ self.methods = value
118
+ end
119
+ end
120
+
121
+ if attributes.key?(:'request_url')
122
+ self.request_url = attributes[:'request_url']
123
+ end
124
+
125
+ if attributes.key?(:'state')
126
+ self.state = attributes[:'state']
127
+ end
128
+
129
+ if attributes.key?(:'type')
130
+ self.type = attributes[:'type']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ if @expires_at.nil?
139
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
140
+ end
141
+
142
+ if @id.nil?
143
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
144
+ end
145
+
146
+ if @issued_at.nil?
147
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
148
+ end
149
+
150
+ if @methods.nil?
151
+ invalid_properties.push('invalid value for "methods", methods cannot be nil.')
152
+ end
153
+
154
+ if @request_url.nil?
155
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
156
+ end
157
+
158
+ if @state.nil?
159
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
160
+ end
161
+
162
+ invalid_properties
163
+ end
164
+
165
+ # Check to see if the all the properties in the model are valid
166
+ # @return true if the model is valid
167
+ def valid?
168
+ return false if @expires_at.nil?
169
+ return false if @id.nil?
170
+ return false if @issued_at.nil?
171
+ return false if @methods.nil?
172
+ return false if @request_url.nil?
173
+ return false if @state.nil?
174
+ true
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(o)
180
+ return true if self.equal?(o)
181
+ self.class == o.class &&
182
+ active == o.active &&
183
+ expires_at == o.expires_at &&
184
+ id == o.id &&
185
+ issued_at == o.issued_at &&
186
+ messages == o.messages &&
187
+ methods == o.methods &&
188
+ request_url == o.request_url &&
189
+ state == o.state &&
190
+ type == o.type
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Integer] Hash code
201
+ def hash
202
+ [active, expires_at, id, issued_at, messages, methods, request_url, state, type].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def self.build_from_hash(attributes)
209
+ new.build_from_hash(attributes)
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def build_from_hash(attributes)
216
+ return nil unless attributes.is_a?(Hash)
217
+ self.class.openapi_types.each_pair do |key, type|
218
+ if type =~ /\AArray<(.*)>/i
219
+ # check to ensure the input is an array given that the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
222
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
223
+ end
224
+ elsif !attributes[self.class.attribute_map[key]].nil?
225
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
227
+ end
228
+
229
+ self
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def _deserialize(type, value)
237
+ case type.to_sym
238
+ when :DateTime
239
+ DateTime.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ OryHydraClient.const_get(type).build_from_hash(value)
270
+ end
271
+ end
272
+
273
+ # Returns the string representation of the object
274
+ # @return [String] String presentation of the object
275
+ def to_s
276
+ to_hash.to_s
277
+ end
278
+
279
+ # to_body is an alias to to_hash (backward compatibility)
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_body
282
+ to_hash
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = self.send(attr)
291
+ if value.nil?
292
+ is_nullable = self.class.openapi_nullable.include?(attr)
293
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
294
+ end
295
+
296
+ hash[param] = _to_hash(value)
297
+ end
298
+ hash
299
+ end
300
+
301
+ # Outputs non-array value in the form of hash
302
+ # For object, use to_hash. Otherwise, just return the value
303
+ # @param [Object] value Any valid value
304
+ # @return [Hash] Returns the value in the form of hash
305
+ def _to_hash(value)
306
+ if value.is_a?(Array)
307
+ value.compact.map { |v| _to_hash(v) }
308
+ elsif value.is_a?(Hash)
309
+ {}.tap do |hash|
310
+ value.each { |k, v| hash[k] = _to_hash(v) }
311
+ end
312
+ elsif value.respond_to? :to_hash
313
+ value.to_hash
314
+ else
315
+ value
316
+ end
317
+ end
318
+ end
319
+ end