esendex4soap 0.4.30 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -1
- data/VERSION +1 -1
- data/esendex4soap.gemspec +1 -1
- data/lib/esendex4soap.rb +7 -8
- metadata +1 -1
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.1
|
data/esendex4soap.gemspec
CHANGED
data/lib/esendex4soap.rb
CHANGED
@@ -33,22 +33,21 @@ module Esendex
|
|
33
33
|
|
34
34
|
end
|
35
35
|
|
36
|
-
def send_message(recipient, text)
|
37
|
-
text = text.lstrip.rstrip
|
36
|
+
def send_message(recipient, text, originator, validityperiod)
|
38
37
|
@log.debug "TO:#{recipient} text size:#{text.size} in #{text.full_lang} language"
|
39
|
-
|
38
|
+
#TODO: handle other languages as well
|
40
39
|
unless text.full_lang == 'russian'
|
41
40
|
sms_parts = text.scan(/.{610}/mu)
|
42
41
|
sms_parts << text[sms_parts.to_s.size..text.size]
|
43
42
|
@message_kind = 'Text'
|
44
43
|
@log.debug "#{@message_kind}:#{text.scan(/./mu)} = #{text.size}. #{sms_parts.size} part/s."
|
45
|
-
sms(recipient, sms_parts)
|
44
|
+
sms(recipient, sms_parts, originator, validityperiod)
|
46
45
|
else
|
47
46
|
sms_parts = text.scan(/.{70}/mu)
|
48
47
|
sms_parts << text[sms_parts.to_s.size..text.size]
|
49
48
|
@message_kind = 'Unicode'
|
50
49
|
@log.debug "#{@message_kind}:#{text.scan(/./mu)} != #{text.size}. #{sms_parts.size} part/s."
|
51
|
-
sms(recipient, sms_parts)
|
50
|
+
sms(recipient, sms_parts, originator, validityperiod)
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
@@ -59,14 +58,14 @@ module Esendex
|
|
59
58
|
@client.http.auth.ssl.verify_mode=(:none)
|
60
59
|
end
|
61
60
|
|
62
|
-
def sms(recipient, messages)
|
61
|
+
def sms(recipient, messages, originator, validityperiod)
|
63
62
|
@log.debug "#{@message_kind}:#{messages.size} parts."
|
64
63
|
connect
|
65
64
|
messages.each do |message|
|
66
65
|
@log.debug "#{@message_kind}:#{message.size} bytes. Sending..."
|
67
66
|
resp = @client.request :com, :send_message_full do |soap|
|
68
67
|
soap.header["com:MessengerHeader"] = {"com:Username" => @username, "com:Password" => @password, "com:Account" => @account_reference}
|
69
|
-
soap.body = {"com:recipient" => recipient, "com:body" => message, "com:type" => @message_kind}
|
68
|
+
soap.body = {"com:recipient" => recipient, "com:body" => message, "com:type" => @message_kind, "com:originator" => originator, "com:validityperiod" => validityperiod}
|
70
69
|
end
|
71
70
|
@log.debug "Sent #{@message_kind}:#{recipient}:#{message.size} bytes"
|
72
71
|
@sent_message_ids << resp.to_hash[:send_message_full_response][:send_message_full_result]
|
@@ -80,5 +79,5 @@ module Esendex
|
|
80
79
|
|
81
80
|
end #module Esendex
|
82
81
|
|
83
|
-
#sms = Esendex::Client.new 'username', 'password', 'account_reference'
|
82
|
+
#sms = Esendex::Client.new 'username', 'password', 'account_reference', 'from', 'expire int hours'
|
84
83
|
#sms.send_message 'PHONENUMBER', 'message in any language'
|