Class: Zm::Client::Recipients

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/common/recipients.rb

Overview

Collection recipients

Instance Method Summary collapse

Constructor Details

#initializeRecipients

Returns a new instance of Recipients.



7
8
9
# File 'lib/zm/client/common/recipients.rb', line 7

def initialize
  @recipients = []
end

Instance Method Details

#add(recipient) ⇒ Object



15
16
17
18
19
# File 'lib/zm/client/common/recipients.rb', line 15

def add(recipient)
  return unless recipient.is_a?(Recipient)

  @recipients.push(recipient)
end

#bccObject



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

def bcc
  @recipients.select { |r| r.field == Recipient::BCC }
end

#ccObject



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

def cc
  @recipients.select { |r| r.field == Recipient::CC }
end

#clearObject



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

def clear
  @recipients.clear
end

#del(recipient) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/zm/client/common/recipients.rb', line 21

def del(recipient)
  case recipient
  when Recipient
    @recipients.delete(recipient)
  when String
    @recipients.delete_if { |r| r.email == recipient }
  end
end

#fromObject



46
47
48
# File 'lib/zm/client/common/recipients.rb', line 46

def from
  @recipients.select { |r| r.field == Recipient::FROM }
end

#map(&block) ⇒ Object



11
12
13
# File 'lib/zm/client/common/recipients.rb', line 11

def map(&block)
  @recipients.map(&block)
end

#toObject



34
35
36
# File 'lib/zm/client/common/recipients.rb', line 34

def to
  @recipients.select { |r| r.field == Recipient::TO }
end