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 'GUID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@guid = v
when 'Username'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@username = v
when 'Classification'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@classification = v
when 'Status'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@status = v
when 'StartTime'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@start_time = v
when 'EndTime'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@end_time = v
when 'RetryCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@retry_count = v
when 'SourceGUID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@source_guid = v
when 'DestinationGUID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@destination_guid = v
when 'DeviceID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@device_id = v
when 'SnapshotID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@snapshot_id = v
when 'BackupRuleGUID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@backup_rule_guid = v
when 'ClientVersion'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@client_version = v
when 'TotalDirectories'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_directories = v
when 'TotalFiles'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_files = v
when 'TotalSize'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_size = v
when 'TotalChunks'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_chunks = v
when 'UploadSize'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@upload_size = v
when 'DownloadSize'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@download_size = v
when 'TotalVmCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_vm_count = v
when 'TotalMailsCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_mails_count = v
when 'TotalSitesCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_sites_count = v
when 'TotalAccountsCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_accounts_count = v
when 'TotalLicensedMailsCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_licensed_mails_count = v
when 'TotalUnlicensedMailsCount'
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
@total_unlicensed_mails_count = v
when 'ConflictingJobID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@conflicting_job_id = v
when 'CancellationID'
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
@cancellation_id = v
when 'Progress'
@progress = Comet::BackupJobProgress.new
@progress.from_hash(v)
when 'DestinationSizeStart'
@destination_size_start = Comet::SizeMeasurement.new
@destination_size_start.from_hash(v)
when 'DestinationSizeEnd'
@destination_size_end = Comet::SizeMeasurement.new
@destination_size_end.from_hash(v)
else
@unknown_json_fields[k] = v
end
end
end