Class: Zm::Client::Backup

Inherits:
Zm::Client::Base::AdminObject show all
Defined in:
lib/zm/client/backup/backup.rb

Constant Summary collapse

INSTANCE_VARIABLE_KEYS =
i[label type aborted start end minRedoSeq maxRedoSeq live accounts]

Instance Attribute Summary

Attributes inherited from Zm::Client::Base::Object

#grantee_type, #id, #parent, #token

Instance Method Summary collapse

Methods inherited from Zm::Client::Base::AdminObject

#soap_account_connector, #soap_admin_connector, #to_h

Methods inherited from Zm::Client::Base::Object

#arrow_name, #clone, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #initialize, #instance_variables_array, #instance_variables_hash, #logger, #recorded?, #save!, #use_builder?

Constructor Details

This class inherits a constructor from Zm::Client::Base::Object

Instance Method Details

#all_instance_variable_keysObject



16
17
18
# File 'lib/zm/client/backup/backup.rb', line 16

def all_instance_variable_keys
  INSTANCE_VARIABLE_KEYS
end

#end_atObject



36
37
38
39
40
# File 'lib/zm/client/backup/backup.rb', line 36

def end_at
  @end_at ||= Time.at(@end / 1000)
rescue StandardError => e
  nil
end

#full?Boolean



42
43
44
# File 'lib/zm/client/backup/backup.rb', line 42

def full?
  @type == Zm::Client::BackupTypes::FULL
end

#incremental?Boolean



46
47
48
# File 'lib/zm/client/backup/backup.rb', line 46

def incremental?
  @type == Zm::Client::BackupTypes::INCREMENTAL
end

#init_from_json(json) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/zm/client/backup/backup.rb', line 50

def init_from_json(json)
  @label = json[:label]
  @type = json[:type]
  @aborted = json[:aborted]
  @start = json[:start].to_i
  @end = json[:end].to_i
  @minRedoSeq = json[:minRedoSeq]
  @maxRedoSeq = json[:maxRedoSeq]
  @live = json[:live]
  @accounts = json[:accounts]
end

#serverObject



12
13
14
# File 'lib/zm/client/backup/backup.rb', line 12

def server
  parent
end

#start_atObject



30
31
32
33
34
# File 'lib/zm/client/backup/backup.rb', line 30

def start_at
  @start_at ||= Time.at(@start / 1000)
rescue StandardError => e
  nil
end

#to_sObject

def to_h

hashmap = Hash[INSTANCE_VARIABLE_KEYS.map { |key| [key, instance_variable_get(arrow_name(key))] }]
hashmap.delete_if { |_, v| v.nil? }
hashmap

end



26
27
28
# File 'lib/zm/client/backup/backup.rb', line 26

def to_s
  to_h.to_s
end