Class: Imessage::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/imessage/sender.rb

Instance Method Summary collapse

Instance Method Details

#deliver(options = {text:nil, attachment:nil, contacts: []}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/imessage/sender.rb', line 3

def deliver(options = {text:nil, attachment:nil, contacts: []})
  if options[:text].nil? && options[:attachment].nil?
    raise "You must specific at least a text or attachment."
  end

  if options[:contacts].empty?
    raise "You must specific at least one contact"
  end

  options[:contacts].each do |contact|
    _deliver(options[:text], options[:attachment], contact)
  end
end