smsnger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2010 Joel Watson
2
+ (Large) Portions Copyright (c) 2008 Brendan G. Lim
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,97 @@
1
+ = SMSnger
2
+
3
+ Want to send an SMS from your Ruby application? SMSnger allows you to do just that.
4
+ It allows you to send a text-message in the form of an e-mail to a cell phone on any
5
+ of the supported carriers.
6
+
7
+ == Supported Carriers (US & International):
8
+
9
+ Alltel, Ameritech, AT&T, Bell Atlantic, BellSouth Mobility, Beeline(UA), BlueSkyFrog,
10
+ Boost Mobile, BPL Mobile, Cellular South, Claro (Brazil, Nicaragua), Comcast, Du,
11
+ E-Plus, Etisalat, Fido, kajeet, Mobinil, Mobitel, Movistar, Metro PCS, O2, Orange,
12
+ Powertel, PSC Wireless, Qwest, Rogers, Southern Link, Sprint, Suncom,
13
+ T-Mobile (US/UK/Germany), Telefonica, Tracfone, Virgin Mobile, Verizon Wireless,
14
+ Vodafone (UK, Egypt, Italy, Japan, Spain), and many more ...
15
+
16
+ == Opt-In Warning for Some International Carriers
17
+
18
+ Some International carriers require that their users subscribe to an Email to SMS
19
+ feature before they are able to receive SMS messages this way. If one your users
20
+ mentions that they are not receiving their messages, chances are it is due to this
21
+ limitation.
22
+
23
+ Some carriers that need this include, Mobitel, Etisalat, T-Mobile (Netherlands),
24
+ etc.
25
+
26
+ == Setup Instructions
27
+
28
+ Add this this one line to the file you want to be able to use SMS Fu in.
29
+
30
+ require 'smsnger'
31
+
32
+ Once the library is required, you need to run a setup like so:
33
+
34
+ SMSnger.setup(:from => "someone@example.com")
35
+
36
+ By default sendmail is used, but you can use SMTP as follows:
37
+
38
+ SMSnger.setup(
39
+ :from => "someone@example.com",
40
+ :mail_via => :smtp,
41
+ :smtp => {
42
+ :host => 'smtp.yourserver.com',
43
+ :port => '25',
44
+ :user => 'user',
45
+ :password => 'pass',
46
+ :auth => :plain, # :plain, :login, :cram_md5, no auth by default
47
+ :domain => "example.com"
48
+ }
49
+ )
50
+
51
+ That's it! Now you're good to go.
52
+
53
+ == Example Usage
54
+
55
+ * You have to send in the phone number, without any non-numeric characters. The
56
+ phone numbers must be 10 digits in length.
57
+ * The two required parameters are the phone number and the phone carrier.
58
+ * Here are some of the default carrier values:
59
+
60
+ Alltel Wireless => "alltel"
61
+ AT&T/Cingular => "at&t"
62
+ Boost Mobile => "boost"
63
+ Sprint Wireless => "sprint"
64
+ T-Mobile US => "t-mobile"
65
+ T-Mobile UK => "t-mobile-uk"
66
+ Virgin Mobile => "virgin"
67
+ Verizon Wireless => "verizon"
68
+ Vodafone Tokyo => "vodafone-jp-tokyo"
69
+
70
+ * <b>Check sms_fu.yml for a complete list of supported carriers, including international
71
+ carriers as well.</b>
72
+
73
+ SMSnger.deliver_sms("5558675309","at&t","message")
74
+
75
+ * If you want to set a custom from e-mail per SMS message, you can do so
76
+ by doing the following.
77
+
78
+ SMSnger.deliver_sms("5558675309","at&t","message", :from => "bob@test.com")
79
+
80
+ * You can set the maximum length of the SMS message, which is not set by
81
+ default. Most phones can only accept 128 characters. To do this just
82
+ specify the limit option.
83
+
84
+ SMSnger.deliver_sms("5558675309","at&t","message", :limit => 128)
85
+
86
+ * You can retrieve just the formatted address to use in your own mailer.
87
+
88
+ SMSnger.get_sms_address("5558675309","at&t") # => "5558675309@txt.att.net"
89
+
90
+ == Special Thanks
91
+
92
+ A big thank you to Brendan G. Lim, the original author of SMS Fu, who inspired the creation
93
+ of this gem and who did most of the heavy-lifting.
94
+
95
+ Copyright (c) 2010 Joel Watson, released under the MIT license
96
+
97
+ (Large) Portions Copyright (c) 2008 Brendan G. Lim, Intridea, Inc., released under the MIT license
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "smsnger"
8
+ gem.summary = %Q{A Ruby library to send text messenges for free via email.}
9
+ gem.description = %Q{A Ruby library to send text messenges for free via email (extracted from the SMS-Fu Rails plugin by Brendan Lim).}
10
+ gem.email = "watsonian@gmail.com"
11
+ gem.homepage = "http://github.com/watsonian/smsnger"
12
+ gem.authors = ["watsonian"]
13
+ gem.add_dependency "pony", ">= 0.6"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/test_*.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "smsnger #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,229 @@
1
+ alltel:
2
+ name: Alltel
3
+ value: @message.alltel.com
4
+ ameritech:
5
+ name: Ameritech
6
+ value: @paging.acswireless.com
7
+ at&t:
8
+ name: AT&T
9
+ value: @txt.att.net
10
+ bell-atlantic:
11
+ name: Bell Atlantic
12
+ value: @message.bam.com
13
+ bellsouthmobility:
14
+ name: Bellsouth Mobility
15
+ value: @blsdcs.net
16
+ blueskyfrog:
17
+ name: BlueSkyFrog
18
+ value: @blueskyfrog.com
19
+ boost:
20
+ name: Boost Mobile
21
+ value: @myboostmobile.com
22
+ cellularsouth:
23
+ name: Cellular South
24
+ value: @csouth1.com
25
+ comcast:
26
+ name: Comcast PCS
27
+ value: @comcastpcs.textmsg.com
28
+ cricket:
29
+ name: Cricket
30
+ value: @sms.mycricket.com
31
+ kajeet:
32
+ name: kajeet
33
+ value: @mobile.kajeet.net
34
+ metropcs:
35
+ name: Metro PCS
36
+ value: @mymetropcs.com
37
+ nextel:
38
+ name: Nextel
39
+ value: @messaging.nextel.com
40
+ powertel:
41
+ name: Powertel
42
+ value: @ptel.net
43
+ pscwireless:
44
+ name: PSC Wireless
45
+ value: @sms.pscel.com
46
+ qwest:
47
+ name: Qwest
48
+ value: @qwestmp.com
49
+ southernlink:
50
+ name: Southern Link
51
+ value: @page.southernlinc.com
52
+ sprint:
53
+ name: Sprint PCS
54
+ value: @messaging.sprintpcs.com
55
+ suncom:
56
+ name: Suncom
57
+ value: @tms.suncom.com
58
+ t-mobile:
59
+ name: T-Mobile
60
+ value: @tmomail.net
61
+ tracfone:
62
+ name: Tracfone
63
+ value: @mmst5.tracfone.com
64
+ telus-mobility:
65
+ name: Telus Mobility
66
+ value: @msg.telus.com
67
+ virgin:
68
+ name: Virgin Mobile
69
+ value: @vmobl.net
70
+ verizon:
71
+ name: Verizon Wireless
72
+ value: @vtext.com
73
+ # International Carriers
74
+ aliant-canada:
75
+ name: Aliant (Canada)
76
+ value: @chat.wirefree.ca
77
+ beeline-ua:
78
+ name: Beeline
79
+ value: @sms.beeline.ua
80
+ bellmobility-canada:
81
+ name: Bell Mobility (Canada)
82
+ value: @txt.bell.ca
83
+ bpl-mobile:
84
+ name: BPL Mobile
85
+ value: @bplmobile.com
86
+ claro-brazil:
87
+ name: Claro (Brazil)
88
+ value: @clarotorpedo.com.br
89
+ claro-nicaragua:
90
+ name: Claro (Nicaragua)
91
+ value: @ideasclaro-ca.com
92
+ du-arab-emirates:
93
+ name: Du (UAE)
94
+ value: @email2sms.ae
95
+ e-plus-germany:
96
+ name: E-Plus (Germany)
97
+ value: @smsmail.eplus.de
98
+ etisalat-arab-emirates:
99
+ name: Etisalat (UAE)
100
+ value: @email2sms.ae
101
+ fido-canada:
102
+ name: Fido
103
+ value: @fido.ca
104
+ manitobatelecom-canada:
105
+ name: Manitoba Telecom (Canada)
106
+ value: @text.mtsmobility.com
107
+ mobinil-egypt:
108
+ name: Mobinil
109
+ value: @mobinil.net
110
+ mobistar-belgium:
111
+ name: Mobistar (Belgium)
112
+ value: @mobistar.be
113
+ mobitel:
114
+ name: Mobitel
115
+ value: @sms.mobitel.lk
116
+ movistar-spain:
117
+ name: Movistar (Spain)
118
+ value: @correo.movistar.net
119
+ northerntel-canada:
120
+ name: NorthernTel (Canada)
121
+ value: @txt.northerntelmobility.com
122
+ o2-germany:
123
+ name: o2 (Germany)
124
+ value: @o2online.de
125
+ o2-uk:
126
+ name: o2 (UK)
127
+ value: @mmail.co.uk
128
+ orange-mumbai:
129
+ name: Orange (Mumbai)
130
+ value: @orangemail.co.in
131
+ orange-netherlands:
132
+ name: Orange (Netherlands)
133
+ value: @sms.orange.nl
134
+ orange-uk:
135
+ name: Orange (UK)
136
+ value: @orange.net
137
+ rogers-wireless:
138
+ name: Rogers Wireless
139
+ value: @pcs.rogers.com
140
+ rogers-canada:
141
+ name: Rogers (Canada)
142
+ value: @pcs.rogers.ca
143
+ sasktel-canada:
144
+ name: SaskTel (canada)
145
+ value: @sms.sasktel.ca
146
+ sfr-france:
147
+ name: SFR (France)
148
+ value: @sfr.fr
149
+ t-mobile-austria:
150
+ name: T-Mobile (Austria)
151
+ value: @sms.t-mobile.at
152
+ t-mobile-germany:
153
+ name: T-Mobile (Germany)
154
+ value: @t-d1-sms.de
155
+ t-mobile-germany:
156
+ name: T-Mobile (Netherlands)
157
+ value: @gin.nl
158
+ t-mobile-uk:
159
+ name: T-Mobile (UK)
160
+ value: @t-mobile.uk.net
161
+ telebec-canada:
162
+ name: Telebec (Canada)
163
+ value: @txt.telebecmobilite.com
164
+ telefonica-spain:
165
+ name: Telefonica (Spain)
166
+ value: @movistar.net
167
+ telus-canada:
168
+ name: Telus (Canada)
169
+ value: @msg.telus.com
170
+ virgin-canada:
171
+ name: Virgin (Canada)
172
+ value: @vmobile.ca
173
+ vodafone-germany:
174
+ name: Vodafone (Germany)
175
+ value: @vodafone-sms.de
176
+ vodafone-egypt:
177
+ name: Vodafone (Egypt)
178
+ value: @vodafone.com.eg
179
+ vodafone-uk:
180
+ name: Vodafone (UK)
181
+ value: @sms.vodafone.net
182
+ vodafone-italy:
183
+ name: Vodafone (Italy)
184
+ value: @sms.vodafone.it
185
+ vodafone-jp-chuugoku:
186
+ name: Vodafone (Japan - Chuugoku)
187
+ value: @n.vodafone.ne.jp
188
+ vodafone-jp-hokkaido:
189
+ name: Vodafone (Japan - Hokkaido)
190
+ value: @d.vodafone.ne.jp
191
+ vodafone-jp-hokuriko:
192
+ name: Vodafone (Japan - Hokuriko)
193
+ value: @r.vodafone.ne.jp
194
+ vodafone-jp-kansai:
195
+ name: Vodafone (Japan - Kansai)
196
+ value: @k.vodafone.ne.jp
197
+ vodafone-jp-osaka:
198
+ name: Vodafone (Japan - Osaka)
199
+ value: @k.vodafone.ne.jp
200
+ vodafone-jp-kanto:
201
+ name: Vodafone (Japan - Kanto)
202
+ value: @k.vodafone.ne.jp
203
+ vodafone-jp-koushin:
204
+ name: Vodafone (Japan - Koushin)
205
+ value: @k.vodafone.ne.jp
206
+ vodafone-jp-tokyo:
207
+ name: Vodafone (Japan - Tokyo)
208
+ value: @k.vodafone.ne.jp
209
+ vodafone-jp-kyuushu:
210
+ name: Vodafone (Japan - Kyuushu)
211
+ value: @q.vodafone.ne.jp
212
+ vodafone-jp-okinawa:
213
+ name: Vodafone (Japan - Okinawa)
214
+ value: @q.vodafone.ne.jp
215
+ vodafone-jp-shikoku:
216
+ name: Vodafone (Japan - Shikoku)
217
+ value: @s.vodafone.ne.jp
218
+ vodafone-jp-touhoku:
219
+ name: Vodafone (Japan - Touhoku)
220
+ value: @h.vodafone.ne.jp
221
+ vodafone-jp-niigata:
222
+ name: Vodafone (Japan - Niigata)
223
+ value: @h.vodafone.ne.jp
224
+ vodafone-jp-toukai:
225
+ name: Vodafone (Japan - Toukai)
226
+ value: @h.vodafone.ne.jp
227
+ vodafone-spain:
228
+ name: Vodafone (Japan - Spain)
229
+ value: @vodafone.es
@@ -0,0 +1,115 @@
1
+ require 'rubygems'
2
+ require 'yaml'
3
+ require 'pony'
4
+ # Copyright (c) 2008 Brendan G. Lim (brendangl@gmail.com)
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ class SMSnger
26
+ def self.setup(options = {})
27
+ default_options = {
28
+ :config => File.join(File.dirname(__FILE__),"carriers.yml"),
29
+ :from => "noreply@domain.com",
30
+ :mail_via => :sendmail
31
+ }
32
+ default_options.merge!(options)
33
+
34
+ @@mail_via ||= default_options[:mail_via]
35
+
36
+ raise SMSngerExceptions.new("You must specify a :from address setting in SMSnger.setup!") unless default_options.has_key?(:from)
37
+ @@from_address = default_options[:from]
38
+
39
+ if @@mail_via == :smtp
40
+ raise SMSngerExceptions.new("You must specify the :smtp settings in SMSnger.setup!") unless default_options.has_key?(:smtp)
41
+ smtp_config(default_options[:smtp])
42
+ end
43
+
44
+ load_carriers(default_options[:config])
45
+
46
+ return default_options
47
+ end
48
+
49
+ def self.carrier_name(key)
50
+ carriers[key]['name']
51
+ end
52
+
53
+ def self.carriers
54
+ @@carriers.dup
55
+ end
56
+
57
+ def self.deliver_sms(number,carrier,message,options={})
58
+ raise SMSngerException.new("Cannot deliver an empty message to #{format_number(number)}") if message.nil? or message.empty?
59
+
60
+ options[:limit] ||= message.length
61
+ options[:from] ||= @@from_address
62
+ message = message[0..options[:limit]-1]
63
+ sms_email = determine_sms_email(format_number(number),carrier)
64
+
65
+ case @@mail_via
66
+ when :sendmail
67
+ Pony.mail(:to => sms_email, :from => options[:from], :body => message)
68
+ when :smtp
69
+ Pony.mail(:to => sms_email, :from => options[:from], :body => message, :via => @@mail_via, :smtp => @@smtp_settings)
70
+ else
71
+ raise SMSngerException.new("Unknown mail method #{@@mail_via}.")
72
+ end
73
+
74
+ rescue SMSngerException => exception
75
+ raise exception
76
+ end
77
+
78
+ def self.get_sms_address(number,carrier)
79
+ number = format_number(number)
80
+ determine_sms_email(number,carrier)
81
+ end
82
+
83
+ private
84
+ def self.load_carriers(carrier_path)
85
+ @@carriers ||= YAML.load_file(carrier_path)
86
+ end
87
+
88
+ def self.smtp_config(smtp_config_hash)
89
+ unless @@mail_via == :sendmail
90
+ @@smtp_settings ||= smtp_config_hash
91
+ end
92
+ end
93
+
94
+ def self.format_number(number)
95
+ pre_formatted = number.gsub("-","").strip
96
+ formatted = (pre_formatted.length == 11 && pre_formatted[0,1] == "1") ? pre_formatted[1..pre_formatted.length] : pre_formatted
97
+ return is_valid?(formatted) ? formatted : (raise SMSngerException.new("Phone number (#{number}) is not formatted correctly"))
98
+ end
99
+
100
+ def self.is_valid?(number)
101
+ number.length >= 10 && number[/^.\d+$/]
102
+ end
103
+
104
+ def self.determine_sms_email(phone_number, carrier)
105
+ if @@carriers.has_key?(carrier.downcase)
106
+ "#{phone_number}#{@@carriers[carrier.downcase]['value']}"
107
+ else
108
+ raise SMSngerException.new("Specified carrier, #{carrier} is not supported.")
109
+ end
110
+ end
111
+ end
112
+
113
+ SMSnger.setup
114
+
115
+ class SMSngerException < StandardError; end
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{smsnger}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["watsonian"]
12
+ s.date = %q{2010-01-26}
13
+ s.description = %q{A Ruby library to send text messenges for free via email (extracted from the SMS-Fu Rails plugin by Brendan Lim).}
14
+ s.email = %q{watsonian@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".gitignore",
21
+ "MIT-LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/carriers.yml",
26
+ "lib/smsnger.rb",
27
+ "smsnger.gemspec",
28
+ "test/helper.rb",
29
+ "test/test_smsnger.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/watsonian/smsnger}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.5}
35
+ s.summary = %q{A Ruby library to send text messenges for free via email.}
36
+ s.test_files = [
37
+ "test/helper.rb",
38
+ "test/test_smsnger.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<pony>, [">= 0.6"])
47
+ else
48
+ s.add_dependency(%q<pony>, [">= 0.6"])
49
+ end
50
+ else
51
+ s.add_dependency(%q<pony>, [">= 0.6"])
52
+ end
53
+ end
54
+
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ require 'smsnger'
7
+
8
+ class Test::Unit::TestCase
9
+ end
@@ -0,0 +1,20 @@
1
+ require 'helper'
2
+
3
+ class SmsFuTest < Test::Unit::TestCase
4
+ def test_validity_of_number
5
+ assert_raise(SMSngerException) { SMSnger.deliver_sms("456789011","AT&T","Message") }
6
+ assert_equal("5555555555@txt.att.net", SMSnger.get_sms_address("1-555-555-5555","AT&T"))
7
+ end
8
+
9
+ def test_international_number
10
+ assert_equal("+445555555555@txt.att.net", SMSnger.get_sms_address("+44-555-555-5555","AT&T"))
11
+ end
12
+
13
+ def test_handling_of_blank_message
14
+ assert_raise(SMSngerException) { SMSnger.deliver_sms("1234567890","AT&T","") }
15
+ end
16
+
17
+ def test_get_sms_address
18
+ assert_equal("1234567890@txt.att.net", SMSnger.get_sms_address("1234567890","AT&T"))
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smsnger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - watsonian
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-26 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: pony
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0.6"
24
+ version:
25
+ description: A Ruby library to send text messenges for free via email (extracted from the SMS-Fu Rails plugin by Brendan Lim).
26
+ email: watsonian@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.rdoc
33
+ files:
34
+ - .document
35
+ - .gitignore
36
+ - MIT-LICENSE
37
+ - README.rdoc
38
+ - Rakefile
39
+ - VERSION
40
+ - lib/carriers.yml
41
+ - lib/smsnger.rb
42
+ - smsnger.gemspec
43
+ - test/helper.rb
44
+ - test/test_smsnger.rb
45
+ has_rdoc: true
46
+ homepage: http://github.com/watsonian/smsnger
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --charset=UTF-8
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.3.5
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: A Ruby library to send text messenges for free via email.
73
+ test_files:
74
+ - test/helper.rb
75
+ - test/test_smsnger.rb