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
 
@@ -28,14 +28,15 @@ module OryHydraClient
28
28
  # IssuedAt is the time (UTC) when the request occurred.
29
29
  attr_accessor :issued_at
30
30
 
31
+ attr_accessor :messages
32
+
31
33
  # 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
34
  attr_accessor :methods
33
35
 
34
36
  # 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
37
  attr_accessor :request_url
36
38
 
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
+ attr_accessor :state
39
40
 
40
41
  # Attribute mapping from ruby-style variable name to JSON key.
41
42
  def self.attribute_map
@@ -45,9 +46,10 @@ module OryHydraClient
45
46
  :'id' => :'id',
46
47
  :'identity' => :'identity',
47
48
  :'issued_at' => :'issued_at',
49
+ :'messages' => :'messages',
48
50
  :'methods' => :'methods',
49
51
  :'request_url' => :'request_url',
50
- :'update_successful' => :'update_successful'
52
+ :'state' => :'state'
51
53
  }
52
54
  end
53
55
 
@@ -59,9 +61,10 @@ module OryHydraClient
59
61
  :'id' => :'String',
60
62
  :'identity' => :'Identity',
61
63
  :'issued_at' => :'DateTime',
64
+ :'messages' => :'Array<Message>',
62
65
  :'methods' => :'Hash<String, SettingsRequestMethod>',
63
66
  :'request_url' => :'String',
64
- :'update_successful' => :'Boolean'
67
+ :'state' => :'String'
65
68
  }
66
69
  end
67
70
 
@@ -106,6 +109,12 @@ module OryHydraClient
106
109
  self.issued_at = attributes[:'issued_at']
107
110
  end
108
111
 
112
+ if attributes.key?(:'messages')
113
+ if (value = attributes[:'messages']).is_a?(Array)
114
+ self.messages = value
115
+ end
116
+ end
117
+
109
118
  if attributes.key?(:'methods')
110
119
  if (value = attributes[:'methods']).is_a?(Hash)
111
120
  self.methods = value
@@ -116,8 +125,8 @@ module OryHydraClient
116
125
  self.request_url = attributes[:'request_url']
117
126
  end
118
127
 
119
- if attributes.key?(:'update_successful')
120
- self.update_successful = attributes[:'update_successful']
128
+ if attributes.key?(:'state')
129
+ self.state = attributes[:'state']
121
130
  end
122
131
  end
123
132
 
@@ -149,8 +158,8 @@ module OryHydraClient
149
158
  invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
150
159
  end
151
160
 
152
- if @update_successful.nil?
153
- invalid_properties.push('invalid value for "update_successful", update_successful cannot be nil.')
161
+ if @state.nil?
162
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
154
163
  end
155
164
 
156
165
  invalid_properties
@@ -165,7 +174,7 @@ module OryHydraClient
165
174
  return false if @issued_at.nil?
166
175
  return false if @methods.nil?
167
176
  return false if @request_url.nil?
168
- return false if @update_successful.nil?
177
+ return false if @state.nil?
169
178
  true
170
179
  end
171
180
 
@@ -179,9 +188,10 @@ module OryHydraClient
179
188
  id == o.id &&
180
189
  identity == o.identity &&
181
190
  issued_at == o.issued_at &&
191
+ messages == o.messages &&
182
192
  methods == o.methods &&
183
193
  request_url == o.request_url &&
184
- update_successful == o.update_successful
194
+ state == o.state
185
195
  end
186
196
 
187
197
  # @see the `==` method
@@ -193,7 +203,7 @@ module OryHydraClient
193
203
  # Calculates hash code according to all attributes.
194
204
  # @return [Integer] Hash code
195
205
  def hash
196
- [active, expires_at, id, identity, issued_at, methods, request_url, update_successful].hash
206
+ [active, expires_at, id, identity, issued_at, messages, methods, request_url, state].hash
197
207
  end
198
208
 
199
209
  # Builds the object from hash
@@ -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,226 @@
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
+ # The Response for Settings Flows via API
17
+ class SettingsViaApiResponse
18
+ attr_accessor :flow
19
+
20
+ attr_accessor :identity
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'flow' => :'flow',
26
+ :'identity' => :'identity'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'flow' => :'SettingsFlow',
34
+ :'identity' => :'Identity'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::SettingsViaApiResponse` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::SettingsViaApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'flow')
60
+ self.flow = attributes[:'flow']
61
+ end
62
+
63
+ if attributes.key?(:'identity')
64
+ self.identity = attributes[:'identity']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @flow.nil?
73
+ invalid_properties.push('invalid value for "flow", flow cannot be nil.')
74
+ end
75
+
76
+ if @identity.nil?
77
+ invalid_properties.push('invalid value for "identity", identity cannot be nil.')
78
+ end
79
+
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ return false if @flow.nil?
87
+ return false if @identity.nil?
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
+ flow == o.flow &&
97
+ identity == o.identity
98
+ end
99
+
100
+ # @see the `==` method
101
+ # @param [Object] Object to be compared
102
+ def eql?(o)
103
+ self == o
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Integer] Hash code
108
+ def hash
109
+ [flow, identity].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def self.build_from_hash(attributes)
116
+ new.build_from_hash(attributes)
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.openapi_types.each_pair do |key, type|
125
+ if type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ OryHydraClient.const_get(type).build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,222 @@
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 UpdateIdentity
17
+ # SchemaID is the ID of the JSON Schema to be used for validating the identity's traits. If set will update the Identity's SchemaID.
18
+ attr_accessor :schema_id
19
+
20
+ # Traits represent an identity's traits. The identity is able to create, modify, and delete traits in a self-service manner. The input will always be validated against the JSON Schema defined in `schema_id`.
21
+ attr_accessor :traits
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'schema_id' => :'schema_id',
27
+ :'traits' => :'traits'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'schema_id' => :'String',
35
+ :'traits' => :'Object'
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::UpdateIdentity` 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::UpdateIdentity`. 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?(:'schema_id')
61
+ self.schema_id = attributes[:'schema_id']
62
+ end
63
+
64
+ if attributes.key?(:'traits')
65
+ self.traits = attributes[:'traits']
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
+ if @traits.nil?
74
+ invalid_properties.push('invalid value for "traits", traits cannot be nil.')
75
+ end
76
+
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ return false if @traits.nil?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ schema_id == o.schema_id &&
93
+ traits == o.traits
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [schema_id, traits].hash
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 self.build_from_hash(attributes)
112
+ new.build_from_hash(attributes)
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :DateTime
142
+ DateTime.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :Boolean
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ OryHydraClient.const_get(type).build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end