swagger_aem 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -17
- data/README.md +25 -5
- data/docs/ConsoleApi.md +110 -0
- data/docs/CustomApi.md +4 -10
- data/docs/KeystoreChainItems.md +12 -0
- data/docs/KeystoreInfo.md +9 -0
- data/docs/KeystoreItems.md +12 -0
- data/docs/SamlConfigurationInfo.md +13 -0
- data/docs/SamlConfigurationProperties.md +31 -0
- data/docs/SamlConfigurationPropertyItemsArray.md +13 -0
- data/docs/SamlConfigurationPropertyItemsBoolean.md +13 -0
- data/docs/SamlConfigurationPropertyItemsLong.md +13 -0
- data/docs/SamlConfigurationPropertyItemsString.md +13 -0
- data/docs/SlingApi.md +550 -21
- data/docs/TruststoreInfo.md +9 -0
- data/docs/TruststoreItems.md +14 -0
- data/lib/swagger_aem.rb +12 -1
- data/lib/swagger_aem/api/console_api.rb +138 -1
- data/lib/swagger_aem/api/cq_api.rb +1 -1
- data/lib/swagger_aem/api/crx_api.rb +1 -1
- data/lib/swagger_aem/api/custom_api.rb +9 -21
- data/lib/swagger_aem/api/sling_api.rb +641 -41
- data/lib/swagger_aem/api_client.rb +1 -1
- data/lib/swagger_aem/api_error.rb +1 -1
- data/lib/swagger_aem/configuration.rb +1 -1
- data/lib/swagger_aem/models/install_status.rb +1 -1
- data/lib/swagger_aem/models/install_status_status.rb +1 -1
- data/lib/swagger_aem/models/keystore_chain_items.rb +229 -0
- data/lib/swagger_aem/models/keystore_info.rb +200 -0
- data/lib/swagger_aem/models/keystore_items.rb +230 -0
- data/lib/swagger_aem/models/saml_configuration_info.rb +238 -0
- data/lib/swagger_aem/models/saml_configuration_properties.rb +467 -0
- data/lib/swagger_aem/models/saml_configuration_property_items_array.rb +241 -0
- data/lib/swagger_aem/models/saml_configuration_property_items_boolean.rb +239 -0
- data/lib/swagger_aem/models/saml_configuration_property_items_long.rb +239 -0
- data/lib/swagger_aem/models/saml_configuration_property_items_string.rb +239 -0
- data/lib/swagger_aem/models/truststore_info.rb +200 -0
- data/lib/swagger_aem/models/truststore_items.rb +248 -0
- data/lib/swagger_aem/version.rb +2 -2
- data/spec/api/console_api_spec.rb +42 -1
- data/spec/api/cq_api_spec.rb +1 -1
- data/spec/api/crx_api_spec.rb +1 -1
- data/spec/api/custom_api_spec.rb +1 -3
- data/spec/api/sling_api_spec.rb +164 -5
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/install_status_spec.rb +1 -1
- data/spec/models/install_status_status_spec.rb +1 -1
- data/spec/models/keystore_chain_items_spec.rb +66 -0
- data/spec/models/keystore_info_spec.rb +48 -0
- data/spec/models/keystore_items_spec.rb +66 -0
- data/spec/models/saml_configuration_info_spec.rb +72 -0
- data/spec/models/saml_configuration_properties_spec.rb +180 -0
- data/spec/models/saml_configuration_property_items_array_spec.rb +72 -0
- data/spec/models/saml_configuration_property_items_boolean_spec.rb +72 -0
- data/spec/models/saml_configuration_property_items_long_spec.rb +72 -0
- data/spec/models/saml_configuration_property_items_string_spec.rb +72 -0
- data/spec/models/truststore_info_spec.rb +48 -0
- data/spec/models/truststore_items_spec.rb +78 -0
- data/spec/spec_helper.rb +1 -1
- data/swagger_aem.gemspec +2 -2
- metadata +47 -3
@@ -0,0 +1,467 @@
|
|
1
|
+
=begin
|
2
|
+
#Adobe Experience Manager (AEM) API
|
3
|
+
|
4
|
+
#Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.1.0
|
7
|
+
Contact: opensource@shinesolutions.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SwaggerAemClient
|
16
|
+
|
17
|
+
class SamlConfigurationProperties
|
18
|
+
# Repository path for which this authentication handler should be used by Sling. If this is empty, the authentication handler will be disabled.
|
19
|
+
attr_accessor :path
|
20
|
+
|
21
|
+
# OSGi Framework Service Ranking value to indicate the order in which to call this service. This is an int value where higher values designate higher precedence. Default value is 0.
|
22
|
+
attr_accessor :service_ranking
|
23
|
+
|
24
|
+
# URL of the IDP where the SAML Authentication Request should be sent to. If this property is empty the authentication handler is disabled. (idpUrl)
|
25
|
+
attr_accessor :idp_url
|
26
|
+
|
27
|
+
# The alias of the IdP's certificate in the global truststore. If this property is empty the authentication handler is disabled.
|
28
|
+
attr_accessor :idp_cert_alias
|
29
|
+
|
30
|
+
# Use an HTTP Redirect to the IDP URL instead of sending an AuthnRequest-message to request credentials. Use this for IDP initiated authentication.
|
31
|
+
attr_accessor :idp_http_redirect
|
32
|
+
|
33
|
+
# ID which uniquely identifies this service provider with the identity provider. If this property is empty the authentication handler is disabled.
|
34
|
+
attr_accessor :service_provider_entity_id
|
35
|
+
|
36
|
+
# The (optional) AssertionConsumerServiceURL attribute of an Authn request specifies the location to which a <Response> message MUST be sent to the requester.
|
37
|
+
attr_accessor :assertion_consumer_service_url
|
38
|
+
|
39
|
+
# The alias of the SP's private key in the key-store of the 'authentication-service' system user. If this property is empty the handler will not be able to sign or decrypt messages.
|
40
|
+
attr_accessor :sp_private_key_alias
|
41
|
+
|
42
|
+
# The password of the key-store of the 'authentication-service' system user.
|
43
|
+
attr_accessor :key_store_password
|
44
|
+
|
45
|
+
# The default location to redirect to after successful authentication.
|
46
|
+
attr_accessor :default_redirect_url
|
47
|
+
|
48
|
+
# The name of the attribute containing the user ID used to authenticate and create the user in the CRX repository. Leave empty to use the Subject:NameId.
|
49
|
+
attr_accessor :user_id_attribute
|
50
|
+
|
51
|
+
# Whether or not this authentication handler expects encrypted SAML assertions. If this is enabled the SP's private key must be provided in the key-store of the 'authentication-service' system user (see SP Private Key Alias above).
|
52
|
+
attr_accessor :use_encryption
|
53
|
+
|
54
|
+
# Whether or not to autocreate nonexisting users in the repository.
|
55
|
+
attr_accessor :create_user
|
56
|
+
|
57
|
+
# Whether or not a user should be automatically added to CRX groups after successful authentication.
|
58
|
+
attr_accessor :add_group_memberships
|
59
|
+
|
60
|
+
# The name of the attribute containing a list of CRX groups this user should be added to.
|
61
|
+
attr_accessor :group_membership_attribute
|
62
|
+
|
63
|
+
# A list of default CRX groups users are added to after successful authentication.
|
64
|
+
attr_accessor :default_groups
|
65
|
+
|
66
|
+
# The value of the NameIDPolicy format parameter to send in the AuthnRequest message.
|
67
|
+
attr_accessor :name_id_format
|
68
|
+
|
69
|
+
# A list of attribute mappings (in the format \\attributename=path/relative/to/user/node\\) which should be stored in the repository on user-synchronization.
|
70
|
+
attr_accessor :synchronize_attributes
|
71
|
+
|
72
|
+
# Whether or not logout (dropCredentials) requests will be processed by this handler.
|
73
|
+
attr_accessor :handle_logout
|
74
|
+
|
75
|
+
# URL of the IDP where the SAML Logout Request should be sent to. If this property is empty the authentication handler won't handle logouts.
|
76
|
+
attr_accessor :logout_url
|
77
|
+
|
78
|
+
# Time tolerance in seconds to compensate clock skew between IDP and SP when validating Assertions.
|
79
|
+
attr_accessor :clock_tolerance
|
80
|
+
|
81
|
+
# The digest algorithm to use when signing a SAML message.
|
82
|
+
attr_accessor :digest_method
|
83
|
+
|
84
|
+
# The signature algorithm to use when signing a SAML message.
|
85
|
+
attr_accessor :signature_method
|
86
|
+
|
87
|
+
# User intermediate path to store created users.
|
88
|
+
attr_accessor :user_intermediate_path
|
89
|
+
|
90
|
+
|
91
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
92
|
+
def self.attribute_map
|
93
|
+
{
|
94
|
+
:'path' => :'path',
|
95
|
+
:'service_ranking' => :'service.ranking',
|
96
|
+
:'idp_url' => :'idpUrl',
|
97
|
+
:'idp_cert_alias' => :'idpCertAlias',
|
98
|
+
:'idp_http_redirect' => :'idpHttpRedirect',
|
99
|
+
:'service_provider_entity_id' => :'serviceProviderEntityId',
|
100
|
+
:'assertion_consumer_service_url' => :'assertionConsumerServiceURL',
|
101
|
+
:'sp_private_key_alias' => :'spPrivateKeyAlias',
|
102
|
+
:'key_store_password' => :'keyStorePassword',
|
103
|
+
:'default_redirect_url' => :'defaultRedirectUrl',
|
104
|
+
:'user_id_attribute' => :'userIDAttribute',
|
105
|
+
:'use_encryption' => :'useEncryption',
|
106
|
+
:'create_user' => :'createUser',
|
107
|
+
:'add_group_memberships' => :'addGroupMemberships',
|
108
|
+
:'group_membership_attribute' => :'groupMembershipAttribute',
|
109
|
+
:'default_groups' => :'defaultGroups',
|
110
|
+
:'name_id_format' => :'nameIdFormat',
|
111
|
+
:'synchronize_attributes' => :'synchronizeAttributes',
|
112
|
+
:'handle_logout' => :'handleLogout',
|
113
|
+
:'logout_url' => :'logoutUrl',
|
114
|
+
:'clock_tolerance' => :'clockTolerance',
|
115
|
+
:'digest_method' => :'digestMethod',
|
116
|
+
:'signature_method' => :'signatureMethod',
|
117
|
+
:'user_intermediate_path' => :'userIntermediatePath'
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
# Attribute type mapping.
|
122
|
+
def self.swagger_types
|
123
|
+
{
|
124
|
+
:'path' => :'Array<SamlConfigurationPropertyItemsArray>',
|
125
|
+
:'service_ranking' => :'Array<SamlConfigurationPropertyItemsLong>',
|
126
|
+
:'idp_url' => :'Array<SamlConfigurationPropertyItemsString>',
|
127
|
+
:'idp_cert_alias' => :'Array<SamlConfigurationPropertyItemsString>',
|
128
|
+
:'idp_http_redirect' => :'Array<SamlConfigurationPropertyItemsBoolean>',
|
129
|
+
:'service_provider_entity_id' => :'Array<SamlConfigurationPropertyItemsString>',
|
130
|
+
:'assertion_consumer_service_url' => :'Array<SamlConfigurationPropertyItemsString>',
|
131
|
+
:'sp_private_key_alias' => :'Array<SamlConfigurationPropertyItemsString>',
|
132
|
+
:'key_store_password' => :'Array<SamlConfigurationPropertyItemsString>',
|
133
|
+
:'default_redirect_url' => :'Array<SamlConfigurationPropertyItemsString>',
|
134
|
+
:'user_id_attribute' => :'Array<SamlConfigurationPropertyItemsString>',
|
135
|
+
:'use_encryption' => :'Array<SamlConfigurationPropertyItemsBoolean>',
|
136
|
+
:'create_user' => :'Array<SamlConfigurationPropertyItemsBoolean>',
|
137
|
+
:'add_group_memberships' => :'Array<SamlConfigurationPropertyItemsBoolean>',
|
138
|
+
:'group_membership_attribute' => :'Array<SamlConfigurationPropertyItemsString>',
|
139
|
+
:'default_groups' => :'Array<SamlConfigurationPropertyItemsArray>',
|
140
|
+
:'name_id_format' => :'Array<SamlConfigurationPropertyItemsString>',
|
141
|
+
:'synchronize_attributes' => :'Array<SamlConfigurationPropertyItemsArray>',
|
142
|
+
:'handle_logout' => :'Array<SamlConfigurationPropertyItemsBoolean>',
|
143
|
+
:'logout_url' => :'Array<SamlConfigurationPropertyItemsString>',
|
144
|
+
:'clock_tolerance' => :'Array<SamlConfigurationPropertyItemsLong>',
|
145
|
+
:'digest_method' => :'Array<SamlConfigurationPropertyItemsString>',
|
146
|
+
:'signature_method' => :'Array<SamlConfigurationPropertyItemsString>',
|
147
|
+
:'user_intermediate_path' => :'Array<SamlConfigurationPropertyItemsString>'
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
151
|
+
# Initializes the object
|
152
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
153
|
+
def initialize(attributes = {})
|
154
|
+
return unless attributes.is_a?(Hash)
|
155
|
+
|
156
|
+
# convert string to symbol for hash key
|
157
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
158
|
+
|
159
|
+
if attributes.has_key?(:'path')
|
160
|
+
if (value = attributes[:'path']).is_a?(Array)
|
161
|
+
self.path = value
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'service.ranking')
|
166
|
+
if (value = attributes[:'service.ranking']).is_a?(Array)
|
167
|
+
self.service_ranking = value
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.has_key?(:'idpUrl')
|
172
|
+
if (value = attributes[:'idpUrl']).is_a?(Array)
|
173
|
+
self.idp_url = value
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.has_key?(:'idpCertAlias')
|
178
|
+
if (value = attributes[:'idpCertAlias']).is_a?(Array)
|
179
|
+
self.idp_cert_alias = value
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.has_key?(:'idpHttpRedirect')
|
184
|
+
if (value = attributes[:'idpHttpRedirect']).is_a?(Array)
|
185
|
+
self.idp_http_redirect = value
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'serviceProviderEntityId')
|
190
|
+
if (value = attributes[:'serviceProviderEntityId']).is_a?(Array)
|
191
|
+
self.service_provider_entity_id = value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.has_key?(:'assertionConsumerServiceURL')
|
196
|
+
if (value = attributes[:'assertionConsumerServiceURL']).is_a?(Array)
|
197
|
+
self.assertion_consumer_service_url = value
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'spPrivateKeyAlias')
|
202
|
+
if (value = attributes[:'spPrivateKeyAlias']).is_a?(Array)
|
203
|
+
self.sp_private_key_alias = value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.has_key?(:'keyStorePassword')
|
208
|
+
if (value = attributes[:'keyStorePassword']).is_a?(Array)
|
209
|
+
self.key_store_password = value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
if attributes.has_key?(:'defaultRedirectUrl')
|
214
|
+
if (value = attributes[:'defaultRedirectUrl']).is_a?(Array)
|
215
|
+
self.default_redirect_url = value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.has_key?(:'userIDAttribute')
|
220
|
+
if (value = attributes[:'userIDAttribute']).is_a?(Array)
|
221
|
+
self.user_id_attribute = value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.has_key?(:'useEncryption')
|
226
|
+
if (value = attributes[:'useEncryption']).is_a?(Array)
|
227
|
+
self.use_encryption = value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
if attributes.has_key?(:'createUser')
|
232
|
+
if (value = attributes[:'createUser']).is_a?(Array)
|
233
|
+
self.create_user = value
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.has_key?(:'addGroupMemberships')
|
238
|
+
if (value = attributes[:'addGroupMemberships']).is_a?(Array)
|
239
|
+
self.add_group_memberships = value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
if attributes.has_key?(:'groupMembershipAttribute')
|
244
|
+
if (value = attributes[:'groupMembershipAttribute']).is_a?(Array)
|
245
|
+
self.group_membership_attribute = value
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.has_key?(:'defaultGroups')
|
250
|
+
if (value = attributes[:'defaultGroups']).is_a?(Array)
|
251
|
+
self.default_groups = value
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
if attributes.has_key?(:'nameIdFormat')
|
256
|
+
if (value = attributes[:'nameIdFormat']).is_a?(Array)
|
257
|
+
self.name_id_format = value
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
if attributes.has_key?(:'synchronizeAttributes')
|
262
|
+
if (value = attributes[:'synchronizeAttributes']).is_a?(Array)
|
263
|
+
self.synchronize_attributes = value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
if attributes.has_key?(:'handleLogout')
|
268
|
+
if (value = attributes[:'handleLogout']).is_a?(Array)
|
269
|
+
self.handle_logout = value
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
if attributes.has_key?(:'logoutUrl')
|
274
|
+
if (value = attributes[:'logoutUrl']).is_a?(Array)
|
275
|
+
self.logout_url = value
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
if attributes.has_key?(:'clockTolerance')
|
280
|
+
if (value = attributes[:'clockTolerance']).is_a?(Array)
|
281
|
+
self.clock_tolerance = value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
if attributes.has_key?(:'digestMethod')
|
286
|
+
if (value = attributes[:'digestMethod']).is_a?(Array)
|
287
|
+
self.digest_method = value
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
if attributes.has_key?(:'signatureMethod')
|
292
|
+
if (value = attributes[:'signatureMethod']).is_a?(Array)
|
293
|
+
self.signature_method = value
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
if attributes.has_key?(:'userIntermediatePath')
|
298
|
+
if (value = attributes[:'userIntermediatePath']).is_a?(Array)
|
299
|
+
self.user_intermediate_path = value
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
end
|
304
|
+
|
305
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
306
|
+
# @return Array for valid properties with the reasons
|
307
|
+
def list_invalid_properties
|
308
|
+
invalid_properties = Array.new
|
309
|
+
return invalid_properties
|
310
|
+
end
|
311
|
+
|
312
|
+
# Check to see if the all the properties in the model are valid
|
313
|
+
# @return true if the model is valid
|
314
|
+
def valid?
|
315
|
+
return true
|
316
|
+
end
|
317
|
+
|
318
|
+
# Checks equality by comparing each attribute.
|
319
|
+
# @param [Object] Object to be compared
|
320
|
+
def ==(o)
|
321
|
+
return true if self.equal?(o)
|
322
|
+
self.class == o.class &&
|
323
|
+
path == o.path &&
|
324
|
+
service_ranking == o.service_ranking &&
|
325
|
+
idp_url == o.idp_url &&
|
326
|
+
idp_cert_alias == o.idp_cert_alias &&
|
327
|
+
idp_http_redirect == o.idp_http_redirect &&
|
328
|
+
service_provider_entity_id == o.service_provider_entity_id &&
|
329
|
+
assertion_consumer_service_url == o.assertion_consumer_service_url &&
|
330
|
+
sp_private_key_alias == o.sp_private_key_alias &&
|
331
|
+
key_store_password == o.key_store_password &&
|
332
|
+
default_redirect_url == o.default_redirect_url &&
|
333
|
+
user_id_attribute == o.user_id_attribute &&
|
334
|
+
use_encryption == o.use_encryption &&
|
335
|
+
create_user == o.create_user &&
|
336
|
+
add_group_memberships == o.add_group_memberships &&
|
337
|
+
group_membership_attribute == o.group_membership_attribute &&
|
338
|
+
default_groups == o.default_groups &&
|
339
|
+
name_id_format == o.name_id_format &&
|
340
|
+
synchronize_attributes == o.synchronize_attributes &&
|
341
|
+
handle_logout == o.handle_logout &&
|
342
|
+
logout_url == o.logout_url &&
|
343
|
+
clock_tolerance == o.clock_tolerance &&
|
344
|
+
digest_method == o.digest_method &&
|
345
|
+
signature_method == o.signature_method &&
|
346
|
+
user_intermediate_path == o.user_intermediate_path
|
347
|
+
end
|
348
|
+
|
349
|
+
# @see the `==` method
|
350
|
+
# @param [Object] Object to be compared
|
351
|
+
def eql?(o)
|
352
|
+
self == o
|
353
|
+
end
|
354
|
+
|
355
|
+
# Calculates hash code according to all attributes.
|
356
|
+
# @return [Fixnum] Hash code
|
357
|
+
def hash
|
358
|
+
[path, service_ranking, idp_url, idp_cert_alias, idp_http_redirect, service_provider_entity_id, assertion_consumer_service_url, sp_private_key_alias, key_store_password, default_redirect_url, user_id_attribute, use_encryption, create_user, add_group_memberships, group_membership_attribute, default_groups, name_id_format, synchronize_attributes, handle_logout, logout_url, clock_tolerance, digest_method, signature_method, user_intermediate_path].hash
|
359
|
+
end
|
360
|
+
|
361
|
+
# Builds the object from hash
|
362
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
363
|
+
# @return [Object] Returns the model itself
|
364
|
+
def build_from_hash(attributes)
|
365
|
+
return nil unless attributes.is_a?(Hash)
|
366
|
+
self.class.swagger_types.each_pair do |key, type|
|
367
|
+
if type =~ /\AArray<(.*)>/i
|
368
|
+
# check to ensure the input is an array given that the the attribute
|
369
|
+
# is documented as an array but the input is not
|
370
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
371
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
372
|
+
end
|
373
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
374
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
375
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
376
|
+
end
|
377
|
+
|
378
|
+
self
|
379
|
+
end
|
380
|
+
|
381
|
+
# Deserializes the data based on type
|
382
|
+
# @param string type Data type
|
383
|
+
# @param string value Value to be deserialized
|
384
|
+
# @return [Object] Deserialized data
|
385
|
+
def _deserialize(type, value)
|
386
|
+
case type.to_sym
|
387
|
+
when :DateTime
|
388
|
+
DateTime.parse(value)
|
389
|
+
when :Date
|
390
|
+
Date.parse(value)
|
391
|
+
when :String
|
392
|
+
value.to_s
|
393
|
+
when :Integer
|
394
|
+
value.to_i
|
395
|
+
when :Float
|
396
|
+
value.to_f
|
397
|
+
when :BOOLEAN
|
398
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
399
|
+
true
|
400
|
+
else
|
401
|
+
false
|
402
|
+
end
|
403
|
+
when :Object
|
404
|
+
# generic object (usually a Hash), return directly
|
405
|
+
value
|
406
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
407
|
+
inner_type = Regexp.last_match[:inner_type]
|
408
|
+
value.map { |v| _deserialize(inner_type, v) }
|
409
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
410
|
+
k_type = Regexp.last_match[:k_type]
|
411
|
+
v_type = Regexp.last_match[:v_type]
|
412
|
+
{}.tap do |hash|
|
413
|
+
value.each do |k, v|
|
414
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
415
|
+
end
|
416
|
+
end
|
417
|
+
else # model
|
418
|
+
temp_model = SwaggerAemClient.const_get(type).new
|
419
|
+
temp_model.build_from_hash(value)
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
# Returns the string representation of the object
|
424
|
+
# @return [String] String presentation of the object
|
425
|
+
def to_s
|
426
|
+
to_hash.to_s
|
427
|
+
end
|
428
|
+
|
429
|
+
# to_body is an alias to to_hash (backward compatibility)
|
430
|
+
# @return [Hash] Returns the object in the form of hash
|
431
|
+
def to_body
|
432
|
+
to_hash
|
433
|
+
end
|
434
|
+
|
435
|
+
# Returns the object in the form of hash
|
436
|
+
# @return [Hash] Returns the object in the form of hash
|
437
|
+
def to_hash
|
438
|
+
hash = {}
|
439
|
+
self.class.attribute_map.each_pair do |attr, param|
|
440
|
+
value = self.send(attr)
|
441
|
+
next if value.nil?
|
442
|
+
hash[param] = _to_hash(value)
|
443
|
+
end
|
444
|
+
hash
|
445
|
+
end
|
446
|
+
|
447
|
+
# Outputs non-array value in the form of hash
|
448
|
+
# For object, use to_hash. Otherwise, just return the value
|
449
|
+
# @param [Object] value Any valid value
|
450
|
+
# @return [Hash] Returns the value in the form of hash
|
451
|
+
def _to_hash(value)
|
452
|
+
if value.is_a?(Array)
|
453
|
+
value.compact.map{ |v| _to_hash(v) }
|
454
|
+
elsif value.is_a?(Hash)
|
455
|
+
{}.tap do |hash|
|
456
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
457
|
+
end
|
458
|
+
elsif value.respond_to? :to_hash
|
459
|
+
value.to_hash
|
460
|
+
else
|
461
|
+
value
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
end
|
466
|
+
|
467
|
+
end
|