Class: Zm::Client::DistributionList

Inherits:
Base::Object show all
Includes:
HasSoapAdminConnector
Defined in:
lib/zm/client/distributionlist/distributionlist.rb

Overview

objectClass: zimbraDistributionList

Instance Attribute Summary

Attributes inherited from Base::Object

#id, #name, #parent, #token

Instance Method Summary collapse

Methods included from HasSoapAdminConnector

#soap_admin_connector

Methods inherited from Base::Object

#clone, #initialize, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute

Constructor Details

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

Instance Method Details

#acesObject



30
31
32
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 30

def aces
  @aces ||= DistributionListAcesCollection.new(self)
end

#aliasesObject



14
15
16
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 14

def aliases
  @aliases ||= DistributionListAliasesCollection.new(self)
end

#attrs_writeObject



100
101
102
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 100

def attrs_write
  @parent.zimbra_attributes.all_distributionlist_attrs_writable_names
end

#create!Object



34
35
36
37
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 34

def create!
  resp = sac.invoke(jsns_builder.to_create)
  @id = resp[:CreateDistributionListResponse][:dl].first[:id]
end

#delete!Object



61
62
63
64
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 61

def delete!
  sac.invoke(jsns_builder.to_delete)
  @id = nil
end

#external_transport?Boolean

Returns:

  • (Boolean)


82
83
84
85
86
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 82

def external_transport?
  return nil unless zimbraMailTransport

  zimbraMailTransport.start_with?(SoapConstants::SMTP)
end

#group?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 92

def group?
  zimbraMailStatus == SoapConstants::DISABLED
end

#hide_in_gal?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 88

def hide_in_gal?
  zimbraHideInGal == SoapConstants::TRUE
end

#local_transportObject



66
67
68
69
70
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 66

def local_transport
  raise Zm::Client::ZmError, 'zimbraMailHost is null' if zimbraMailHost.nil?

  "lmtp:#{zimbraMailHost}:7025"
end

#local_transport!Object



72
73
74
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 72

def local_transport!
  update!(zimbraMailTransport: local_transport)
end

#local_transport?Boolean

Returns:

  • (Boolean)


76
77
78
79
80
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 76

def local_transport?
  return nil unless zimbraMailTransport

  zimbraMailTransport.start_with?(SoapConstants::LMTP)
end

#mailing_list?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 96

def mailing_list?
  zimbraMailStatus == SoapConstants::ENABLED
end

#membersObject



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

def members
  @members ||= DistributionListMembersCollection.new(self)
end

#membershipsObject



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

def memberships
  @memberships ||= DlsMembershipCollection.new(self)
end

#modify!Object



39
40
41
42
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 39

def modify!
  sac.invoke(jsns_builder.to_update)
  true
end

#ownersObject



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

def owners
  @owners ||= DistributionListOwnersCollection.new(self)
end

#rename!(new_name) ⇒ Object



56
57
58
59
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 56

def rename!(new_name)
  sac.invoke(jsns_builder.to_rename(new_name))
  @name = new_name
end

#update!(hash) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/zm/client/distributionlist/distributionlist.rb', line 44

def update!(hash)
  return false if hash.delete_if { |k, v| v.nil? || !respond_to?(k) }.empty?

  do_update!(hash)

  hash.each do |key, value|
    update_attribute(key, value)
  end

  true
end