Class: Broadcast::Medium::Jabber::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/broadcast/media/jabber.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password, server = nil, port = 5222) ⇒ Client



9
10
11
12
13
14
# File 'lib/broadcast/media/jabber.rb', line 9

def initialize(username, password, server = nil, port = 5222)
  @jid    = Jabber::JID::new(username)
  @client = Jabber::Client::new(@jid)
  client.connect(server, port)
  client.auth(password)
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



7
8
9
# File 'lib/broadcast/media/jabber.rb', line 7

def client
  @client
end

Instance Method Details

#deliver(recipient, body) ⇒ Object



16
17
18
# File 'lib/broadcast/media/jabber.rb', line 16

def deliver(recipient, body)
  client.send Jabber::Message::new(recipient, body)
end