class Comet::BackupJobDetail

BackupJobDetail is a typed class wrapper around the underlying Comet Server API data structure.

Attributes

cancellation_id[RW]

@type [String] cancellation_id

classification[RW]

@type [Number] classification

client_version[RW]

@type [String] client_version

destination_guid[RW]

@type [String] destination_guid

device_id[RW]

@type [String] device_id

download_size[RW]

@type [Number] download_size

end_time[RW]

@type [Number] end_time

guid[RW]

@type [String] guid

progress[RW]

@type [Comet::BackupJobProgress] progress

snapshot_id[RW]

@type [String] snapshot_id

source_guid[RW]

@type [String] source_guid

start_time[RW]

@type [Number] start_time

status[RW]

@type [Number] status

total_accounts_count[RW]

@type [Number] total_accounts_count

total_chunks[RW]

@type [Number] total_chunks

total_directories[RW]

@type [Number] total_directories

total_files[RW]

@type [Number] total_files

total_mails_count[RW]

@type [Number] total_mails_count

total_sites_count[RW]

@type [Number] total_sites_count

total_size[RW]

@type [Number] total_size

unknown_json_fields[RW]

@type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations

upload_size[RW]

@type [Number] upload_size

username[RW]

@type [String] username

Public Class Methods

new() click to toggle source
# File lib/comet/models/backup_job_detail.rb, line 86
def initialize
  clear
end

Public Instance Methods

clear() click to toggle source
# File lib/comet/models/backup_job_detail.rb, line 90
def clear
  @guid = ''
  @username = ''
  @classification = 0
  @status = 0
  @start_time = 0
  @end_time = 0
  @source_guid = ''
  @destination_guid = ''
  @device_id = ''
  @snapshot_id = ''
  @client_version = ''
  @total_directories = 0
  @total_files = 0
  @total_size = 0
  @total_chunks = 0
  @upload_size = 0
  @download_size = 0
  @total_mails_count = 0
  @total_sites_count = 0
  @total_accounts_count = 0
  @cancellation_id = ''
  @progress = Comet::BackupJobProgress.new
  @unknown_json_fields = {}
end
from_hash(obj) click to toggle source

@param [Hash] obj The complete object as a Ruby hash

# File lib/comet/models/backup_job_detail.rb, line 124
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 '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 '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 '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 '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)
    else
      @unknown_json_fields[k] = v
    end
  end
end
from_json(json_string) click to toggle source

@param [String] json_string The complete object in JSON format

# File lib/comet/models/backup_job_detail.rb, line 117
def from_json(json_string)
  raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String

  from_hash(JSON.parse(json_string))
end
to_h() click to toggle source

@return [Hash] The complete object as a Ruby hash

# File lib/comet/models/backup_job_detail.rb, line 266
def to_h
  to_hash
end
to_hash() click to toggle source

@return [Hash] The complete object as a Ruby hash

# File lib/comet/models/backup_job_detail.rb, line 223
def to_hash
  ret = {}
  ret['GUID'] = @guid
  ret['Username'] = @username
  ret['Classification'] = @classification
  ret['Status'] = @status
  ret['StartTime'] = @start_time
  ret['EndTime'] = @end_time
  ret['SourceGUID'] = @source_guid
  ret['DestinationGUID'] = @destination_guid
  ret['DeviceID'] = @device_id
  unless @snapshot_id.nil?
    ret['SnapshotID'] = @snapshot_id
  end
  ret['ClientVersion'] = @client_version
  ret['TotalDirectories'] = @total_directories
  ret['TotalFiles'] = @total_files
  ret['TotalSize'] = @total_size
  ret['TotalChunks'] = @total_chunks
  ret['UploadSize'] = @upload_size
  ret['DownloadSize'] = @download_size
  unless @total_mails_count.nil?
    ret['TotalMailsCount'] = @total_mails_count
  end
  unless @total_sites_count.nil?
    ret['TotalSitesCount'] = @total_sites_count
  end
  unless @total_accounts_count.nil?
    ret['TotalAccountsCount'] = @total_accounts_count
  end
  unless @cancellation_id.nil?
    ret['CancellationID'] = @cancellation_id
  end
  unless @progress.nil?
    ret['Progress'] = @progress
  end
  @unknown_json_fields.each do |k, v|
    ret[k] = v
  end
  ret
end
to_json(options = {}) click to toggle source

@return [String] The complete object as a JSON string

# File lib/comet/models/backup_job_detail.rb, line 271
def to_json(options = {})
  to_hash.to_json(options)
end