Class: God::Contacts::Jabber
- Inherits:
-
God::Contact
- Object
- God::Contact
- God::Contacts::Jabber
- Defined in:
- lib/god/contacts/jabber.rb
Class Attribute Summary collapse
-
.format ⇒ Object
Returns the value of attribute format.
-
.settings ⇒ Object
Returns the value of attribute settings.
Instance Attribute Summary collapse
-
#jabber_id ⇒ Object
Returns the value of attribute jabber_id.
Attributes inherited from God::Contact
Instance Method Summary collapse
Methods inherited from God::Contact
#friendly_name, generate, normalize, valid?
Methods included from God::Configurable
#base_name, complain, #complain, #friendly_name, #prepare, #reset
Class Attribute Details
.format ⇒ Object
Returns the value of attribute format.
22 23 24 |
# File 'lib/god/contacts/jabber.rb', line 22 def format @format end |
.settings ⇒ Object
Returns the value of attribute settings.
22 23 24 |
# File 'lib/god/contacts/jabber.rb', line 22 def settings @settings end |
Instance Attribute Details
#jabber_id ⇒ Object
Returns the value of attribute jabber_id.
33 34 35 |
# File 'lib/god/contacts/jabber.rb', line 33 def jabber_id @jabber_id end |
Instance Method Details
#notify(message, time, priority, category, host) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/god/contacts/jabber.rb', line 39 def notify(, time, priority, category, host) begin jabber_id = XMPP4R::JID::new "#{Jabber.settings[:jabber_id]}/God" jabber_client = XMPP4R::Client::new jabber_id jabber_client.connect jabber_client.auth Jabber.settings[:password] body = Jabber.format.call , priority, category, host = XMPP4R::Message::new self.jabber_id, body .set_type :normal .set_id '1' .set_subject 'God' jabber_client.send self.info = "sent jabber message to #{self.jabber_id}" rescue => e puts e. puts e.backtrace.join("\n") self.info = "failed to send jabber message to #{self.jabber_id}: #{e.}" end end |
#valid? ⇒ Boolean
35 36 37 |
# File 'lib/god/contacts/jabber.rb', line 35 def valid? valid = true end |