Class: Zm::Client::DistributionListMembersCollection
- Inherits:
-
Object
- Object
- Zm::Client::DistributionListMembersCollection
- Defined in:
- lib/zm/client/distributionlist/distributionlist_members_collection.rb
Overview
Collection Account Aliases
Instance Attribute Summary collapse
-
#all ⇒ Object
Returns the value of attribute all.
Instance Method Summary collapse
- #add!(emails) ⇒ Object
-
#initialize(parent) ⇒ DistributionListMembersCollection
constructor
A new instance of DistributionListMembersCollection.
- #remove!(emails) ⇒ Object
Constructor Details
#initialize(parent) ⇒ DistributionListMembersCollection
Returns a new instance of DistributionListMembersCollection.
9 10 11 12 |
# File 'lib/zm/client/distributionlist/distributionlist_members_collection.rb', line 9 def initialize(parent) @parent = parent @all = [] end |
Instance Attribute Details
#all ⇒ Object
Returns the value of attribute all.
7 8 9 |
# File 'lib/zm/client/distributionlist/distributionlist_members_collection.rb', line 7 def all @all end |
Instance Method Details
#add!(emails) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/zm/client/distributionlist/distributionlist_members_collection.rb', line 14 def add!(emails) emails.each { |email| Utils.format_email(email) } emails.delete_if { |email| @all.include?(email) } return false if emails.empty? soap_request = SoapElement.admin(SoapAdminConstants::ADD_DISTRIBUTION_LIST_MEMBER_REQUEST) soap_request.add_attribute('id', @parent.id) node_dlm = SoapElement.create('dlm') node_dlm.add_content(emails) soap_request.add_node(node_dlm) @parent.sac.invoke(soap_request) @all += emails true end |
#remove!(emails) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/zm/client/distributionlist/distributionlist_members_collection.rb', line 30 def remove!(emails) emails.each { |email| Utils.format_email(email) } emails.delete_if { |email| !@all.include?(email) } return false if emails.empty? soap_request = SoapElement.admin(SoapAdminConstants::REMOVE_DISTRIBUTION_LIST_MEMBER_REQUEST) soap_request.add_attribute('id', @parent.id) node_dlm = SoapElement.create('dlm') node_dlm.add_content(emails) soap_request.add_node(node_dlm) @parent.sac.invoke(soap_request) @all -= emails true end |