Class: Notifu::Actors::GammuSmsBridge

Inherits:
Notifu::Actor show all
Defined in:
lib/notifu/actors/gammu_sms_bridge.rb

Instance Attribute Summary

Attributes inherited from Notifu::Actor

#contacts, #issue

Instance Method Summary collapse

Methods inherited from Notifu::Actor

#apply_template, #default_template, #load_data, #perform

Methods included from Util

action_log, log, option

Instance Method Details

#actObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/notifu/actors/gammu_sms_bridge.rb', line 9

def act
  self.contacts.each do |contact|
    cell = contact.cell
    tmpl = contact.sms_template
    tmpl ||= default_template
    message = self.apply_template tmpl
    # send message to sms-bridge
    socket = TCPSocket.new Notifu::CONFIG[:actors][:gammu_sms_bridge][:host], Notifu::CONFIG[:actors][:gammu_sms_bridge][port]
    socket.send contact.cell.to_s + "--" + message
    socket.close
    socket = nil
  end
end