Class: Zm::Client::DistributionListOwnersCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/distributionlist/distributionlist_owners_collection.rb

Overview

Collection Account Aliases

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ DistributionListOwnersCollection

Returns a new instance of DistributionListOwnersCollection.



9
10
11
12
# File 'lib/zm/client/distributionlist/distributionlist_owners_collection.rb', line 9

def initialize(parent)
  @parent = parent
  @all = []
end

Instance Attribute Details

#allObject

Returns the value of attribute all.



7
8
9
# File 'lib/zm/client/distributionlist/distributionlist_owners_collection.rb', line 7

def all
  @all
end

Instance Method Details

#add!(*emails) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/zm/client/distributionlist/distributionlist_owners_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?

  @parent.sac.invoke(jsns('addOwners', emails))

  @all += emails
  true
end

#remove!(*emails) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/zm/client/distributionlist/distributionlist_owners_collection.rb', line 25

def remove!(*emails)
  emails.each { |email| Utils.format_email(email) }
  emails.delete_if { |email| !@all.include?(email) }
  return false if emails.empty?

  @parent.sac.invoke(jsns('removeOwners', emails))

  @all -= emails
  true
end