Module: Jab

Includes:
Jabber
Defined in:
lib/jab.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jab(opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jab.rb', line 7

def self.jab(opts={})
  if [:from, :password, :to, :text].any?{|x| !opts.include? x }
    raise ArgumentError, "you must specify :from, :to, :text"
  end
  
  Client.new(JID.new("#{opts[:from]}/Home")).instance_eval do
    connect 'talk.google.com'
    auth    opts[:password] 
    send    Message.new(opts[:to], opts[:text]).tap{|m| m.type = :chat }
    close 
  end
end

Instance Method Details

#jab(opts) ⇒ Object



20
21
22
# File 'lib/jab.rb', line 20

def jab(opts)
  Jab.jab(opts)
end