Class: Integrity::Notifier::Jabber
- Inherits:
-
Notifier::Base
- Object
- Notifier::Base
- Integrity::Notifier::Jabber
- Defined in:
- lib/integrity/notifier/jabber.rb
Class Method Summary collapse
Instance Method Summary collapse
- #deliver! ⇒ Object
-
#initialize(commit, config) ⇒ Jabber
constructor
A new instance of Jabber.
Constructor Details
#initialize(commit, config) ⇒ Jabber
Returns a new instance of Jabber.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/integrity/notifier/jabber.rb', line 12 def initialize(commit, config) config.delete_if { |k,v| v.blank? } @client = ::Jabber::Client.new(config.delete('jid')) @password = config.delete('password') @to = config.delete('to').split(/\s+/) @server = config.delete('server') @port = config.delete('port') || '5222' @stanza_limit = config.delete('stanza_limit') || '65536' super(commit, config) end |
Class Method Details
.to_haml ⇒ Object
8 9 10 |
# File 'lib/integrity/notifier/jabber.rb', line 8 def self.to_haml File.read(File.dirname(__FILE__) + "/config.haml") end |
Instance Method Details
#deliver! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/integrity/notifier/jabber.rb', line 25 def deliver! @client.connect(@server, @port.to_i) @client.auth(@password) body = [0...@stanza_limit.to_i] @to.each do |to| = ::Jabber::Message.new(to, body) .type = :chat @client.send() end @client.close end |