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)


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

def active?
  @xmpp
end

.setup_connection(xmpp_information) ⇒ Object



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

def 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, 'You must install the xmpp4r gem to use XMPP notification: `gem install xmpp4r`'
end