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

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

#arrow_name, #clone, #concat, #convert_json_string_value, #initialize, #instance_variables_array, #instance_variables_hash, #recorded?, #save!

Constructor Details

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

Instance Method Details

#end_atObject



32
33
34
35
36
# File 'lib/zm/client/backup/backup.rb', line 32

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

#full?Boolean

Returns:

  • (Boolean)


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

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

#incremental?Boolean

Returns:

  • (Boolean)


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

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

#init_from_json(json) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/zm/client/backup/backup.rb', line 46

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



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

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

#to_hObject



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

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

#to_sObject



22
23
24
# File 'lib/zm/client/backup/backup.rb', line 22

def to_s
  to_h.to_s
end