Class: UniformNotifier::Xmpp

Inherits:
Base
  • Object
show all
Defined in:
lib/uniform_notifier/xmpp.rb

Class Method Summary collapse

Methods inherited from Base

inline_notify, wrap_js_association

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/uniform_notifier/xmpp.rb', line 7

def self.active?
  @xmpp
end

.out_of_channel_notify(message) ⇒ Object



11
12
13
14
# File 'lib/uniform_notifier/xmpp.rb', line 11

def self.out_of_channel_notify( message )
  return unless active?
  notify( message )
end

.setup_connection(xmpp_information) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/uniform_notifier/xmpp.rb', line 16

def self.setup_connection( xmpp_information )
  require 'xmpp4r'

  @receiver = xmpp_information[:receiver]
  @password = xmpp_information[:password]
  @account  = xmpp_information[:account]
  @show_online_status = xmpp_information[:show_online_status]

  connect
rescue LoadError
  @xmpp = nil
  raise NotificationError.new( 'You must install the xmpp4r gem to use XMPP notification: `gem install xmpp4r`' )
end