smsc_manager 0.2.7 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,9 @@
1
+ Version 0.3.1
2
+ Added 999 as routing prefix
3
+
4
+ Version 0.2.8
5
+ Fixed small bug in strip text when txt==nil
6
+
1
7
  Version 0.2.7
2
8
  Now max size is 3 * 160 (which means that max sms text is 3 sms messages)
3
9
  And includes receive_sms_controller.rb to demontrate how to receive sms
@@ -2,9 +2,10 @@
2
2
  module SmscManager
3
3
  class InvalidPrefix < RuntimeError
4
4
  end
5
+ # this class defines setting up a sms
5
6
  class Sms
6
- @@MAX_SIZE=3*160 # max 3 sms
7
- @@msisdn_valid_prefix= %w{ 63989 989 0989 1000 }
7
+ @@MAX_SIZE=1500 # 3*160 # max 3 sms
8
+ @@msisdn_valid_prefix= %w{ 63999 999 0999 1000 888 +63999 }
8
9
  attr_accessor :text, :source, :destination, :orig_txt
9
10
  def self.max_length
10
11
  @@MAX_SIZE
@@ -19,7 +20,7 @@ class Sms
19
20
  prefix = prefix.to_s
20
21
  self.destination[0, prefix.length] == prefix
21
22
  end
22
- def initialize(txt,dest,src='1000')
23
+ def initialize(txt,dest,src='888')
23
24
  self.orig_txt=txt
24
25
  self.destination=dest
25
26
  self.source=src
@@ -43,6 +44,8 @@ class Sms
43
44
  ret
44
45
  end
45
46
  def strip_text(txt)
47
+ # puts "text is #{txt} nil #{txt==nil}"
48
+ txt= " " if txt==nil
46
49
  result=txt.gsub(/@/,"(at)") # replace all at signs return result
47
50
  # result=result.gsub(/\n/," ") # replace all new lines return result
48
51
  # result=result.gsub(/\r/," ") # replace all new lines return result
@@ -1,8 +1,8 @@
1
1
  module SmscManager #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 2
5
- TINY = 7
4
+ MINOR = 3
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -36,6 +36,10 @@ class SmscManagerTest < Test::Unit::TestCase
36
36
  assert true, 'save with modify failed'
37
37
 
38
38
  end
39
+ def test_sms_text_nil
40
+ sms=SmscManager::Sms.new(nil,'09896557890','websource')
41
+ assert sms.text==" ", "text not correct"
42
+ end
39
43
  def test_find_google_mod
40
44
  @smsc.hostname='www.google.com'
41
45
  #assert @smsc.save==true, 'could not save google mod'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: smsc_manager
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.7
7
- date: 2007-02-26 00:00:00 +08:00
6
+ version: 0.3.1
7
+ date: 2007-03-19 00:00:00 +08:00
8
8
  summary: connection to smsc via http using kannel
9
9
  require_paths:
10
10
  - lib