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, out_of_channel_notify

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


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

def self.active?
  @xmpp
end

.setup_connection(xmpp_information) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/uniform_notifier/xmpp.rb', line 11

def self.setup_connection( xmpp_information )
  return unless xmpp_information

  require 'xmpp4r'

  @xmpp = xmpp_information
  @receiver = xmpp_information[:receiver]
  @password = xmpp_information[:password]
  @account  = xmpp_information[:account]
  @show_online_status = xmpp_information[:show_online_status]
  @stay_connected = xmpp_information[:stay_connected].nil? ? true : xmpp_information[:stay_connected]

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