def from_hash(obj)
Parameters:
-
obj
(Hash
)
-- The complete object as a Ruby hash
def from_hash(obj)
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
obj.each do |k, v|
case k
when 'Username'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@username = v
when 'AccountName'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@account_name = v
when 'LocalTimezone'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@local_timezone = v
when 'LanguageCode'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@language_code = v
when 'OrganizationID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@organization_id = v
when 'Emails'
if v.nil?
@emails = []
else
@emails = Array.new(v.length)
v.each_with_index do |v1, i1|
raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String
@emails[i1] = v1
end
end
when 'OverrideEmailSettings'
@override_email_settings = {}
if v.nil?
@override_email_settings = {}
else
v.each do |k1, v1|
@override_email_settings[k1] = Comet::UserCustomEmailSettings.new
@override_email_settings[k1].from_hash(v1)
end
end
when 'SendEmailReports'
@send_email_reports = v
when 'Destinations'
@destinations = {}
if v.nil?
@destinations = {}
else
v.each do |k1, v1|
@destinations[k1] = Comet::DestinationConfig.new
@destinations[k1].from_hash(v1)
end
end
when 'Sources'
@sources = {}
if v.nil?
@sources = {}
else
v.each do |k1, v1|
@sources[k1] = Comet::SourceConfig.new
@sources[k1].from_hash(v1)
end
end
when 'BackupRules'
@backup_rules = {}
if v.nil?
@backup_rules = {}
else
v.each do |k1, v1|
@backup_rules[k1] = Comet::BackupRuleConfig.new
@backup_rules[k1].from_hash(v1)
end
end
when 'Devices'
@devices = {}
if v.nil?
@devices = {}
else
v.each do |k1, v1|
@devices[k1] = Comet::DeviceConfig.new
@devices[k1].from_hash(v1)
end
end
when 'IsSuspended'
@is_suspended = v
when 'LastSuspended'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@last_suspended = v
when 'AllProtectedItemsQuotaEnabled'
@all_protected_items_quota_enabled = v
when 'AllProtectedItemsQuotaBytes'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@all_protected_items_quota_bytes = v
when 'MaximumDevices'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@maximum_devices = v
when 'QuotaOffice365ProtectedAccounts'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@quota_office_365protected_accounts = v
when 'PolicyID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@policy_id = v
when 'Policy'
@policy = Comet::UserPolicy.new
@policy.from_hash(v)
when 'PasswordFormat'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@password_format = v
when 'PasswordHash'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@password_hash = v
when 'PasswordRecovery'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@password_recovery = v
when 'AllowPasswordLogin'
@allow_password_login = v
when 'AllowPasswordAndTOTPLogin'
@allow_password_and_totplogin = v
when 'TOTPKeyEncryptionFormat'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@totpkey_encryption_format = v
when 'TOTPKey'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@totpkey = v
when 'RequirePasswordChange'
@require_password_change = v
when 'CreateTime'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@create_time = v
when 'CreationGUID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@creation_guid = v
when 'ServerConfig'
@server_config = Comet::UserServerConfig.new
@server_config.from_hash(v)
else
@unknown_json_fields[k] = v
end
end
end