ory-kratos-client 0.1.1.alpha1 → 0.2.0.alpha2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -12
  3. data/docs/AdminApi.md +68 -21
  4. data/docs/CommonApi.md +68 -21
  5. data/docs/CompleteSelfServiceBrowserSettingsStrategyProfileFlowPayload.md +19 -0
  6. data/docs/Form.md +1 -1
  7. data/docs/FormField.md +6 -6
  8. data/docs/GenericErrorPayload.md +1 -1
  9. data/docs/LoginRequest.md +2 -0
  10. data/docs/LoginRequestMethodConfig.md +1 -1
  11. data/docs/PublicApi.md +134 -44
  12. data/docs/RegistrationRequestMethodConfig.md +1 -1
  13. data/docs/RequestMethodConfig.md +23 -0
  14. data/docs/SettingsRequest.md +31 -0
  15. data/docs/SettingsRequestMethod.md +19 -0
  16. data/docs/VerifiableAddress.md +1 -1
  17. data/docs/VerificationRequest.md +1 -1
  18. data/lib/ory-kratos-client.rb +4 -2
  19. data/lib/ory-kratos-client/api/admin_api.rb +95 -35
  20. data/lib/ory-kratos-client/api/common_api.rb +95 -35
  21. data/lib/ory-kratos-client/api/public_api.rb +181 -65
  22. data/lib/ory-kratos-client/models/complete_self_service_browser_settings_strategy_profile_flow_payload.rb +222 -0
  23. data/lib/ory-kratos-client/models/form.rb +1 -1
  24. data/lib/ory-kratos-client/models/form_field.rb +6 -6
  25. data/lib/ory-kratos-client/models/generic_error_payload.rb +2 -3
  26. data/lib/ory-kratos-client/models/login_request.rb +11 -1
  27. data/lib/ory-kratos-client/models/login_request_method_config.rb +1 -1
  28. data/lib/ory-kratos-client/models/registration_request_method_config.rb +1 -1
  29. data/lib/ory-kratos-client/models/request_method_config.rb +256 -0
  30. data/lib/ory-kratos-client/models/settings_request.rb +313 -0
  31. data/lib/ory-kratos-client/models/settings_request_method.rb +216 -0
  32. data/lib/ory-kratos-client/models/verifiable_address.rb +0 -5
  33. data/lib/ory-kratos-client/models/verification_request.rb +1 -1
  34. data/lib/ory-kratos-client/version.rb +1 -1
  35. data/spec/models/complete_self_service_browser_settings_strategy_profile_flow_payload_spec.rb +47 -0
  36. data/spec/models/request_method_config_spec.rb +59 -0
  37. data/spec/models/settings_request_method_spec.rb +47 -0
  38. data/spec/models/settings_request_spec.rb +83 -0
  39. metadata +36 -20
@@ -15,7 +15,7 @@ require 'date'
15
15
  module OryHydraClient
16
16
  # HTMLForm represents a HTML Form. The container can work with both HTTP Form and JSON requests
17
17
  class Form
18
- # Action should be used as the form action URL (<form action=\"{{ .Action }}\" method=\"post\">).
18
+ # Action should be used as the form action URL `<form action=\"{{ .Action }}\" method=\"post\">`.
19
19
  attr_accessor :action
20
20
 
21
21
  # Errors contains all form errors. These will be duplicates of the individual field errors.
@@ -15,25 +15,25 @@ require 'date'
15
15
  module OryHydraClient
16
16
  # Field represents a HTML Form Field
17
17
  class FormField
18
- # Disabled is the equivalent of <input disabled=\"{{.Disabled}}\">
18
+ # Disabled is the equivalent of `<input disabled=\"{{.Disabled}}\">`
19
19
  attr_accessor :disabled
20
20
 
21
21
  # Errors contains all validation errors this particular field has caused.
22
22
  attr_accessor :errors
23
23
 
24
- # Name is the equivalent of <input name=\"{{.Name}}\">
24
+ # Name is the equivalent of `<input name=\"{{.Name}}\">`
25
25
  attr_accessor :name
26
26
 
27
- # Pattern is the equivalent of <input pattern=\"{{.Pattern}}\">
27
+ # Pattern is the equivalent of `<input pattern=\"{{.Pattern}}\">`
28
28
  attr_accessor :pattern
29
29
 
30
- # Required is the equivalent of <input required=\"{{.Required}}\">
30
+ # Required is the equivalent of `<input required=\"{{.Required}}\">`
31
31
  attr_accessor :required
32
32
 
33
- # Type is the equivalent of <input type=\"{{.Type}}\">
33
+ # Type is the equivalent of `<input type=\"{{.Type}}\">`
34
34
  attr_accessor :type
35
35
 
36
- # Value is the equivalent of <input value=\"{{.Value}}\">
36
+ # Value is the equivalent of `<input value=\"{{.Value}}\">`
37
37
  attr_accessor :value
38
38
 
39
39
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -13,7 +13,6 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module OryHydraClient
16
- # nolint:deadcode,unused
17
16
  class GenericErrorPayload
18
17
  # Code represents the error status code (404, 403, 401, ...).
19
18
  attr_accessor :code
@@ -49,7 +48,7 @@ module OryHydraClient
49
48
  {
50
49
  :'code' => :'Integer',
51
50
  :'debug' => :'String',
52
- :'details' => :'Array<Hash<String, Object>>',
51
+ :'details' => :'Hash<String, Object>',
53
52
  :'message' => :'String',
54
53
  :'reason' => :'String',
55
54
  :'request' => :'String',
@@ -87,7 +86,7 @@ module OryHydraClient
87
86
  end
88
87
 
89
88
  if attributes.key?(:'details')
90
- if (value = attributes[:'details']).is_a?(Array)
89
+ if (value = attributes[:'details']).is_a?(Hash)
91
90
  self.details = value
92
91
  end
93
92
  end
@@ -20,6 +20,9 @@ module OryHydraClient
20
20
  # ExpiresAt is the time (UTC) when the request expires. If the user still wishes to log in, a new request has to be initiated.
21
21
  attr_accessor :expires_at
22
22
 
23
+ # Forced stores whether this login request should enforce reauthentication.
24
+ attr_accessor :forced
25
+
23
26
  attr_accessor :id
24
27
 
25
28
  # IssuedAt is the time (UTC) when the request occurred.
@@ -36,6 +39,7 @@ module OryHydraClient
36
39
  {
37
40
  :'active' => :'active',
38
41
  :'expires_at' => :'expires_at',
42
+ :'forced' => :'forced',
39
43
  :'id' => :'id',
40
44
  :'issued_at' => :'issued_at',
41
45
  :'methods' => :'methods',
@@ -48,6 +52,7 @@ module OryHydraClient
48
52
  {
49
53
  :'active' => :'String',
50
54
  :'expires_at' => :'DateTime',
55
+ :'forced' => :'Boolean',
51
56
  :'id' => :'String',
52
57
  :'issued_at' => :'DateTime',
53
58
  :'methods' => :'Hash<String, LoginRequestMethod>',
@@ -84,6 +89,10 @@ module OryHydraClient
84
89
  self.expires_at = attributes[:'expires_at']
85
90
  end
86
91
 
92
+ if attributes.key?(:'forced')
93
+ self.forced = attributes[:'forced']
94
+ end
95
+
87
96
  if attributes.key?(:'id')
88
97
  self.id = attributes[:'id']
89
98
  end
@@ -148,6 +157,7 @@ module OryHydraClient
148
157
  self.class == o.class &&
149
158
  active == o.active &&
150
159
  expires_at == o.expires_at &&
160
+ forced == o.forced &&
151
161
  id == o.id &&
152
162
  issued_at == o.issued_at &&
153
163
  methods == o.methods &&
@@ -163,7 +173,7 @@ module OryHydraClient
163
173
  # Calculates hash code according to all attributes.
164
174
  # @return [Integer] Hash code
165
175
  def hash
166
- [active, expires_at, id, issued_at, methods, request_url].hash
176
+ [active, expires_at, forced, id, issued_at, methods, request_url].hash
167
177
  end
168
178
 
169
179
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module OryHydraClient
16
16
  class LoginRequestMethodConfig
17
- # Action should be used as the form action URL (<form action=\"{{ .Action }}\" method=\"post\">).
17
+ # Action should be used as the form action URL `<form action=\"{{ .Action }}\" method=\"post\">`.
18
18
  attr_accessor :action
19
19
 
20
20
  # Errors contains all form errors. These will be duplicates of the individual field errors.
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module OryHydraClient
16
16
  class RegistrationRequestMethodConfig
17
- # Action should be used as the form action URL (<form action=\"{{ .Action }}\" method=\"post\">).
17
+ # Action should be used as the form action URL `<form action=\"{{ .Action }}\" method=\"post\">`.
18
18
  attr_accessor :action
19
19
 
20
20
  # Errors contains all form errors. These will be duplicates of the individual field errors.
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: latest
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ class RequestMethodConfig
17
+ # Action should be used as the form action URL `<form action=\"{{ .Action }}\" method=\"post\">`.
18
+ attr_accessor :action
19
+
20
+ # Errors contains all form errors. These will be duplicates of the individual field errors.
21
+ attr_accessor :errors
22
+
23
+ # Fields contains multiple fields
24
+ attr_accessor :fields
25
+
26
+ # Method is the form method (e.g. POST)
27
+ attr_accessor :method
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'action' => :'action',
33
+ :'errors' => :'errors',
34
+ :'fields' => :'fields',
35
+ :'method' => :'method'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'action' => :'String',
43
+ :'errors' => :'Array<Error>',
44
+ :'fields' => :'Array<FormField>',
45
+ :'method' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::RequestMethodConfig` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::RequestMethodConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'action')
71
+ self.action = attributes[:'action']
72
+ end
73
+
74
+ if attributes.key?(:'errors')
75
+ if (value = attributes[:'errors']).is_a?(Array)
76
+ self.errors = value
77
+ end
78
+ end
79
+
80
+ if attributes.key?(:'fields')
81
+ if (value = attributes[:'fields']).is_a?(Array)
82
+ self.fields = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'method')
87
+ self.method = attributes[:'method']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ if @action.nil?
96
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
97
+ end
98
+
99
+ if @fields.nil?
100
+ invalid_properties.push('invalid value for "fields", fields cannot be nil.')
101
+ end
102
+
103
+ if @method.nil?
104
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if @action.nil?
114
+ return false if @fields.nil?
115
+ return false if @method.nil?
116
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ action == o.action &&
125
+ errors == o.errors &&
126
+ fields == o.fields &&
127
+ method == o.method
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [action, errors, fields, method].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ new.build_from_hash(attributes)
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ self.class.openapi_types.each_pair do |key, type|
155
+ if type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :DateTime
176
+ DateTime.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ OryHydraClient.const_get(type).build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ # Returns the string representation of the object
211
+ # @return [String] String presentation of the object
212
+ def to_s
213
+ to_hash.to_s
214
+ end
215
+
216
+ # to_body is an alias to to_hash (backward compatibility)
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_body
219
+ to_hash
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = self.send(attr)
228
+ if value.nil?
229
+ is_nullable = self.class.openapi_nullable.include?(attr)
230
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
231
+ end
232
+
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map { |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+ end
256
+ end
@@ -0,0 +1,313 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: latest
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ # This request is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner. For more information head over to: https://www.ory.sh/docs/kratos/selfservice/flows/user-settings-profile-management
17
+ class SettingsRequest
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
+ attr_accessor :identity
27
+
28
+ # IssuedAt is the time (UTC) when the request occurred.
29
+ attr_accessor :issued_at
30
+
31
+ # Methods contains context for all enabled registration 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
+ # UpdateSuccessful, if true, indicates that the settings request has been updated successfully with the provided data. Done will stay true when repeatedly checking. If set to true, done will revert back to false only when a request with invalid (e.g. \"please use a valid phone number\") data was sent.
38
+ attr_accessor :update_successful
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'active' => :'active',
44
+ :'expires_at' => :'expires_at',
45
+ :'id' => :'id',
46
+ :'identity' => :'identity',
47
+ :'issued_at' => :'issued_at',
48
+ :'methods' => :'methods',
49
+ :'request_url' => :'request_url',
50
+ :'update_successful' => :'update_successful'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'active' => :'String',
58
+ :'expires_at' => :'DateTime',
59
+ :'id' => :'String',
60
+ :'identity' => :'Identity',
61
+ :'issued_at' => :'DateTime',
62
+ :'methods' => :'Hash<String, SettingsRequestMethod>',
63
+ :'request_url' => :'String',
64
+ :'update_successful' => :'Boolean'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::SettingsRequest` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::SettingsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'active')
90
+ self.active = attributes[:'active']
91
+ end
92
+
93
+ if attributes.key?(:'expires_at')
94
+ self.expires_at = attributes[:'expires_at']
95
+ end
96
+
97
+ if attributes.key?(:'id')
98
+ self.id = attributes[:'id']
99
+ end
100
+
101
+ if attributes.key?(:'identity')
102
+ self.identity = attributes[:'identity']
103
+ end
104
+
105
+ if attributes.key?(:'issued_at')
106
+ self.issued_at = attributes[:'issued_at']
107
+ end
108
+
109
+ if attributes.key?(:'methods')
110
+ if (value = attributes[:'methods']).is_a?(Hash)
111
+ self.methods = value
112
+ end
113
+ end
114
+
115
+ if attributes.key?(:'request_url')
116
+ self.request_url = attributes[:'request_url']
117
+ end
118
+
119
+ if attributes.key?(:'update_successful')
120
+ self.update_successful = attributes[:'update_successful']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ if @expires_at.nil?
129
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
130
+ end
131
+
132
+ if @id.nil?
133
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
134
+ end
135
+
136
+ if @identity.nil?
137
+ invalid_properties.push('invalid value for "identity", identity cannot be nil.')
138
+ end
139
+
140
+ if @issued_at.nil?
141
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
142
+ end
143
+
144
+ if @methods.nil?
145
+ invalid_properties.push('invalid value for "methods", methods cannot be nil.')
146
+ end
147
+
148
+ if @request_url.nil?
149
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
150
+ end
151
+
152
+ if @update_successful.nil?
153
+ invalid_properties.push('invalid value for "update_successful", update_successful cannot be nil.')
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ return false if @expires_at.nil?
163
+ return false if @id.nil?
164
+ return false if @identity.nil?
165
+ return false if @issued_at.nil?
166
+ return false if @methods.nil?
167
+ return false if @request_url.nil?
168
+ return false if @update_successful.nil?
169
+ true
170
+ end
171
+
172
+ # Checks equality by comparing each attribute.
173
+ # @param [Object] Object to be compared
174
+ def ==(o)
175
+ return true if self.equal?(o)
176
+ self.class == o.class &&
177
+ active == o.active &&
178
+ expires_at == o.expires_at &&
179
+ id == o.id &&
180
+ identity == o.identity &&
181
+ issued_at == o.issued_at &&
182
+ methods == o.methods &&
183
+ request_url == o.request_url &&
184
+ update_successful == o.update_successful
185
+ end
186
+
187
+ # @see the `==` method
188
+ # @param [Object] Object to be compared
189
+ def eql?(o)
190
+ self == o
191
+ end
192
+
193
+ # Calculates hash code according to all attributes.
194
+ # @return [Integer] Hash code
195
+ def hash
196
+ [active, expires_at, id, identity, issued_at, methods, request_url, update_successful].hash
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def self.build_from_hash(attributes)
203
+ new.build_from_hash(attributes)
204
+ end
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def build_from_hash(attributes)
210
+ return nil unless attributes.is_a?(Hash)
211
+ self.class.openapi_types.each_pair do |key, type|
212
+ if type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
216
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
217
+ end
218
+ elsif !attributes[self.class.attribute_map[key]].nil?
219
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
220
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
221
+ end
222
+
223
+ self
224
+ end
225
+
226
+ # Deserializes the data based on type
227
+ # @param string type Data type
228
+ # @param string value Value to be deserialized
229
+ # @return [Object] Deserialized data
230
+ def _deserialize(type, value)
231
+ case type.to_sym
232
+ when :DateTime
233
+ DateTime.parse(value)
234
+ when :Date
235
+ Date.parse(value)
236
+ when :String
237
+ value.to_s
238
+ when :Integer
239
+ value.to_i
240
+ when :Float
241
+ value.to_f
242
+ when :Boolean
243
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
244
+ true
245
+ else
246
+ false
247
+ end
248
+ when :Object
249
+ # generic object (usually a Hash), return directly
250
+ value
251
+ when /\AArray<(?<inner_type>.+)>\z/
252
+ inner_type = Regexp.last_match[:inner_type]
253
+ value.map { |v| _deserialize(inner_type, v) }
254
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
255
+ k_type = Regexp.last_match[:k_type]
256
+ v_type = Regexp.last_match[:v_type]
257
+ {}.tap do |hash|
258
+ value.each do |k, v|
259
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
260
+ end
261
+ end
262
+ else # model
263
+ OryHydraClient.const_get(type).build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ if value.nil?
286
+ is_nullable = self.class.openapi_nullable.include?(attr)
287
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
288
+ end
289
+
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map { |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+ end
313
+ end