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

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