Sha256: b6e503584e4629d15f951e3b79540e7d854120b0e2e7e018d9545b63f34bdc35

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

#!/usr/bin/env ruby

require 'xmpp4r-simple'

module Flapjack
  module Notifiers
    class Xmpp
    
      def initialize(opts={})
    
        @jid = opts[:jid]
        @password = opts[:password]
        unless @jid && @password 
          raise ArgumentError, "You have to provide a username and password"
        end
        @xmpp = Jabber::Simple.new(@jid, @password)
    
      end
    
      def notify(opts={})
    
        raise unless opts[:who] && opts[:result]
    
        message = <<-DESC
          Check #{opts[:result].id} returned the status "#{opts[:result].status}".
            http://localhost:4000/checks/#{opts[:result].id}
        DESC
    
        @xmpp.deliver(opts[:who].jid, message)
    
      end
    
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auxesis-flapjack-0.3.8 lib/flapjack/notifiers/xmpp.rb
auxesis-flapjack-0.4.1 lib/flapjack/notifiers/xmpp/xmpp.rb
auxesis-flapjack-0.4.2 lib/flapjack/notifiers/xmpp/xmpp.rb
auxesis-flapjack-0.4.5 lib/flapjack/notifiers/xmpp/xmpp.rb
auxesis-flapjack-0.4.6 lib/flapjack/notifiers/xmpp/xmpp.rb