Class: Zm::Client::FolderRetentionPolicy

Inherits:
Base::AccountObject show all
Defined in:
lib/zm/client/folder/folder_retention_policy.rb

Overview

class for account folder retention policy

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#grantee_type, #id, #name, #parent, #token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base::AccountObject

#soap_account_connector

Methods inherited from Base::Object

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

Constructor Details

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

Instance Attribute Details

#lifetimeObject

Returns the value of attribute lifetime.



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

def lifetime
  @lifetime
end

#policyObject

Returns the value of attribute policy.



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

def policy
  @policy
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.create_by_json(parent, policy, json) ⇒ Object



9
10
11
12
13
# File 'lib/zm/client/folder/folder_retention_policy.rb', line 9

def create_by_json(parent, policy, json)
  frp = self.new(parent)
  frp.init_from_json(policy, json)
  frp
end

Instance Method Details

#init_from_json(policy, json) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/zm/client/folder/folder_retention_policy.rb', line 26

def init_from_json(policy, json)
  return if json.empty? || json[:policy].nil?

  @policy = policy
  @type = json[:policy].first[:type]
  @lifetime = json[:policy].first[:lifetime]
end

#keep?Boolean



18
19
20
# File 'lib/zm/client/folder/folder_retention_policy.rb', line 18

def keep?
  @policy == :keep
end

#purge?Boolean



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

def purge?
  @policy == :purge
end

#to_hObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/zm/client/folder/folder_retention_policy.rb', line 34

def to_h
  # :purge=>[{:policy=>[{:lifetime=>"366d", :type=>"user"}]}]
  {
    @policy => {
      policy: {
        lifetime: @lifetime,
        type: @type
      }
    }
  }
end