smsc_manager 0.3.4 → 0.3.5

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,6 @@
1
+ Version 0.3.5
2
+ Added small improvements to send_sms.rb usage to use flags
3
+
1
4
  Version 0.3.1
2
5
  Added 999 as routing prefix
3
6
 
data/bin/send_sms.rb CHANGED
@@ -1,8 +1,39 @@
1
1
  #!/usr/bin/env ruby
2
- if ARGV.size !=4
3
- puts "Usage: send_sms.rb user destination source text"
2
+ require 'optparse'
3
+ def usage
4
+ puts "Usage: send_sms.rb -u user -m msisdn -s source -t text "
5
+ puts "or for example send_sms.rb --user etc."
4
6
  exit
5
7
  end
8
+ def parse_options(params)
9
+ opts = OptionParser.new
10
+ puts "argv are #{params}"
11
+ #params_split = params.split(' ')
12
+ #puts "paramsp is #{paramsp}"
13
+ user_flag=msisdn_flag=source_flag=text_flag=true
14
+ temp_hash = {}
15
+ opts.on("-u","--user VAL", String) {|val| temp_hash[:user ] = val
16
+ puts "user is #{val}"
17
+ user_flag=false }
18
+ opts.on("-m","--msisdn VAL", String) {|val| temp_hash[:msisdn ] = val
19
+ puts "msiddn is #{val}"
20
+ msisdn_flag=false }
21
+ opts.on("-s","--source VAL", String) {|val| temp_hash[:source ] = val
22
+ puts "source is #{val}"
23
+ source_flag=false }
24
+ opts.on("-t","--text VAL", String) {|val| temp_hash[:text ] = val
25
+ puts "text is #{val}"
26
+ text_flag=false }
27
+ #opts.on("-d","--database VAL", String) {|val| temp_hash[:db ] = val }
28
+ #opts.on("-p","--password VAL", String) {|val| temp_hash[:password ] = val }
29
+ #opts.on("-u","--user VAL", String) {|val| temp_hash[:user ] = val }
30
+ #puts " in test commander option parse #{port} #{url}"
31
+ opts.parse(params)
32
+ # puts " in HTTP #{hostname} port #{port} url: #{url}"
33
+ usage if user_flag or msisdn_flag or source_flag or text_flag
34
+ return temp_hash
35
+ end
36
+ arg_hash=parse_options(ARGV)
6
37
  require 'pp'
7
38
 
8
39
  require 'rubygems'
@@ -17,10 +48,10 @@ require 'smsc_manager'
17
48
  end
18
49
  puts "Found smsc: #{smsc.hostname} port #{smsc.port}"
19
50
 
20
- user=ARGV[0]
21
- destination=ARGV[1]
22
- source=ARGV[2]
23
- text=ARGV[3]
51
+ user=arg_hash[:user]
52
+ destination=arg_hash[:msisdn]
53
+ source=arg_hash[:source]
54
+ text=arg_hash[:text]
24
55
  sms=SmscManager::Sms.new(text,destination,source)
25
56
  puts "Sending user: #{user} destination: #{destination} text: #{text}"
26
57
  res= smsc.send(sms)
@@ -2,7 +2,7 @@ module SmscManager #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.3.4
7
- date: 2007-03-22 00:00:00 +08:00
6
+ version: 0.3.5
7
+ date: 2007-04-03 00:00:00 +08:00
8
8
  summary: connection to smsc via http using kannel
9
9
  require_paths:
10
10
  - lib