Class: GoogleChat

Inherits:
Object
  • Object
show all
Includes:
Jabber
Defined in:
lib/google_chat.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, password, resource = 'Resource') ⇒ GoogleChat

Returns a new instance of GoogleChat.



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

def initialize(user, password, resource='Resource')
  jid = JID::new("#{user}/#{resource}")
  @client = Client::new(jid)
  @client.use_ssl = true
  begin
    @client.connect('talk.google.com', 443)
    @client.auth(password)
    return @self
  rescue Exception => e
    puts e.message
  end
end

Instance Method Details

#send(message, to) ⇒ Object



22
23
24
# File 'lib/google_chat.rb', line 22

def send(message,to)
  @client.send  Message::new(to, message).set_type(:normal).set_id('1')
end