24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/knj/sms.rb', line 24
def send_sms(number, msg)
if @type == "bibob"
if !@soap
require "webrick/https"
@soap = SOAP::WSDLDriverFactory.new("https://www.bibob.dk/SmsSender.asmx?WSDL").create_rpc_driver
end
result = @soap.SendMessage({
"cellphone" => @opts[:user],
"password" => Php4r.md5(@opts[:pass]),
"smsTo" => {"string" => number},
"smscontents" => msg,
"sendDate" => Php4r.date("Y-m-d"),
"deliveryReport" => "0",
"fromNumber" => @opts[:user]
})
if result.sendMessageResult.errorString.to_s != "Ingen fejl."
raise "Could not send SMS: (" + result.sendMessageResult.errorCode.to_s + "): " + result.sendMessageResult.errorString.to_s
end
elsif @type == "smsd_db"
@db.insert("outbox", {
"number" => number,
"text" => msg,
"insertdate" => Php4r.date("Y-m-d H:i:s")
})
else
raise "Not supported: " + @type
end
end
|