Class: Whistle::Switchbox
- Inherits:
-
Object
- Object
- Whistle::Switchbox
- Defined in:
- lib/switchbox.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #deliver(messages) ⇒ Object
-
#inform(message) ⇒ Object
Sends message to primary (first) subscriber only.
-
#initialize(user, password, subscribers) ⇒ Switchbox
constructor
A new instance of Switchbox.
Constructor Details
#initialize(user, password, subscribers) ⇒ Switchbox
Returns a new instance of Switchbox.
8 9 10 11 |
# File 'lib/switchbox.rb', line 8 def initialize(user,password,subscribers) @user, @password, @subscribers = user, password, subscribers @jabber = Jabber::Simple.new(@user, @password) end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/switchbox.rb', line 6 def user @user end |
Instance Method Details
#deliver(messages) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/switchbox.rb', line 13 def deliver() @subscribers.each do |to| Array().each do |body| format_and_send :to => to, :body => body end end end |
#inform(message) ⇒ Object
Sends message to primary (first) subscriber only
22 23 24 25 26 |
# File 'lib/switchbox.rb', line 22 def inform() if (primary = @subscribers.first) format_and_send :to => @subscribers.first, :body => end end |