ory-kratos-client 0.4.6.alpha1 → 0.5.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +82 -60
  3. data/docs/AdminApi.md +208 -98
  4. data/docs/CompleteSelfServiceLoginFlowWithPasswordMethod.md +21 -0
  5. data/docs/CompleteSelfServiceRecoveryFlowWithLinkMethod.md +19 -0
  6. data/docs/CompleteSelfServiceSettingsFlowWithPasswordMethod.md +19 -0
  7. data/docs/CompleteSelfServiceVerificationFlowWithLinkMethod.md +19 -0
  8. data/docs/CreateIdentity.md +19 -0
  9. data/docs/CreateRecoveryLink.md +19 -0
  10. data/docs/ErrorContainer.md +2 -2
  11. data/docs/Identity.md +1 -1
  12. data/docs/LoginFlow.md +33 -0
  13. data/docs/LoginFlowMethod.md +19 -0
  14. data/docs/LoginFlowMethodConfig.md +25 -0
  15. data/docs/LoginViaApiResponse.md +19 -0
  16. data/docs/Message.md +1 -1
  17. data/docs/PublicApi.md +589 -197
  18. data/docs/RecoveryFlow.md +33 -0
  19. data/docs/RecoveryFlowMethod.md +19 -0
  20. data/docs/RecoveryFlowMethodConfig.md +23 -0
  21. data/docs/RecoveryLink.md +19 -0
  22. data/docs/RegistrationFlow.md +31 -0
  23. data/docs/RegistrationFlowMethod.md +19 -0
  24. data/docs/RegistrationFlowMethodConfig.md +25 -0
  25. data/docs/RegistrationViaApiResponse.md +21 -0
  26. data/docs/RevokeSession.md +17 -0
  27. data/docs/Session.md +6 -4
  28. data/docs/SettingsFlow.md +35 -0
  29. data/docs/SettingsFlowMethod.md +19 -0
  30. data/docs/SettingsFlowMethodConfig.md +23 -0
  31. data/docs/SettingsViaApiResponse.md +19 -0
  32. data/docs/UpdateIdentity.md +19 -0
  33. data/docs/VerifiableAddress.md +3 -3
  34. data/docs/VerificationFlow.md +33 -0
  35. data/docs/VerificationFlowMethod.md +19 -0
  36. data/docs/VerificationFlowMethodConfig.md +23 -0
  37. data/lib/ory-kratos-client.rb +28 -17
  38. data/lib/ory-kratos-client/api/admin_api.rb +277 -149
  39. data/lib/ory-kratos-client/api/health_api.rb +1 -1
  40. data/lib/ory-kratos-client/api/public_api.rb +713 -297
  41. data/lib/ory-kratos-client/api/version_api.rb +1 -1
  42. data/lib/ory-kratos-client/api_client.rb +2 -1
  43. data/lib/ory-kratos-client/api_error.rb +1 -1
  44. data/lib/ory-kratos-client/configuration.rb +8 -1
  45. data/lib/ory-kratos-client/models/complete_self_service_login_flow_with_password_method.rb +227 -0
  46. data/lib/ory-kratos-client/models/complete_self_service_recovery_flow_with_link_method.rb +217 -0
  47. data/lib/ory-kratos-client/models/complete_self_service_settings_flow_with_password_method.rb +222 -0
  48. data/lib/ory-kratos-client/models/complete_self_service_verification_flow_with_link_method.rb +217 -0
  49. data/lib/ory-kratos-client/models/create_identity.rb +227 -0
  50. data/lib/ory-kratos-client/models/create_recovery_link.rb +238 -0
  51. data/lib/ory-kratos-client/models/error_container.rb +12 -1
  52. data/lib/ory-kratos-client/models/form_field.rb +1 -1
  53. data/lib/ory-kratos-client/models/generic_error.rb +1 -1
  54. data/lib/ory-kratos-client/models/generic_error_payload.rb +1 -1
  55. data/lib/ory-kratos-client/models/health_not_ready_status.rb +1 -1
  56. data/lib/ory-kratos-client/models/health_status.rb +1 -1
  57. data/lib/ory-kratos-client/models/identity.rb +6 -1
  58. data/lib/ory-kratos-client/models/login_flow.rb +315 -0
  59. data/lib/ory-kratos-client/models/login_flow_method.rb +226 -0
  60. data/lib/ory-kratos-client/models/login_flow_method_config.rb +267 -0
  61. data/lib/ory-kratos-client/models/login_via_api_response.rb +227 -0
  62. data/lib/ory-kratos-client/models/message.rb +2 -1
  63. data/lib/ory-kratos-client/models/recovery_address.rb +1 -1
  64. data/lib/ory-kratos-client/models/recovery_flow.rb +319 -0
  65. data/lib/ory-kratos-client/models/recovery_flow_method.rb +226 -0
  66. data/lib/ory-kratos-client/models/recovery_flow_method_config.rb +255 -0
  67. data/lib/ory-kratos-client/models/recovery_link.rb +222 -0
  68. data/lib/ory-kratos-client/models/registration_flow.rb +304 -0
  69. data/lib/ory-kratos-client/models/registration_flow_method.rb +226 -0
  70. data/lib/ory-kratos-client/models/registration_flow_method_config.rb +267 -0
  71. data/lib/ory-kratos-client/models/registration_via_api_response.rb +236 -0
  72. data/lib/ory-kratos-client/models/revoke_session.rb +212 -0
  73. data/lib/ory-kratos-client/models/session.rb +28 -19
  74. data/lib/ory-kratos-client/models/settings_flow.rb +333 -0
  75. data/lib/ory-kratos-client/models/settings_flow_method.rb +226 -0
  76. data/lib/ory-kratos-client/models/settings_flow_method_config.rb +255 -0
  77. data/lib/ory-kratos-client/models/settings_via_api_response.rb +226 -0
  78. data/lib/ory-kratos-client/models/update_identity.rb +222 -0
  79. data/lib/ory-kratos-client/models/verifiable_address.rb +16 -16
  80. data/lib/ory-kratos-client/models/verification_flow.rb +299 -0
  81. data/lib/ory-kratos-client/models/verification_flow_method.rb +226 -0
  82. data/lib/ory-kratos-client/models/verification_flow_method_config.rb +255 -0
  83. data/lib/ory-kratos-client/models/version.rb +1 -1
  84. data/lib/ory-kratos-client/version.rb +2 -2
  85. data/ory-kratos-client.gemspec +1 -1
  86. data/spec/models/complete_self_service_login_flow_with_password_method_spec.rb +53 -0
  87. data/spec/models/complete_self_service_recovery_flow_with_link_method_spec.rb +47 -0
  88. data/spec/models/complete_self_service_settings_flow_with_password_method_spec.rb +47 -0
  89. data/spec/models/complete_self_service_verification_flow_with_link_method_spec.rb +47 -0
  90. data/spec/models/create_identity_spec.rb +47 -0
  91. data/spec/models/create_recovery_link_spec.rb +47 -0
  92. data/spec/models/login_flow_method_config_spec.rb +65 -0
  93. data/spec/models/login_flow_method_spec.rb +47 -0
  94. data/spec/models/login_flow_spec.rb +89 -0
  95. data/spec/models/login_via_api_response_spec.rb +47 -0
  96. data/spec/models/recovery_flow_method_config_spec.rb +59 -0
  97. data/spec/models/recovery_flow_method_spec.rb +47 -0
  98. data/spec/models/recovery_flow_spec.rb +89 -0
  99. data/spec/models/recovery_link_spec.rb +47 -0
  100. data/spec/models/registration_flow_method_config_spec.rb +65 -0
  101. data/spec/models/registration_flow_method_spec.rb +47 -0
  102. data/spec/models/registration_flow_spec.rb +83 -0
  103. data/spec/models/registration_via_api_response_spec.rb +53 -0
  104. data/spec/models/revoke_session_spec.rb +41 -0
  105. data/spec/models/settings_flow_method_config_spec.rb +59 -0
  106. data/spec/models/settings_flow_method_spec.rb +47 -0
  107. data/spec/models/settings_flow_spec.rb +95 -0
  108. data/spec/models/settings_via_api_response_spec.rb +47 -0
  109. data/spec/models/update_identity_spec.rb +47 -0
  110. data/spec/models/verification_flow_method_config_spec.rb +59 -0
  111. data/spec/models/verification_flow_method_spec.rb +47 -0
  112. data/spec/models/verification_flow_spec.rb +89 -0
  113. metadata +133 -25
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Welcome to the ORY Kratos HTTP API documentation!
5
5
 
6
- The version of the OpenAPI document: v0.4.6-alpha.1
6
+ The version of the OpenAPI document: v0.5.0-alpha.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Welcome to the ORY Kratos HTTP API documentation!
5
5
 
6
- The version of the OpenAPI document: v0.4.6-alpha.1
6
+ The version of the OpenAPI document: v0.5.0-alpha.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -93,6 +93,7 @@ module OryHydraClient
93
93
  query_params = opts[:query_params] || {}
94
94
  form_params = opts[:form_params] || {}
95
95
 
96
+ update_params_for_auth! header_params, query_params, opts[:auth_names]
96
97
 
97
98
  # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
98
99
  _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Welcome to the ORY Kratos HTTP API documentation!
5
5
 
6
- The version of the OpenAPI document: v0.4.6-alpha.1
6
+ The version of the OpenAPI document: v0.5.0-alpha.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Welcome to the ORY Kratos HTTP API documentation!
5
5
 
6
- The version of the OpenAPI document: v0.4.6-alpha.1
6
+ The version of the OpenAPI document: v0.5.0-alpha.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -193,6 +193,13 @@ module OryHydraClient
193
193
  # Returns Auth Settings hash for api client.
194
194
  def auth_settings
195
195
  {
196
+ 'sessionToken' =>
197
+ {
198
+ type: 'api_key',
199
+ in: 'header',
200
+ key: 'X-Session-Token',
201
+ value: api_key_with_prefix('X-Session-Token')
202
+ },
196
203
  }
197
204
  end
198
205
 
@@ -0,0 +1,227 @@
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.0-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 CompleteSelfServiceLoginFlowWithPasswordMethod
17
+ # Sending the anti-csrf token is only required for browser login flows.
18
+ attr_accessor :csrf_token
19
+
20
+ # Identifier is the email or username of the user trying to log in.
21
+ attr_accessor :identifier
22
+
23
+ # The user's password.
24
+ attr_accessor :password
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'csrf_token' => :'csrf_token',
30
+ :'identifier' => :'identifier',
31
+ :'password' => :'password'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'csrf_token' => :'String',
39
+ :'identifier' => :'String',
40
+ :'password' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::CompleteSelfServiceLoginFlowWithPasswordMethod` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::CompleteSelfServiceLoginFlowWithPasswordMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'csrf_token')
66
+ self.csrf_token = attributes[:'csrf_token']
67
+ end
68
+
69
+ if attributes.key?(:'identifier')
70
+ self.identifier = attributes[:'identifier']
71
+ end
72
+
73
+ if attributes.key?(:'password')
74
+ self.password = attributes[:'password']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ csrf_token == o.csrf_token &&
97
+ identifier == o.identifier &&
98
+ password == o.password
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [csrf_token, identifier, password].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ OryHydraClient.const_get(type).build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,217 @@
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.0-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 CompleteSelfServiceRecoveryFlowWithLinkMethod
17
+ # Sending the anti-csrf token is only required for browser login flows.
18
+ attr_accessor :csrf_token
19
+
20
+ # Email to Recover Needs to be set when initiating the flow. If the email is a registered recovery email, a recovery link will be sent. If the email is not known, a email with details on what happened will be sent instead. format: email in: body
21
+ attr_accessor :email
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'csrf_token' => :'csrf_token',
27
+ :'email' => :'email'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'csrf_token' => :'String',
35
+ :'email' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::CompleteSelfServiceRecoveryFlowWithLinkMethod` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::CompleteSelfServiceRecoveryFlowWithLinkMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'csrf_token')
61
+ self.csrf_token = attributes[:'csrf_token']
62
+ end
63
+
64
+ if attributes.key?(:'email')
65
+ self.email = attributes[:'email']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ csrf_token == o.csrf_token &&
88
+ email == o.email
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [csrf_token, email].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ OryHydraClient.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end