Sha256: 2ef3ca4454d4cfef43ae6c7e9b45d0e5d54d63a68de653ce4b8abf3e5ac59eab
Contents?: true
Size: 773 Bytes
Versions: 2
Compression:
Stored size: 773 Bytes
Contents
module Imessage class Sender TYPES = [:text, :attachment] def deliver(options = {text:nil, attachment:nil, contacts: []}) options[:contacts].each do |contact| _deliver(options[:text], options[:attachment], contact) end end private def _deliver(text, attachment, contact) unless text.nil? apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'scripts/send_text.applescript') `osascript #{apple_script_file} '#{contact}' '#{text}'` end unless attachment.nil? apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'scripts/send_attachment.applescript') `osascript #{apple_script_file} '#{contact}' '#{attachment}'` end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
imessage-0.1.1 | lib/imessage/sender.rb |
imessage-0.1.0 | lib/imessage/sender.rb |