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 CHANGED
@@ -1,6 +1,8 @@
1
1
  = esendex4soap
2
+ require 'esendex4soap'
2
3
 
3
- Description goes here.
4
+ sms = Esendex::Client.new "uname", "passwd", "acc_ref"
5
+ sms.send_message '336xxxxxxx', 'message body', 'from int or string', 'int expire in hours'
4
6
 
5
7
  == Contributing to esendex4soap
6
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.30
1
+ 0.5.1
data/esendex4soap.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{esendex4soap}
8
- s.version = "0.4.30"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Voip Scout}]
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'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: esendex4soap
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.30
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Voip Scout